From 31a08fc6872d14a60feae6160520397398c6817e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 27 May 2006 11:01:06 +0000 Subject: [PATCH] Import ITS#4562 fix from HEAD --- servers/slapd/overlays/syncprov.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 3fe92a3e2b..5a3b4185c6 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1055,6 +1055,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) int rc; struct berval newdn; int freefdn = 0; + BackendDB *b0 = op->o_bd, db; fc.fdn = &op->o_req_ndn; /* compute new DN */ @@ -1067,6 +1068,10 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) freefdn = 1; } if ( op->o_tag != LDAP_REQ_ADD ) { + if ( !SLAP_ISOVERLAY( op->o_bd )) { + db = *op->o_bd; + op->o_bd = &db; + } op->o_bd->bd_info = (BackendInfo *)on->on_info; rc = be_entry_get_rw( op, fc.fdn, NULL, NULL, 0, &e ); /* If we're sending responses now, make a copy and unlock the DB */ @@ -1076,7 +1081,10 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) e = e2; } op->o_bd->bd_info = (BackendInfo *)on; - if ( rc ) return; + if ( rc ) { + op->o_bd = b0; + return; + } } else { e = op->ora_e; } @@ -1174,6 +1182,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) if ( freefdn ) { op->o_tmpfree( fc.fdn->bv_val, op->o_tmpmemctx ); } + op->o_bd = b0; } static int -- 2.39.5