]> git.sur5r.net Git - openldap/blob - servers/slapd/overlays/overlays.c
Backglue hastily modified as an overlay
[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 #define SLAPD_OVER_GLUE SLAPD_MOD_STATIC
27
28 #if SLAPD_OVER_CHAIN == SLAPD_MOD_STATIC
29 extern int chain_init();
30 #endif
31 #if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
32 extern int denyop_init();
33 #endif
34 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
35 extern int dyngroup_init();
36 #endif
37 #if SLAPD_OVER_GLUE == SLAPD_MOD_STATIC
38 extern int glue_init();
39 #endif
40 #if SLAPD_OVER_LASTMOD == SLAPD_MOD_STATIC
41 extern int lastmod_init();
42 #endif
43 #if SLAPD_OVER_PPOLICY == SLAPD_MOD_STATIC
44 extern int ppolicy_init();
45 #endif
46 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
47 extern int pcache_init();
48 #endif
49 #if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC
50 extern int refint_init();
51 #endif
52 #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
53 extern int rwm_init();
54 #endif
55 #if SLAPD_OVER_SYNCPROV == SLAPD_MOD_STATIC
56 extern int syncprov_init();
57 #endif
58 #if SLAPD_OVER_UNIQUE == SLAPD_MOD_STATIC
59 extern int unique_init();
60 #endif
61
62 static struct {
63         char *name;
64         int (*func)();
65 } funcs[] = {
66 #if SLAPD_OVER_CHAIN == SLAPD_MOD_STATIC
67         { "LDAP Chain Response", chain_init },
68 #endif
69 #if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
70         { "Deny Operation", denyop_init },
71 #endif
72 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
73         { "Dynamic Group", dyngroup_init },
74 #endif
75 #if SLAPD_OVER_GLUE == SLAPD_MOD_STATIC
76         { "Backend Glue", glue_init },
77 #endif
78 #if SLAPD_OVER_LASTMOD == SLAPD_MOD_STATIC
79         { "Last Modification", lastmod_init },
80 #endif
81 #if SLAPD_OVER_PPOLICY == SLAPD_MOD_STATIC
82         { "Password Policy", ppolicy_init },
83 #endif
84 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
85         { "Proxy Cache", pcache_init },
86 #endif
87 #if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC
88         { "Referential Integrity", refint_init },
89 #endif
90 #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
91         { "Rewrite/Remap", rwm_init },
92 #endif
93 #if SLAPD_OVER_SYNCPROV == SLAPD_MOD_STATIC
94         { "Syncrepl Provider", syncprov_init },
95 #endif
96 #if SLAPD_OVER_UNIQUE == SLAPD_MOD_STATIC
97         { "Attribute Uniqueness", unique_init },
98 #endif
99         { NULL, NULL }
100 };
101
102 int
103 overlay_init(void)
104 {
105         int i, rc = 0;
106
107         for ( i=0; funcs[i].name; i++ ) {
108                 rc = funcs[i].func();
109                 if ( rc ) {
110                         Debug( LDAP_DEBUG_ANY,
111                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
112                         break;
113                 }
114         }
115         return rc;
116 }