]> git.sur5r.net Git - openldap/blob - servers/slapd/overlays/overlays.c
ccfa1682457a53b10f12c905d7dce72ae811d5c4
[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_DYNGROUP == SLAPD_MOD_STATIC
28 extern int dyngroup_init();
29 #endif
30 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
31 extern int pcache_init();
32 #endif
33 #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
34 extern int rwm_init();
35 #endif
36
37 static struct {
38         char *name;
39         int (*func)();
40 } funcs[] = {
41 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
42         { "Dynamic Group", dyngroup_init },
43 #endif
44 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
45         { "Proxy Cache", pcache_init },
46 #endif
47 #if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
48         { "Rewrite/Remap", rwm_init },
49 #endif
50         { NULL, NULL }
51 };
52
53 int
54 overlay_init(void)
55 {
56         int i, rc = 0;
57
58         for ( i=0; funcs[i].name; i++ ) {
59                 rc = funcs[i].func();
60                 if ( rc ) {
61 #ifdef NEW_LOGGING
62                         LDAP_LOG( BACKEND, ERR,
63                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
64 #else
65                         Debug( LDAP_DEBUG_ANY,
66                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
67 #endif
68                         break;
69                 }
70         }
71         return rc;
72 }