Skip to content
Snippets Groups Projects
Commit 22ad6bd6 authored by Howard Chu's avatar Howard Chu
Browse files

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.
parent d620793b
No related branches found
No related tags found
No related merge requests found
......@@ -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*/
......
......@@ -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 */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment