version 1.123, 2006/02/14 22:18:12
|
version 1.124, 2006/03/24 00:18:36
|
Line 1
|
Line 1
|
/* result.c - wait for an ldap result */ |
/* result.c - wait for an ldap result */ |
/* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.122 2006/01/03 22:12:09 kurt Exp $ */ |
/* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.123 2006/02/14 22:18:12 kurt Exp $ */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
* Copyright 1998-2006 The OpenLDAP Foundation. |
* Copyright 1998-2006 The OpenLDAP Foundation. |
Line 73 static int ldap_mark_abandoned LDAP_P((
|
Line 73 static int ldap_mark_abandoned LDAP_P((
|
static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout, |
static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout, |
LDAPMessage **result )); |
LDAPMessage **result )); |
static ber_tag_t try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid, |
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 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 void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )); |
static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all)); |
static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all)); |
Line 284 wait4msg(
|
Line 284 wait4msg(
|
#ifdef LDAP_R_COMPILE |
#ifdef LDAP_R_COMPILE |
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex ); |
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex ); |
#endif |
#endif |
rc = try_read1msg( ld, msgid, all, lc->lconn_sb, |
rc = try_read1msg( ld, msgid, all, &lc, result ); |
&lc, result ); |
|
#ifdef LDAP_R_COMPILE |
#ifdef LDAP_R_COMPILE |
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex ); |
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex ); |
#endif |
#endif |
Line 344 wait4msg(
|
Line 343 wait4msg(
|
#ifdef LDAP_R_COMPILE |
#ifdef LDAP_R_COMPILE |
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex ); |
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex ); |
#endif |
#endif |
rc = try_read1msg( ld, msgid, all, |
rc = try_read1msg( ld, msgid, all, &lc, result ); |
lc->lconn_sb, &lc, result ); |
|
if ( lc == NULL ) lc = nextlc; |
if ( lc == NULL ) lc = nextlc; |
#ifdef LDAP_R_COMPILE |
#ifdef LDAP_R_COMPILE |
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex ); |
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex ); |
Line 384 try_read1msg(
|
Line 382 try_read1msg(
|
LDAP *ld, |
LDAP *ld, |
ber_int_t msgid, |
ber_int_t msgid, |
int all, |
int all, |
Sockbuf *sb, |
|
LDAPConn **lcp, |
LDAPConn **lcp, |
LDAPMessage **result ) |
LDAPMessage **result ) |
{ |
{ |
Line 441 retry:
|
Line 438 retry:
|
#ifdef LDAP_CONNECTIONLESS |
#ifdef LDAP_CONNECTIONLESS |
if ( LDAP_IS_UDP(ld) ) { |
if ( LDAP_IS_UDP(ld) ) { |
struct sockaddr from; |
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; |
if (ld->ld_options.ldo_version == LDAP_VERSION2) isv2=1; |
} |
} |
nextresp3: |
nextresp3: |
#endif |
#endif |
tag = ber_get_next( sb, &len, ber ); |
tag = ber_get_next( lc->lconn_sb, &len, ber ); |
if ( tag == LDAP_TAG_MESSAGE ) { |
if ( tag == LDAP_TAG_MESSAGE ) { |
/* |
/* |
* We read a complete message. |
* We read a complete message. |
Line 486 nextresp3:
|
Line 483 nextresp3:
|
(void *)ld, (long) id, 0); |
(void *)ld, (long) id, 0); |
retry_ber: |
retry_ber: |
ber_free( ber, 1 ); |
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; |
goto retry; |
} |
} |
return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */ |
return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */ |
Line 804 lr->lr_res_matched ? lr->lr_res_matched
|
Line 801 lr->lr_res_matched ? lr->lr_res_matched
|
#ifdef LDAP_R_COMPILE |
#ifdef LDAP_R_COMPILE |
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); |
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); |
#endif |
#endif |
*lcp = NULL; |
lc = *lcp = NULL; |
} |
} |
} |
} |
} |
} |
Line 865 lr->lr_res_matched ? lr->lr_res_matched
|
Line 862 lr->lr_res_matched ? lr->lr_res_matched
|
* datagram, if the sockbuf is readable we still have data |
* datagram, if the sockbuf is readable we still have data |
* to parse. |
* to parse. |
*/ |
*/ |
ber = ldap_alloc_ber_with_options(ld); |
ber = ldap_alloc_ber_with_options( ld ); |
if (ber_sockbuf_ctrl(sb, LBER_SB_OPT_DATA_READY, NULL)) ok=1; |
if ( ber_sockbuf_ctrl( lc->lconn_sb, LBER_SB_OPT_DATA_READY, NULL ) ) ok = 1; |
} |
} |
/* set up response chain */ |
/* set up response chain */ |
if ( tmp == NULL ) { |
if ( tmp == NULL ) { |
Line 965 exit:
|
Line 962 exit:
|
ld->ld_errno = LDAP_SUCCESS; |
ld->ld_errno = LDAP_SUCCESS; |
return( tag ); |
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; |
goto retry; |
} |
} |
return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */ |
return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */ |