mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-30 02:19:26 -05:00
ITS#7235 prevent sop from being freed during init
This commit is contained in:
parent
8bf047c8cb
commit
9e6245f87e
1 changed files with 11 additions and 5 deletions
|
|
@ -2475,7 +2475,10 @@ syncprov_op_search( Operation *op, SlapReply *rs )
|
|||
ldap_pvt_thread_mutex_init( &sop->s_mutex );
|
||||
sop->s_rid = srs->sr_state.rid;
|
||||
sop->s_sid = srs->sr_state.sid;
|
||||
sop->s_inuse = 1;
|
||||
/* set refcount=2 to prevent being freed out from under us
|
||||
* by abandons that occur while we're running here
|
||||
*/
|
||||
sop->s_inuse = 2;
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
|
||||
while ( si->si_active ) {
|
||||
|
|
@ -2707,7 +2710,10 @@ shortcut:
|
|||
* for persistent search evaluation
|
||||
*/
|
||||
if ( sop ) {
|
||||
sop->s_filterstr= op->ors_filterstr;
|
||||
ldap_pvt_thread_mutex_lock( &sop->s_mutex );
|
||||
sop->s_filterstr = op->ors_filterstr;
|
||||
/* correct the refcount that was set to 2 before */
|
||||
sop->s_inuse--;
|
||||
}
|
||||
|
||||
/* If something changed, find the changes */
|
||||
|
|
@ -2727,15 +2733,15 @@ shortcut:
|
|||
#endif
|
||||
ber_dupbv_x( &fava->f_ava->aa_value, &mincsn, op->o_tmpmemctx );
|
||||
fava->f_next = op->ors_filter;
|
||||
if ( sop )
|
||||
ldap_pvt_thread_mutex_lock( &sop->s_mutex );
|
||||
op->ors_filter = fand;
|
||||
filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
|
||||
if ( sop ) {
|
||||
sop->s_flags |= PS_FIX_FILTER;
|
||||
ldap_pvt_thread_mutex_unlock( &sop->s_mutex );
|
||||
}
|
||||
}
|
||||
if ( sop ) {
|
||||
ldap_pvt_thread_mutex_unlock( &sop->s_mutex );
|
||||
}
|
||||
|
||||
/* Let our callback add needed info to returned entries */
|
||||
cb = op->o_tmpcalloc(1, sizeof(slap_callback)+sizeof(searchstate), op->o_tmpmemctx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue