]> git.sur5r.net Git - openldap/blob - servers/slapd/overlays/overlays.c
Added static ppolicy, refinit, unique overlays
[openldap] / servers / slapd / overlays / overlays.c
1 /* overlays.c - Static overlay framework */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2003-2004 The OpenLDAP Foundation.
6  * Copyright 2003 by Howard Chu.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in the file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17 /* ACKNOWLEDGEMENTS:
18  * This work was initially developed by Howard Chu for inclusion in
19  * OpenLDAP Software.
20  */
21
22 #include "portable.h"
23
24 #include "slap.h"
25
26
27 #if SLAPD_OVER_CHAIN == SLAPD_MOD_STATIC
28 extern int chain_init();
29 #endif
30 #if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
31 extern int denyop_init();
32 #endif
33 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
34 extern int dyngroup_init();
35 #endif
36 #if SLAPD_OVER_LASTMOD == SLAPD_MOD_STATIC
37 extern int lastmod_init();
38 #endif
39 #if SLAPD_OVER_PPOLICY == SLAPD_MOD_STATIC
40 extern int ppolicy_init();
41 #endif
42 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
43 extern int pcache_init();
44 #endif
45 #if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC
46 extern int refint_init();
47 #endif
48 #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
49 extern int rwm_init();
50 #endif
51 #if SLAPD_OVER_UNIQUE == SLAPD_MOD_STATIC
52 extern int unique_init();
53 #endif
54
55 static struct {
56         char *name;
57         int (*func)();
58 } funcs[] = {
59 #if SLAPD_OVER_CHAIN == SLAPD_MOD_STATIC
60         { "LDAP Chain Response", chain_init },
61 #endif
62 #if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
63         { "Deny Operation", denyop_init },
64 #endif
65 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
66         { "Dynamic Group", dyngroup_init },
67 #endif
68 #if SLAPD_OVER_LASTMOD == SLAPD_MOD_STATIC
69         { "Last Modification", lastmod_init },
70 #endif
71 #if SLAPD_OVER_PPOLICY == SLAPD_MOD_STATIC
72         { "Password Policy", ppolicy_init },
73 #endif
74 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
75         { "Proxy Cache", pcache_init },
76 #endif
77 #if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC
78         { "Referential Integrity", refint_init },
79 #endif
80 #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
81         { "Rewrite/Remap", rwm_init },
82 #endif
83 #if SLAPD_OVER_UNIQUE == SLAPD_MOD_STATIC
84         { "Attribute Uniqueness", unique_init },
85 #endif
86         { NULL, NULL }
87 };
88
89 int
90 overlay_init(void)
91 {
92         int i, rc = 0;
93
94         for ( i=0; funcs[i].name; i++ ) {
95                 rc = funcs[i].func();
96                 if ( rc ) {
97 #ifdef NEW_LOGGING
98                         LDAP_LOG( BACKEND, ERR,
99                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
100 #else
101                         Debug( LDAP_DEBUG_ANY,
102                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
103 #endif
104                         break;
105                 }
106         }
107         return rc;
108 }