Commit 6003bf87 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

release entry before sending results (ITS#4313) fix from HEAD

parent 52a812f6
......@@ -7,7 +7,9 @@ OpenLDAP 2.3.16 Engineering
Fixed slapd ACL/suffix configuration issue (ITS#4307)
Fixed slapd-bdb/hdb cache issue (ITS#4308)
Fixed slapd-bdb/hdb/ldbm suffix add with default referral issue (ITS#4310)
Fixed syncrepl time/size limit parsing
Fixed slapd-ldbm compare cache release issue (ITS#4313)
Fixed slapd syncrepl time/size limit parsing
Fixed ldapsearch response control handling issue
Build environment
Replace sched_yield(2) on Linux with select(2) (ITS#3950)
Documentation
......
......@@ -36,13 +36,20 @@ ldbm_back_compare(
Attribute *a;
int manageDSAit = get_manageDSAit( op );
rs->sr_matched = NULL;
rs->sr_ref = NULL;
/* grab giant lock for reading */
ldap_pvt_thread_rdwr_rlock(&li->li_giant_rwlock);
/* get entry with reader lock */
if ( (e = dn2entry_r( op->o_bd, &op->o_req_ndn, &matched )) == NULL ) {
e = dn2entry_r( op->o_bd, &op->o_req_ndn, &matched );
if ( e == NULL ) {
if ( matched != NULL ) {
rs->sr_matched = ch_strdup( matched->e_dn );
struct berval bv;
ber_str2bv_x( matched, 0, 1, &bv, op->o_tmpmemctx );
rs->sr_matched = bv.bv_val;
rs->sr_ref = is_entry_referral( matched )
? get_entry_referrals( op, matched )
: NULL;
......@@ -55,16 +62,12 @@ ldbm_back_compare(
ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
rs->sr_err = LDAP_REFERRAL;
send_ldap_result( op, rs );
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
free( (char *)rs->sr_matched );
rs->sr_ref = NULL;
rs->sr_matched = NULL;
return( 1 );
goto return_results;
}
if (!manageDSAit && is_entry_referral( e ) ) {
if ( !manageDSAit && is_entry_referral( e ) ) {
struct berval bv;
/* entry is a referral, don't allow add */
rs->sr_ref = get_entry_referrals( op, e );
......@@ -73,13 +76,9 @@ ldbm_back_compare(
rs->sr_err = LDAP_REFERRAL;
rs->sr_matched = e->e_name.bv_val;
send_ldap_result( op, rs );
ber_dupbv_x( &bv, &e->e_name, op->o_tmpmemctx );
rs->sr_matched = bv.bv_val;
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
rs->sr_ref = NULL;
rs->sr_matched = NULL;
rs->sr_err = 1;
goto return_results;
}
......@@ -88,7 +87,6 @@ ldbm_back_compare(
{
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
NULL );
rs->sr_err = 1;
goto return_results;
}
......@@ -111,15 +109,28 @@ ldbm_back_compare(
}
}
return_results:;
cache_return_entry_r( &li->li_cache, e );
ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
send_ldap_result( op, rs );
if( rs->sr_err != LDAP_NO_SUCH_ATTRIBUTE ) {
rs->sr_err = 0;
switch ( rs->sr_err ) {
case LDAP_COMPARE_FALSE:
case LDAP_COMPARE_TRUE:
rs->sr_err = LDAP_SUCCESS;
break;
}
if ( rs->sr_ref != NULL ) {
ber_bvarray_free( rs->sr_ref );
rs->sr_ref = NULL;
}
return_results:;
cache_return_entry_r( &li->li_cache, e );
ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
return( rs->sr_err );
if ( rs->sr_matched != NULL ) {
op->o_tmpfree( (char *)rs->sr_matched, op->o_tmpmemctx );
rs->sr_matched = NULL;
}
return rs->sr_err;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment