From: Howard Chu Date: Thu, 26 May 2005 09:43:39 +0000 (+0000) Subject: ITS#3748 do necessary startup when adding databases online X-Git-Tag: OPENLDAP_AC_BP~597 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b6d515330ce0da77d1ebfa53b8fb1222c4b23eaa;p=openldap ITS#3748 do necessary startup when adding databases online --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index d8726ff9f4..356f819e3c 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -968,11 +968,20 @@ config_generic(ConfigArgs *c) { c->be = LDAP_STAILQ_FIRST(&backendDB); } else if ( !strcasecmp( c->argv[1], "frontend" )) { c->be = frontendDB; - } else if(!(c->be = backend_db_init(c->argv[1]))) { - sprintf( c->msg, "<%s> failed init", c->argv[0] ); - Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n", - c->log, c->msg, c->argv[1] ); - return(1); + } else { + c->be = backend_db_init(c->argv[1]); + if ( !c->be ) { + sprintf( c->msg, "<%s> failed init", c->argv[0] ); + Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n", + c->log, c->msg, c->argv[1] ); + return(1); + } + if ( CONFIG_ONLINE_ADD(c) && backend_startup_one( c->be )) { + sprintf( c->msg, "<%s> failed startup", c->argv[0] ); + Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n", + c->log, c->msg, c->argv[1] ); + return(1); + } } break; diff --git a/servers/slapd/config.h b/servers/slapd/config.h index 47badfe7a3..bee94817e2 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -139,6 +139,11 @@ typedef struct config_args_s { ConfigDriver *cleanup; } ConfigArgs; +/* If lineno is zero, we have an actual LDAP Add request from a client. + * Otherwise, we're reading a config file or a config dir. + */ +#define CONFIG_ONLINE_ADD(ca) (!((ca)->lineno)) + #define value_int values.v_int #define value_long values.v_long #define value_ber_t values.v_ber_t