seems to fix referral chasing (ITS#4448)

This commit is contained in:
Pierangelo Masarati 2006-03-24 01:18:36 +00:00
parent 3160c03dab
commit f48bf42578

View file

@ -73,7 +73,7 @@ static int ldap_mark_abandoned LDAP_P(( LDAP *ld, ber_int_t msgid ));
static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout,
LDAPMessage **result ));
static ber_tag_t try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid,
int all, Sockbuf *sb, LDAPConn **lc, LDAPMessage **result ));
int all, LDAPConn **lc, LDAPMessage **result ));
static ber_tag_t build_result_ber LDAP_P(( LDAP *ld, BerElement **bp, LDAPRequest *lr ));
static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all));
@ -284,8 +284,7 @@ wait4msg(
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
#endif
rc = try_read1msg( ld, msgid, all, lc->lconn_sb,
&lc, result );
rc = try_read1msg( ld, msgid, all, &lc, result );
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
#endif
@ -344,8 +343,7 @@ wait4msg(
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
#endif
rc = try_read1msg( ld, msgid, all,
lc->lconn_sb, &lc, result );
rc = try_read1msg( ld, msgid, all, &lc, result );
if ( lc == NULL ) lc = nextlc;
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
@ -384,7 +382,6 @@ try_read1msg(
LDAP *ld,
ber_int_t msgid,
int all,
Sockbuf *sb,
LDAPConn **lcp,
LDAPMessage **result )
{
@ -441,12 +438,12 @@ retry:
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_UDP(ld) ) {
struct sockaddr from;
ber_int_sb_read(sb, &from, sizeof(struct sockaddr));
ber_int_sb_read( lc->lconn_sb, &from, sizeof(struct sockaddr) );
if (ld->ld_options.ldo_version == LDAP_VERSION2) isv2=1;
}
nextresp3:
#endif
tag = ber_get_next( sb, &len, ber );
tag = ber_get_next( lc->lconn_sb, &len, ber );
if ( tag == LDAP_TAG_MESSAGE ) {
/*
* We read a complete message.
@ -486,7 +483,7 @@ nextresp3:
(void *)ld, (long) id, 0);
retry_ber:
ber_free( ber, 1 );
if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
if ( ber_sockbuf_ctrl( lc->lconn_sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
goto retry;
}
return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */
@ -804,7 +801,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif
*lcp = NULL;
lc = *lcp = NULL;
}
}
}
@ -865,8 +862,8 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
* datagram, if the sockbuf is readable we still have data
* to parse.
*/
ber = ldap_alloc_ber_with_options(ld);
if (ber_sockbuf_ctrl(sb, LBER_SB_OPT_DATA_READY, NULL)) ok=1;
ber = ldap_alloc_ber_with_options( ld );
if ( ber_sockbuf_ctrl( lc->lconn_sb, LBER_SB_OPT_DATA_READY, NULL ) ) ok = 1;
}
/* set up response chain */
if ( tmp == NULL ) {
@ -965,7 +962,7 @@ exit:
ld->ld_errno = LDAP_SUCCESS;
return( tag );
}
if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
if ( lc && ber_sockbuf_ctrl( lc->lconn_sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
goto retry;
}
return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */