ITS#3748 do necessary startup when adding databases online

This commit is contained in:
Howard Chu 2005-05-26 09:43:39 +00:00
parent 47daec07d5
commit b6d515330c
2 changed files with 19 additions and 5 deletions

View File

@ -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;

View File

@ -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