From: Howard Chu Date: Thu, 2 Apr 2009 23:41:41 +0000 (+0000) Subject: ITS#6016 check for static backends and overlays X-Git-Tag: ACLCHECK_0~647 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bf3920360d5c00bb549065fd539803325378ebe1;p=openldap ITS#6016 check for static backends and overlays --- diff --git a/servers/slapd/module.c b/servers/slapd/module.c index a09da6a8b6..3b95c7c4b4 100644 --- a/servers/slapd/module.c +++ b/servers/slapd/module.c @@ -136,6 +136,31 @@ int module_load(const char* file_name, int argc, char *argv[]) return -1; } + /* If loading a backend, see if we already have it */ + if ( !strncasecmp( file_name, "back_", 5 )) { + char *name = (char *)file_name + 5; + char *dot = strchr( name, '.'); + if (dot) *dot = '\0'; + rc = backend_info( name ) != NULL; + if (dot) *dot = '.'; + if ( rc ) { + Debug( LDAP_DEBUG_CONFIG, "module_load: (%s) already present (static)\n", + file_name, 0, 0 ); + return 0; + } + } else { + /* check for overlays too */ + char *dot = strchr( file_name, '.' ); + if ( dot ) *dot = '\0'; + rc = overlay_find( file_name ) != NULL; + if ( dot ) *dot = '.'; + if ( rc ) { + Debug( LDAP_DEBUG_CONFIG, "module_load: (%s) already present (static)\n", + file_name, 0, 0 ); + return 0; + } + } + module = (module_loaded_t *)ch_calloc(1, sizeof(module_loaded_t) + strlen(file_name)); if (module == NULL) {