]> git.sur5r.net Git - openldap/commitdiff
also restore original o_bd
authorPierangelo Masarati <ando@openldap.org>
Sat, 14 Jan 2006 17:47:54 +0000 (17:47 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 14 Jan 2006 17:47:54 +0000 (17:47 +0000)
servers/slapd/add.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c

index 9056e412ae07eda7200489ff8a0ff7b6f64df903..0f3f09a7ed58b0a5f8b9105b3d055e4c32070656 100644 (file)
@@ -216,7 +216,7 @@ fe_op_add( Operation *op, SlapReply *rs )
        int             manageDSAit;
        Modifications   **modtail = &op->ora_modlist;
        int             rc = 0;
-       BackendDB       *op_be;
+       BackendDB       *op_be, *bd = op->o_bd;
        char            textbuf[ SLAP_TEXT_BUFLEN ];
        size_t          textlen = sizeof( textbuf );
 
@@ -229,23 +229,20 @@ fe_op_add( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->ora_e->e_nname, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
+               op->o_bd = bd;
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->ora_e->e_name, LDAP_SCOPE_DEFAULT );
                if ( !rs->sr_ref ) rs->sr_ref = default_referral;
                if ( rs->sr_ref ) {
                        rs->sr_err = LDAP_REFERRAL;
-                       op->o_bd = frontendDB;
                        send_ldap_result( op, rs );
-                       op->o_bd = NULL;
 
                        if ( rs->sr_ref != default_referral ) {
                                ber_bvarray_free( rs->sr_ref );
                        }
                } else {
-                       op->o_bd = frontendDB;
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
-                       op->o_bd = NULL;
                }
                goto done;
        }
@@ -372,12 +369,13 @@ fe_op_add( Operation *op, SlapReply *rs )
 #endif /* SLAPD_MULTIMASTER */
                }
        } else {
-           Debug( LDAP_DEBUG_ARGS, "    do_add: no backend support\n", 0, 0, 0 );
-           send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+               Debug( LDAP_DEBUG_ARGS, "do_add: no backend support\n", 0, 0, 0 );
+               send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                        "operation not supported within namingContext" );
        }
 
 done:;
+       op->o_bd = bd;
        return rc;
 }
 
index e9eee9cace1f6757c4a7e5d97359a06f20180daf..8c261489e8657f7226c542a45dc2ff66458db421 100644 (file)
@@ -223,6 +223,7 @@ int
 fe_op_bind( Operation *op, SlapReply *rs )
 {
        struct berval   mech = op->orb_tmp_mech;
+       BackendDB       *bd = op->o_bd;
 
        /* check for inappropriate controls */
        if( get_manageDSAit( op ) == SLAP_CONTROL_CRITICAL ) {
@@ -387,9 +388,8 @@ fe_op_bind( Operation *op, SlapReply *rs )
                /* don't return referral for bind requests */
                /* noSuchObject is not allowed to be returned by bind */
                rs->sr_err = LDAP_INVALID_CREDENTIALS;
-               op->o_bd = frontendDB;
+               op->o_bd = bd;
                send_ldap_result( op, rs );
-               op->o_bd = NULL;
                goto cleanup;
        }
 
@@ -452,6 +452,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }
 
