#ifdef SLAPD_BDB2_DYNAMIC
-void back_bdb2_LTX_init_module(int argc, char *argv[]) {
- BackendInfo bi;
+int back_bdb2_LTX_init_module(int argc, char *argv[]) {
+ BackendInfo bi;
- memset( &bi, 0, sizeof(bi) );
- bi.bi_type = "bdb2";
- bi.bi_init = bdb2_back_initialize;
+ memset( &bi, 0, sizeof(bi) );
+ bi.bi_type = "bdb2";
+ bi.bi_init = bdb2_back_initialize;
- backend_add(&bi);
+ backend_add(&bi);
+ return 0;
}
#endif /* SLAPD_BDB2_DYNAMIC */
#ifdef SLAPD_LDAP_DYNAMIC
-void back_ldap_LTX_init_module(int argc, char *argv[]) {
- BackendInfo bi;
+int back_ldap_LTX_init_module(int argc, char *argv[]) {
+ BackendInfo bi;
- memset( &bi, 0, sizeof(bi) );
- bi.bi_type = "ldap";
- bi.bi_init = ldap_back_initialize;
+ memset( &bi, 0, sizeof(bi) );
+ bi.bi_type = "ldap";
+ bi.bi_init = ldap_back_initialize;
- backend_add(&bi);
+ backend_add(&bi);
+ return 0;
}
#endif /* SLAPD_LDAP_DYNAMIC */
#ifdef SLAPD_LDBM_DYNAMIC
-void back_ldbm_LTX_init_module(int argc, char *argv[]) {
- BackendInfo bi;
+int back_ldbm_LTX_init_module(int argc, char *argv[]) {
+ BackendInfo bi;
- memset( &bi, 0, sizeof(bi) );
- bi.bi_type = "ldbm";
- bi.bi_init = ldbm_back_initialize;
+ memset( &bi, 0, sizeof(bi) );
+ bi.bi_type = "ldbm";
+ bi.bi_init = ldbm_back_initialize;
- backend_add(&bi);
+ backend_add(&bi);
+ return 0;
}
#endif /* SLAPD_LDBM_DYNAMIC */
#ifdef SLAPD_PASSWD_DYNAMIC
-void back_passwd_LTX_init_module(int argc, char *argv[]) {
- BackendInfo bi;
+int back_passwd_LTX_init_module(int argc, char *argv[]) {
+ BackendInfo bi;
- memset( &bi, 0, sizeof(bi) );
- bi.bi_type = "passwd";
- bi.bi_init = passwd_back_initialize;
+ memset( &bi, 0, sizeof(bi) );
+ bi.bi_type = "passwd";
+ bi.bi_init = passwd_back_initialize;
- backend_add(&bi);
+ backend_add(&bi);
+ return 0;
}
#endif /* SLAPD_PASSWD_DYNAMIC */
#ifdef SLAPD_PERL_DYNAMIC
-void back_perl_LTX_init_module(int argc, char *argv[]) {
- BackendInfo bi;
+int back_perl_LTX_init_module(int argc, char *argv[]) {
+ BackendInfo bi;
- memset( &bi, 0, sizeof(bi) );
- bi.bi_type = "perl";
- bi.bi_init = perl_back_initialize;
+ memset( &bi, 0, sizeof(bi) );
+ bi.bi_type = "perl";
+ bi.bi_init = perl_back_initialize;
- backend_add(&bi);
+ backend_add(&bi);
+ return 0;
}
#endif /* SLAPD_PERL_DYNAMIC */
#ifdef SLAPD_SHELL_DYNAMIC
-void back_shell_LTX_init_module(int argc, char *argv[]) {
- BackendInfo bi;
+int back_shell_LTX_init_module(int argc, char *argv[]) {
+ BackendInfo bi;
- memset( &bi, 0, sizeof(bi) );
- bi.bi_type = "shell";
- bi.bi_init = shell_back_initialize;
+ memset( &bi, 0, sizeof(bi) );
+ bi.bi_type = "shell";
+ bi.bi_init = shell_back_initialize;
- backend_add(&bi);
+ backend_add(&bi);
+ return 0;
}
#endif /* SLAPD_SHELL_DYNAMIC */
#include <ltdl.h>
int load_module(const char* file_name, int argc, char *argv[]) {
- lt_dlhandle* module = NULL;
- void (*initialize) LDAP_P((int argc, char *argv[]));
+ lt_dlhandle* module = NULL;
+ int (*initialize) LDAP_P((int argc, char *argv[]));
- if (lt_dlinit()) {
- Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", lt_dlerror(), 0, 0);
- return -1;
- }
-
- if ((module = lt_dlopen(file_name)) == NULL) {
- Debug(LDAP_DEBUG_ANY, "lt_dlopen failed: (%s) %s\n", file_name, lt_dlerror(), 0);
- return -1;
- }
+ if (lt_dlinit()) {
+ Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", lt_dlerror(), 0, 0);
+ return -1;
+ }
+
+ if ((module = lt_dlopen(file_name)) == NULL) {
+ Debug(LDAP_DEBUG_ANY, "lt_dlopen failed: (%s) %s\n", file_name,
+ lt_dlerror(), 0);
+ return -1;
+ }
- Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0);
+ Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0);
- if ((initialize = lt_dlsym(module, "init_module"))) {
- initialize(argc, argv);
- } else {
- Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n", file_name, 0, 0);
- return -1;
- }
-
- return 0;
+ if ((initialize = lt_dlsym(module, "init_module")))
+ return initialize(argc, argv);
+
+ Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n",
+ file_name, 0, 0);
+ return -1;
}
#endif /* SLAPD_MODULES */