mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
reset candidates when intentionally abandoning; consistently handle referrals
This commit is contained in:
parent
46445759e4
commit
06eef0c78d
@ -224,7 +224,6 @@ meta_back_search( Operation *op, SlapReply *rs )
|
|||||||
struct timeval tv = { 0, 0 };
|
struct timeval tv = { 0, 0 };
|
||||||
LDAPMessage *res = NULL, *e;
|
LDAPMessage *res = NULL, *e;
|
||||||
int rc = 0, sres = LDAP_SUCCESS;
|
int rc = 0, sres = LDAP_SUCCESS;
|
||||||
BerVarray refs = NULL, v2refs = NULL;
|
|
||||||
char *matched = NULL;
|
char *matched = NULL;
|
||||||
int i, last = 0, ncandidates = 0,
|
int i, last = 0, ncandidates = 0,
|
||||||
initial_candidates = 0, candidate_match = 0;
|
initial_candidates = 0, candidate_match = 0;
|
||||||
@ -333,7 +332,6 @@ meta_back_search( Operation *op, SlapReply *rs )
|
|||||||
if ( op->ors_slimit > 0 && rs->sr_nentries == op->ors_slimit )
|
if ( op->ors_slimit > 0 && rs->sr_nentries == op->ors_slimit )
|
||||||
{
|
{
|
||||||
rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
|
rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
|
||||||
rs->sr_v2ref = v2refs;
|
|
||||||
savepriv = op->o_private;
|
savepriv = op->o_private;
|
||||||
op->o_private = (void *)i;
|
op->o_private = (void *)i;
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
@ -364,12 +362,10 @@ really_bad:;
|
|||||||
/* something REALLY bad happened! */
|
/* something REALLY bad happened! */
|
||||||
( void )meta_clear_unused_candidates( op, -1 );
|
( void )meta_clear_unused_candidates( op, -1 );
|
||||||
rs->sr_err = LDAP_OTHER;
|
rs->sr_err = LDAP_OTHER;
|
||||||
rs->sr_v2ref = v2refs;
|
|
||||||
savepriv = op->o_private;
|
savepriv = op->o_private;
|
||||||
op->o_private = (void *)i;
|
op->o_private = (void *)i;
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
op->o_private = savepriv;
|
op->o_private = savepriv;
|
||||||
rs->sr_v2ref = NULL;
|
|
||||||
|
|
||||||
/* anything else needs be done? */
|
/* anything else needs be done? */
|
||||||
|
|
||||||
@ -390,6 +386,8 @@ really_bad:;
|
|||||||
ldap_msgfree( res );
|
ldap_msgfree( res );
|
||||||
res = NULL;
|
res = NULL;
|
||||||
|
|
||||||
|
gotit = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If scope is BASE, we need to jump out
|
* If scope is BASE, we need to jump out
|
||||||
* as soon as one entry is found; if
|
* as soon as one entry is found; if
|
||||||
@ -406,8 +404,6 @@ really_bad:;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gotit = 1;
|
|
||||||
|
|
||||||
} else if ( rc == LDAP_RES_SEARCH_REFERENCE ) {
|
} else if ( rc == LDAP_RES_SEARCH_REFERENCE ) {
|
||||||
char **references = NULL;
|
char **references = NULL;
|
||||||
int cnt;
|
int cnt;
|
||||||
@ -547,12 +543,12 @@ really_bad:;
|
|||||||
/* cleanup */
|
/* cleanup */
|
||||||
ldap_value_free( references );
|
ldap_value_free( references );
|
||||||
|
|
||||||
if ( refs == NULL ) {
|
if ( rs->sr_v2ref == NULL ) {
|
||||||
refs = sr_ref;
|
rs->sr_v2ref = sr_ref;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for ( cnt = 0; !BER_BVISNULL( &sr_ref[ cnt ] ); cnt++ ) {
|
for ( cnt = 0; !BER_BVISNULL( &sr_ref[ cnt ] ); cnt++ ) {
|
||||||
ber_bvarray_add( &refs, &sr_ref[ cnt ] );
|
ber_bvarray_add( &rs->sr_v2ref, &sr_ref[ cnt ] );
|
||||||
}
|
}
|
||||||
ber_memfree( sr_ref );
|
ber_memfree( sr_ref );
|
||||||
}
|
}
|
||||||
@ -574,6 +570,7 @@ really_bad:;
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LDAP_SUCCESS:
|
case LDAP_SUCCESS:
|
||||||
|
case LDAP_REFERRAL:
|
||||||
is_ok++;
|
is_ok++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -609,6 +606,7 @@ really_bad:;
|
|||||||
ldap_abandon_ext( msc->msc_ld,
|
ldap_abandon_ext( msc->msc_ld,
|
||||||
candidates[ i ].sr_msgid,
|
candidates[ i ].sr_msgid,
|
||||||
NULL, NULL );
|
NULL, NULL );
|
||||||
|
candidates[ i ].sr_msgid = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -685,19 +683,17 @@ really_bad:;
|
|||||||
* important/reasonable
|
* important/reasonable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( sres == LDAP_SUCCESS && ( v2refs || refs ) ) {
|
if ( sres == LDAP_SUCCESS && rs->sr_v2ref ) {
|
||||||
sres = LDAP_REFERRAL;
|
sres = LDAP_REFERRAL;
|
||||||
}
|
}
|
||||||
rs->sr_err = sres;
|
rs->sr_err = sres;
|
||||||
rs->sr_matched = matched;
|
rs->sr_matched = matched;
|
||||||
rs->sr_v2ref = v2refs;
|
rs->sr_ref = ( sres == LDAP_REFERRAL ? rs->sr_v2ref : NULL );
|
||||||
rs->sr_ref = refs;
|
|
||||||
savepriv = op->o_private;
|
savepriv = op->o_private;
|
||||||
op->o_private = (void *)mi->mi_ntargets;
|
op->o_private = (void *)mi->mi_ntargets;
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
op->o_private = savepriv;
|
op->o_private = savepriv;
|
||||||
rs->sr_matched = NULL;
|
rs->sr_matched = NULL;
|
||||||
rs->sr_v2ref = NULL;
|
|
||||||
rs->sr_ref = NULL;
|
rs->sr_ref = NULL;
|
||||||
|
|
||||||
finish:;
|
finish:;
|
||||||
@ -705,8 +701,8 @@ finish:;
|
|||||||
free( matched );
|
free( matched );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( refs ) {
|
if ( rs->sr_v2ref ) {
|
||||||
ber_bvarray_free( refs );
|
ber_bvarray_free( rs->sr_v2ref );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < mi->mi_ntargets; i++ ) {
|
for ( i = 0; i < mi->mi_ntargets; i++ ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user