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.
This commit is contained in:
Howard Chu 1999-08-17 01:30:09 +00:00
parent d620793b6f
commit 22ad6bd6d4
2 changed files with 26 additions and 4 deletions

View File

@ -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 <filename>\" line\n",
"%s: line %d: missing filename in \"moduleload <filename>\" 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 <path>\" 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*/

View File

@ -6,7 +6,7 @@
#include <ltdl.h>
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 */