]> git.sur5r.net Git - openldap/commitdiff
ITS#3748 do necessary startup when adding databases online
authorHoward Chu <hyc@openldap.org>
Thu, 26 May 2005 09:43:39 +0000 (09:43 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 26 May 2005 09:43:39 +0000 (09:43 +0000)
servers/slapd/bconfig.c
servers/slapd/config.h

index d8726ff9f481946f6ef346dc91a1aa7b9c125883..356f819e3c662bd90956e95eecfff4ea04a027bd 100644 (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;
 
index 47badfe7a392d86408b7e831361c34f59edc53ff..bee94817e22d63637206403a34546d2f12013c66 100644 (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