ITS#3365 - fix leaking bdb locks when evaluating dynamic groups

This commit is contained in:
Howard Chu 2004-10-27 14:52:18 +00:00
parent e7ec96fc6d
commit 0c9c90a3e9

View File

@ -1329,10 +1329,15 @@ backend_group(
Filter *filter; Filter *filter;
Entry *user; Entry *user;
Backend *b2 = op->o_bd; Backend *b2 = op->o_bd;
void *o_private = op->o_private;
if ( target && dn_match( &target->e_nname, op_ndn ) ) { if ( target && dn_match( &target->e_nname, op_ndn ) ) {
user = target; user = target;
} else { } else {
/* back-bdb stored lockinfo here, we saved it
* above. Clear it out so that a new lock can be used.
*/
op->o_private = NULL;
op->o_bd = select_backend( op_ndn, 0, 0 ); op->o_bd = select_backend( op_ndn, 0, 0 );
rc = be_entry_get_rw(op, op_ndn, NULL, NULL, 0, &user ); rc = be_entry_get_rw(op, op_ndn, NULL, NULL, 0, &user );
} }
@ -1397,6 +1402,8 @@ loopit:
} }
if ( user != target ) { if ( user != target ) {
be_entry_release_r( op, user ); be_entry_release_r( op, user );
/* restore previous lockinfo, if any */
op->o_private = o_private;
} }
} }
op->o_bd = b2; op->o_bd = b2;