From: Howard Chu Date: Tue, 17 Aug 1999 01:30:09 +0000 (+0000) Subject: Add "modulepath" config statement for setting the search path for locating X-Git-Tag: TWEB_OL_BASE~201 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=22ad6bd6d4f37f2a5906448019f32c3bbdaca23f;p=openldap Add "modulepath" config statement for setting the search path for locating loadable modules. Gratuitously renamed "loadmodule" to "moduleload". "modulepath" takes a single argument, a colon-separated list of absolute pathnames. --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 47b081a286..a4e566b49f 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -654,19 +654,32 @@ read_config( char *fname ) ldap_srvtab = ch_strdup( cargv[1] ); #ifdef SLAPD_MODULES - } else if (strcasecmp( cargv[0], "loadmodule") == 0 ) { + } else if (strcasecmp( cargv[0], "moduleload") == 0 ) { if ( cargc < 2 ) { Debug( LDAP_DEBUG_ANY, - "%s: line %d: missing filename in \"loadmodule \" line\n", + "%s: line %d: missing filename in \"moduleload \" line\n", fname, lineno, 0 ); exit( EXIT_FAILURE ); } - if (load_module(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) { + if (module_load(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) { Debug( LDAP_DEBUG_ANY, "%s: line %d: failed to load or initialize module %s\n", fname, lineno, cargv[1]); exit( EXIT_FAILURE ); } + } else if (strcasecmp( cargv[0], "modulepath") == 0 ) { + if ( cargc != 2 ) { + Debug( LDAP_DEBUG_ANY, + "%s: line %d: missing path in \"modulepath \" line\n", + fname, lineno, 0 ); + exit( EXIT_FAILURE ); + } + if (module_path( cargv[1] )) { + Debug( LDAP_DEBUG_ANY, + "%s: line %d: failed to set module search path to %s\n", + fname, lineno, cargv[1]); + exit( EXIT_FAILURE ); + } #endif /*SLAPD_MODULES*/ diff --git a/servers/slapd/module.c b/servers/slapd/module.c index 1a29c2ccd2..3768f38b7c 100644 --- a/servers/slapd/module.c +++ b/servers/slapd/module.c @@ -6,7 +6,7 @@ #include -int load_module(const char* file_name, int argc, char *argv[]) { +int module_load(const char* file_name, int argc, char *argv[]) { lt_dlhandle* module = NULL; int (*initialize) LDAP_P((int argc, char *argv[])); @@ -31,5 +31,14 @@ int load_module(const char* file_name, int argc, char *argv[]) { return -1; } +int module_path(const char *path) { + + if (lt_dlinit()) { + Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", lt_dlerror(), 0, 0); + return -1; + } + + return lt_dlsetsearchpath( path ); +} #endif /* SLAPD_MODULES */