From: Howard Chu Date: Thu, 22 May 2003 08:57:13 +0000 (+0000) Subject: ITS#2533 remember which backend fetched the entry X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~82 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ca4892d5e7db855606cfb7156451ca2227947fc2;p=openldap ITS#2533 remember which backend fetched the entry --- diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index d2350bb44b..2ce177474b 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -1126,13 +1126,10 @@ be_entry_get_rw( int rw, Entry **e ) { - Backend *be = op->o_bd; int rc; *e = NULL; - op->o_bd = select_backend( ndn, 0, 0 ); - if (op->o_bd == NULL) { rc = LDAP_NO_SUCH_OBJECT; } else if ( op->o_bd->be_fetch ) { @@ -1141,7 +1138,6 @@ be_entry_get_rw( } else { rc = LDAP_UNWILLING_TO_PERFORM; } - op->o_bd = be; return rc; } @@ -1159,9 +1155,12 @@ backend_group( Attribute *a; int rc; GroupAssertion *g; + Backend *be = op->o_bd; if ( op->o_abandon ) return SLAPD_ABANDON; + op->o_bd = select_backend( gr_ndn, 0, 0 ); + ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex ); for (g = op->o_conn->c_groups; g; g=g->ga_next) { @@ -1175,7 +1174,8 @@ backend_group( ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex ); if (g) { - return g->ga_res; + rc = g->ga_res; + goto done; } if ( target && dn_match( &target->e_nname, gr_ndn ) ) { @@ -1213,7 +1213,8 @@ backend_group( op->o_conn->c_groups = g; ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex ); } - +done: + op->o_bd = be; return rc; } @@ -1230,12 +1231,14 @@ backend_attribute( Attribute *a; int i, j, rc = LDAP_SUCCESS; AccessControlState acl_state = ACL_STATE_INIT; + Backend *be = op->o_bd; + + op->o_bd = select_backend( edn, 0, 0 ); if ( target && dn_match( &target->e_nname, edn ) ) { e = target; } else { rc = be_entry_get_rw(op, edn, NULL, entry_at, 0, &e ); - if ( rc != LDAP_SUCCESS ) return rc; } if ( e ) { @@ -1280,6 +1283,7 @@ freeit: if (e != target ) { } } + op->o_bd = be; return rc; }