From: Howard Chu Date: Sun, 25 Jan 2004 10:30:10 +0000 (+0000) Subject: ITS#2894 - search refs that are the immediate result of another search X-Git-Tag: OPENLDAP_REL_ENG_2_2_BP~447 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=690f0111e98b60248032d7b788116e1dbed7cfae;p=openldap ITS#2894 - search refs that are the immediate result of another search ref are associated with the parent req instead of the original req, to prevent infinite loops. --- diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 237a6eefff..b289bfcb65 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -725,6 +725,7 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char * char **refarray = NULL; LDAPConn *lc; int rc, count, i, j, id; + int parent_was_reference; LDAPreqinfo rinfo; ld->ld_errno = LDAP_SUCCESS; /* optimistic */ @@ -760,6 +761,11 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char * goto done; } + /* check if parent request was a search reference */ + parent_was_reference = ( lr->lr_parent && + lr->lr_parent->lr_res_msgtype == LDAP_RES_SEARCH_REFERENCE ) ? + 1 : 0; + /* find original request */ for ( origreq = lr; origreq->lr_parent != NULL; @@ -890,7 +896,8 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char * ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); #endif rc = ldap_send_server_request( ld, ber, id, - origreq, srv, NULL, &rinfo ); + (sref && !parent_was_reference) ? origreq : lr, + srv, NULL, &rinfo ); #ifdef LDAP_R_COMPILE ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); #endif