]> git.sur5r.net Git - openldap/commitdiff
now works
authorPierangelo Masarati <ando@openldap.org>
Sat, 29 Jan 2005 22:04:34 +0000 (22:04 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 29 Jan 2005 22:04:34 +0000 (22:04 +0000)
servers/slapd/backend.c
servers/slapd/backover.c
tests/scripts/test033-glue-syncrepl

index 02e41b82ad1c286bd960b76a67be9e6648b5b033..0698243ed421a21fcc83f1ab9460777d995d9528 100644 (file)
@@ -190,54 +190,20 @@ int backend_add(BackendInfo *aBackendInfo)
        }
 }
 
-/* startup a specific backend database */
-int backend_startup_one(Backend *be)
+static int
+backend_set_controls( BackendDB *be )
 {
-       int             rc = 0;
        BackendInfo     *bi = be->bd_info;
 
-       assert(be);
-
-       be->be_pending_csn_list = (struct be_pcl *)
-               ch_calloc( 1, sizeof( struct be_pcl ));
-
-       LDAP_TAILQ_INIT( be->be_pending_csn_list );
-
-       /* back-relay takes care of itself; so may do other */
-       if ( be->be_ctrls[ SLAP_MAX_CIDS ] == 0 ) {
-               if ( overlay_is_over( be ) ) {
-                       bi = ((slap_overinfo *)be->bd_info->bi_private)->oi_orig;
-               }
-
-               if ( bi->bi_controls ) {
-                       AC_MEMCPY( be->be_ctrls, bi->bi_ctrls, sizeof( be->be_ctrls ) );
-               }
-
-               be->be_ctrls[ SLAP_MAX_CIDS ] = 1;
-       }
-
-       Debug( LDAP_DEBUG_TRACE,
-               "backend_startup_one: starting \"%s\"\n",
-               be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
-               0, 0 );
-       if ( be->bd_info->bi_db_open ) {
-               rc = be->bd_info->bi_db_open( be );
-               if ( rc != 0 ) {
-                       Debug( LDAP_DEBUG_ANY,
-                               "backend_startup_one: bi_db_open failed! (%d)\n",
-                               rc, 0, 0 );
-               }
-       }
-
        /* back-relay takes care of itself; so may do other */
-       bi = be->bd_info;
        if ( overlay_is_over( be ) ) {
                bi = ((slap_overinfo *)be->bd_info->bi_private)->oi_orig;
        }
 
        if ( bi->bi_controls ) {
                if ( be->be_ctrls[ SLAP_MAX_CIDS ] == 0 ) {
-                       AC_MEMCPY( be->be_ctrls, bi->bi_ctrls, sizeof( be->be_ctrls ) );
+                       AC_MEMCPY( be->be_ctrls, bi->bi_ctrls,
+                                       sizeof( be->be_ctrls ) );
                        be->be_ctrls[ SLAP_MAX_CIDS ] = 1;
 
                } else {
@@ -245,12 +211,43 @@ int backend_startup_one(Backend *be)
 
                        for ( i = 0; i < SLAP_MAX_CIDS; i++ ) {
                                if ( bi->bi_ctrls[ i ] ) {
-                                       be->be_ctrls[ i ] = 1;
+                                       be->be_ctrls[ i ] = bi->bi_ctrls[ i ];
                                }
                        }
                }
        }
 
+       return 0;
+}
+
+
+/* startup a specific backend database */
+int backend_startup_one(Backend *be)
+{
+       int             rc = 0;
+
+       be->be_pending_csn_list = (struct be_pcl *)
+               ch_calloc( 1, sizeof( struct be_pcl ));
+
+       LDAP_TAILQ_INIT( be->be_pending_csn_list );
+
+       Debug( LDAP_DEBUG_TRACE,
+               "backend_startup_one: starting \"%s\"\n",
+               be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
+               0, 0 );
+       (void)backend_set_controls( be );
+       if ( be->bd_info->bi_db_open ) {
+               rc = be->bd_info->bi_db_open( be );
+               if ( rc == 0 ) {
+                       (void)backend_set_controls( be );
+
+               } else {
+                       Debug( LDAP_DEBUG_ANY,
+                               "backend_startup_one: bi_db_open failed! (%d)\n",
+                               rc, 0, 0 );
+               }
+       }
+
        return rc;
 }
 
index 0ab6beb4ca7691bd754494eaefb04c0ce55ba74d..9c77024a213c85068adb5dab84bb66b10533e2d1 100644 (file)
@@ -223,6 +223,7 @@ enum op_which {
        op_extended,
        op_aux_operational,
        op_aux_chk_referrals,
+       op_aux_chk_controls,
        op_last
 };
 
@@ -243,7 +244,8 @@ static int op_rc[] = {
        LDAP_UNWILLING_TO_PERFORM,      /* cancel */
        LDAP_UNWILLING_TO_PERFORM,      /* extended */
        LDAP_SUCCESS,                   /* aux_operational */
-       LDAP_SUCCESS                    /* aux_chk_referrals */
+       LDAP_SUCCESS,                   /* aux_chk_referrals */
+       LDAP_SUCCESS                    /* aux_chk_controls */
 };
 
 static int
@@ -377,6 +379,12 @@ over_aux_chk_referrals( Operation *op, SlapReply *rs )
        return over_op_func( op, rs, op_aux_chk_referrals );
 }
 
+static int
+over_aux_chk_controls( Operation *op, SlapReply *rs )
+{
+       return over_op_func( op, rs, op_aux_chk_controls );
+}
+
 int
 overlay_register(
        slap_overinst *on
@@ -564,6 +572,7 @@ overlay_config( BackendDB *be, const char *ov )
                 */
                bi->bi_operational = over_aux_operational;
                bi->bi_chk_referrals = over_aux_chk_referrals;
+               bi->bi_chk_controls = over_aux_chk_controls;
 
                be->bd_info = bi;
 
index 2bcefa10447fd078913db0a309ce44c036c92138..82e3f3b07c878463c33914a1f2d03b55b899b97f 100755 (executable)
@@ -20,9 +20,6 @@ if test $GLUE = glueno; then
        exit 0
 fi 
 
-echo "Test temporarily disabled"
-exit 0
-
 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
 
 echo "Running slapadd to build glued slapd databases..."