mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
Make init_module return a success/fail value.
This commit is contained in:
parent
682fc1e8f7
commit
d620793b6f
@ -12,14 +12,15 @@
|
||||
|
||||
#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 */
|
||||
|
@ -32,14 +32,15 @@
|
||||
|
||||
#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 */
|
||||
|
@ -16,14 +16,15 @@
|
||||
|
||||
#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 */
|
||||
|
@ -11,14 +11,15 @@
|
||||
|
||||
#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 */
|
||||
|
@ -30,14 +30,15 @@ ldap_pvt_thread_mutex_t perl_interpreter_mutex;
|
||||
|
||||
#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 */
|
||||
|
@ -11,14 +11,15 @@
|
||||
|
||||
#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 */
|
||||
|
@ -7,29 +7,28 @@
|
||||
#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 (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);
|
||||
|
||||
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 ((initialize = lt_dlsym(module, "init_module")))
|
||||
return initialize(argc, argv);
|
||||
|
||||
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;
|
||||
Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n",
|
||||
file_name, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* SLAPD_MODULES */
|
||||
|
Loading…
Reference in New Issue
Block a user