index 2dd0b169eb90d7fc91ffa3060a191ec0dbeecbea..bbe9774e1dd6f2526cf1c5afbdab10ab06059bfb 100644 (file)
@@ -135,9 +135,10 @@ cleanup:;
 int
 fe_op_compare( Operation *op, SlapReply *rs )
 {
-       Entry *entry = NULL;
-       int manageDSAit;
-       AttributeAssertion ava = *op->orc_ava;
+       Entry                   *entry = NULL;
+       int                     manageDSAit;
+       AttributeAssertion      ava = *op->orc_ava;
+       BackendDB               *bd = op->o_bd;
 
        if( strcasecmp( op->o_req_ndn.bv_val, LDAP_ROOT_DSE ) == 0 ) {
                Debug( LDAP_DEBUG_ARGS,
@@ -214,9 +215,8 @@ fe_op_compare( Operation *op, SlapReply *rs )
 
                rs->sr_err = LDAP_REFERRAL;
                if (!rs->sr_ref) rs->sr_ref = default_referral;
-               op->o_bd = frontendDB;
+               op->o_bd = bd;
                send_ldap_result( op, rs );
-               op->o_bd = NULL;
 
                if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                rs->sr_err = 0;
@@ -369,6 +369,7 @@ fe_op_compare( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }
 
index b060d9e3522c62ac94046e4a6de58197bc5b1ec5..8c696fa22ac83cbe77bac2b6f383e36245c2fe46 100644 (file)
@@ -101,7 +101,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
 {
        struct berval   pdn = BER_BVNULL;
        int             manageDSAit;
-       BackendDB *op_be;
+       BackendDB       *op_be, *bd = op->o_bd;
        
        manageDSAit = get_manageDSAit( op );
 
@@ -112,23 +112,19 @@ fe_op_delete( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
+               op->o_bd = bd;
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
 
                if (!rs->sr_ref) rs->sr_ref = default_referral;
                if ( rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
-
-                       op->o_bd = frontendDB;
                        send_ldap_result( op, rs );
-                       op->o_bd = NULL;
 
                        if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                } else {
-                       op->o_bd = frontendDB;
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
-                       op->o_bd = NULL;
                }
                goto cleanup;
        }
@@ -243,5 +239,6 @@ fe_op_delete( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }
index 05891b3dbef9e8be60367ff572ea9329f5105e2f..44f67247c7a0b885062fda956088982e36b78356 100644 (file)
@@ -214,7 +214,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
        Modifications   *tmp;
 #endif
        int             manageDSAit;
-       BackendDB       *op_be;
+       BackendDB       *op_be, *bd = op->o_bd;
        char            textbuf[ SLAP_TEXT_BUFLEN ];
        size_t          textlen = sizeof( textbuf );
        
@@ -302,6 +302,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
+               op->o_bd = bd;
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                if ( !rs->sr_ref ) {
@@ -310,19 +311,15 @@ fe_op_modify( Operation *op, SlapReply *rs )
 
                if ( rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
-                       op->o_bd = frontendDB;
                        send_ldap_result( op, rs );
-                       op->o_bd = NULL;
 
                        if ( rs->sr_ref != default_referral ) {
                                ber_bvarray_free( rs->sr_ref );
                        }
 
                } else {
-                       op->o_bd = frontendDB;
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
-                       op->o_bd = NULL;
                }
                goto cleanup;
        }
@@ -431,6 +428,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }
 
index 43eef3eb3f7ed58ddbcf0ad76e5b361d24675177..328f49ec60feac9ea65b2c7790ecd362980ca96f 100644 (file)
@@ -208,7 +208,7 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
        Backend         *newSuperior_be = NULL;
        int             manageDSAit;
        struct berval   pdn = BER_BVNULL;
-       BackendDB       *op_be;
+       BackendDB       *op_be, *bd = op->o_bd;
        
        if( op->o_req_ndn.bv_len == 0 ) {
                Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
@@ -238,22 +238,19 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
         */
        op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
+               op->o_bd = bd;
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                if (!rs->sr_ref) rs->sr_ref = default_referral;
 
                if ( rs->sr_ref != NULL ) {
                        rs->sr_err = LDAP_REFERRAL;
-                       op->o_bd = frontendDB;
                        send_ldap_result( op, rs );
-                       op->o_bd = NULL;
 
                        if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
                } else {
-                       op->o_bd = frontendDB;
                        send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                                "no global superior knowledge" );
-                       op->o_bd = NULL;
                }
                goto cleanup;
        }
@@ -381,6 +378,7 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
        }
 
 cleanup:;
+       op->o_bd = bd;
        return rs->sr_err;
 }