From: Howard Chu Date: Fri, 26 May 2006 12:08:15 +0000 (+0000) Subject: ITS#4562 - don't assume syncprov_op_response only runs in overlay context; X-Git-Tag: OPENLDAP_REL_ENG_2_4_3ALPHA~9^2~211 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e3bea86205b45b8600de514b5e8da962aea5c476;p=openldap ITS#4562 - don't assume syncprov_op_response only runs in overlay context; under a glue setup it may be get a real DB, don't corrupt the DB struct. --- 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