]> git.sur5r.net Git - openldap/commitdiff
Fix prev commit, no recursion allowed in glue_sub_attach
authorHoward Chu <hyc@openldap.org>
Thu, 5 Feb 2009 22:59:02 +0000 (22:59 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 5 Feb 2009 22:59:02 +0000 (22:59 +0000)
servers/slapd/backglue.c

index cf53b0b5e35976c97a20631ba599933693e1884a..f8df9b2006f42f7bb8ca9ca27b525d6f0ea8388a 100644 (file)
@@ -949,6 +949,7 @@ typedef struct glue_Addrec {
 
 /* List of added subordinates */
 static glue_Addrec *ga_list;
+static int ga_adding;
 
 static int
 glue_db_init(
@@ -1087,6 +1088,11 @@ glue_sub_attach( int online )
        glue_Addrec *ga, *gnext = NULL;
        int rc = 0;
 
+       if ( ga_adding )
+               return 0;
+
+       ga_adding = 1;
+
        /* For all the subordinate backends */
        for ( ga=ga_list; ga != NULL; ga = gnext ) {
                BackendDB *be;
@@ -1135,8 +1141,11 @@ glue_sub_attach( int online )
                        /* allow this for now, assume a superior will
                         * be added later
                         */
-                       if ( online )
-                               return 0;
+                       if ( online ) {
+                               rc = 0;
+                               gnext = ga_list;
+                               break;
+                       }
                        rc = LDAP_NO_SUCH_OBJECT;
                }
                ch_free( ga );
@@ -1145,6 +1154,8 @@ glue_sub_attach( int online )
 
        ga_list = gnext;
 
+       ga_adding = 0;
+
        return rc;
 }