version 1.33.2.1, 1999/06/17 17:09:53
|
version 1.33.2.2, 1999/06/18 00:19:46
|
Line 40 static int ldap_abandoned LDAP_P(( LDAP
|
Line 40 static int ldap_abandoned LDAP_P(( LDAP
|
static int ldap_mark_abandoned LDAP_P(( LDAP *ld, ber_int_t msgid )); |
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, |
static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout, |
LDAPMessage **result )); |
LDAPMessage **result )); |
static int try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, Sockbuf *sb, LDAPConn *lc, |
static ber_tag_t try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid, |
LDAPMessage **result )); |
int all, Sockbuf *sb, 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 )); |
|
|
Line 87 ldap_result( LDAP *ld, int msgid, int al
|
Line 87 ldap_result( LDAP *ld, int msgid, int al
|
* wait until it arrives or timeout occurs. |
* wait until it arrives or timeout occurs. |
*/ |
*/ |
|
|
*result = NULLMSG; |
*result = NULL; |
lastlm = NULLMSG; |
lastlm = NULL; |
for ( lm = ld->ld_responses; lm != NULLMSG; lm = nextlm ) { |
for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) { |
nextlm = lm->lm_next; |
nextlm = lm->lm_next; |
|
|
if ( ldap_abandoned( ld, lm->lm_msgid ) ) { |
if ( ldap_abandoned( ld, lm->lm_msgid ) ) { |
ldap_mark_abandoned( ld, lm->lm_msgid ); |
ldap_mark_abandoned( ld, lm->lm_msgid ); |
|
|
if ( lastlm == NULLMSG ) { |
if ( lastlm == NULL ) { |
ld->ld_responses = lm->lm_next; |
ld->ld_responses = lm->lm_next; |
} else { |
} else { |
lastlm->lm_next = nextlm; |
lastlm->lm_next = nextlm; |
Line 115 ldap_result( LDAP *ld, int msgid, int al
|
Line 115 ldap_result( LDAP *ld, int msgid, int al
|
&& lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) ) |
&& lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) ) |
break; |
break; |
|
|
for ( tmp = lm; tmp != NULLMSG; tmp = tmp->lm_chain ) { |
for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) { |
if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT ) |
if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT ) |
break; |
break; |
} |
} |
|
|
if ( tmp == NULLMSG ) { |
if ( tmp == NULL ) { |
return( wait4msg( ld, msgid, all, timeout, |
return( wait4msg( ld, msgid, all, timeout, |
result ) ); |
result ) ); |
} |
} |
Line 129 ldap_result( LDAP *ld, int msgid, int al
|
Line 129 ldap_result( LDAP *ld, int msgid, int al
|
} |
} |
lastlm = lm; |
lastlm = lm; |
} |
} |
if ( lm == NULLMSG ) { |
if ( lm == NULL ) { |
return( wait4msg( ld, msgid, all, timeout, result ) ); |
return( wait4msg( ld, msgid, all, timeout, result ) ); |
} |
} |
|
|
if ( lastlm == NULLMSG ) { |
if ( lastlm == NULL ) { |
ld->ld_responses = (all == 0 && lm->lm_chain != NULLMSG |
ld->ld_responses = (all == 0 && lm->lm_chain != NULL |
? lm->lm_chain : lm->lm_next); |
? lm->lm_chain : lm->lm_next); |
} else { |
} else { |
lastlm->lm_next = (all == 0 && lm->lm_chain != NULLMSG |
lastlm->lm_next = (all == 0 && lm->lm_chain != NULL |
? lm->lm_chain : lm->lm_next); |
? lm->lm_chain : lm->lm_next); |
} |
} |
if ( all == 0 ) |
if ( all == 0 ) |
lm->lm_chain = NULLMSG; |
lm->lm_chain = NULL; |
lm->lm_next = NULLMSG; |
lm->lm_next = NULL; |
|
|
*result = lm; |
*result = lm; |
ld->ld_errno = LDAP_SUCCESS; |
ld->ld_errno = LDAP_SUCCESS; |
Line 257 wait4msg(
|
Line 257 wait4msg(
|
} |
} |
|
|
|
|
static int |
static ber_tag_t |
try_read1msg( |
try_read1msg( |
LDAP *ld, |
LDAP *ld, |
ber_int_t msgid, |
ber_int_t msgid, |
Line 282 try_read1msg(
|
Line 282 try_read1msg(
|
|
|
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 ); |
|
|
if ( lc->lconn_ber == NULLBER ) { |
if ( lc->lconn_ber == NULL ) { |
lc->lconn_ber = ldap_alloc_ber_with_options(ld); |
lc->lconn_ber = ldap_alloc_ber_with_options(ld); |
|
|
if( lc->lconn_ber == NULL ) { |
if( lc->lconn_ber == NULL ) { |
Line 319 try_read1msg(
|
Line 319 try_read1msg(
|
* We read a complete message. |
* We read a complete message. |
* The connection should no longer need this ber. |
* The connection should no longer need this ber. |
*/ |
*/ |
lc->lconn_ber = NULLBER; |
lc->lconn_ber = NULL; |
|
|
/* message id */ |
/* message id */ |
if ( ber_get_int( ber, &id ) == LBER_ERROR ) { |
if ( ber_get_int( ber, &id ) == LBER_ERROR ) { |
Line 487 lr->lr_res_matched ? lr->lr_res_matched
|
Line 487 lr->lr_res_matched ? lr->lr_res_matched
|
* search response. |
* search response. |
*/ |
*/ |
|
|
prev = NULLMSG; |
prev = NULL; |
for ( l = ld->ld_responses; l != NULLMSG; l = l->lm_next ) { |
for ( l = ld->ld_responses; l != NULL; l = l->lm_next ) { |
if ( l->lm_msgid == new->lm_msgid ) |
if ( l->lm_msgid == new->lm_msgid ) |
break; |
break; |
prev = l; |
prev = l; |
} |
} |
|
|
/* not part of an existing search response */ |
/* not part of an existing search response */ |
if ( l == NULLMSG ) { |
if ( l == NULL ) { |
if ( foundit ) { |
if ( foundit ) { |
*result = new; |
*result = new; |
ld->ld_errno = LDAP_SUCCESS; |
ld->ld_errno = LDAP_SUCCESS; |
Line 511 lr->lr_res_matched ? lr->lr_res_matched
|
Line 511 lr->lr_res_matched ? lr->lr_res_matched
|
new->lm_msgid, new->lm_msgtype, 0 ); |
new->lm_msgid, new->lm_msgtype, 0 ); |
|
|
/* part of a search response - add to end of list of entries */ |
/* part of a search response - add to end of list of entries */ |
for ( tmp = l; tmp->lm_chain != NULLMSG && |
for ( tmp = l; tmp->lm_chain != NULL && |
tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY; |
tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY; |
tmp = tmp->lm_chain ) |
tmp = tmp->lm_chain ) |
; /* NULL */ |
; /* NULL */ |
Line 519 lr->lr_res_matched ? lr->lr_res_matched
|
Line 519 lr->lr_res_matched ? lr->lr_res_matched
|
|
|
/* return the whole chain if that's what we were looking for */ |
/* return the whole chain if that's what we were looking for */ |
if ( foundit ) { |
if ( foundit ) { |
if ( prev == NULLMSG ) |
if ( prev == NULL ) |
ld->ld_responses = l->lm_next; |
ld->ld_responses = l->lm_next; |
else |
else |
prev->lm_next = l->lm_next; |
prev->lm_next = l->lm_next; |
Line 662 ldap_msgfree( LDAPMessage *lm )
|
Line 662 ldap_msgfree( LDAPMessage *lm )
|
|
|
Debug( LDAP_DEBUG_TRACE, "ldap_msgfree\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_TRACE, "ldap_msgfree\n", 0, 0, 0 ); |
|
|
for ( ; lm != NULLMSG; lm = next ) { |
for ( ; lm != NULL; lm = next ) { |
next = lm->lm_chain; |
next = lm->lm_chain; |
type = lm->lm_msgtype; |
type = lm->lm_msgtype; |
ber_free( lm->lm_ber, 1 ); |
ber_free( lm->lm_ber, 1 ); |
Line 686 ldap_msgdelete( LDAP *ld, int msgid )
|
Line 686 ldap_msgdelete( LDAP *ld, int msgid )
|
|
|
Debug( LDAP_DEBUG_TRACE, "ldap_msgdelete\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_TRACE, "ldap_msgdelete\n", 0, 0, 0 ); |
|
|
prev = NULLMSG; |
prev = NULL; |
for ( lm = ld->ld_responses; lm != NULLMSG; lm = lm->lm_next ) { |
for ( lm = ld->ld_responses; lm != NULL; lm = lm->lm_next ) { |
if ( lm->lm_msgid == msgid ) |
if ( lm->lm_msgid == msgid ) |
break; |
break; |
prev = lm; |
prev = lm; |
} |
} |
|
|
if ( lm == NULLMSG ) |
if ( lm == NULL ) |
return( -1 ); |
return( -1 ); |
|
|
if ( prev == NULLMSG ) |
if ( prev == NULL ) |
ld->ld_responses = lm->lm_next; |
ld->ld_responses = lm->lm_next; |
else |
else |
prev->lm_next = lm->lm_next; |
prev->lm_next = lm->lm_next; |
Line 754 ldap_mark_abandoned( LDAP *ld, ber_int_t
|
Line 754 ldap_mark_abandoned( LDAP *ld, ber_int_t
|
int |
int |
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber ) |
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber ) |
{ |
{ |
int rc; |
int rc; |
ber_tag_t tag; |
ber_tag_t tag; |
ber_len_t len; |
ber_len_t len; |
|
|
Line 775 cldap_getmsg( LDAP *ld, struct timeval *
|
Line 775 cldap_getmsg( LDAP *ld, struct timeval *
|
return( -1 ); |
return( -1 ); |
} |
} |
|
|
return( tag ); |
return( 0 ); |
} |
} |
#endif /* LDAP_CONNECTIONLESS */ |
#endif /* LDAP_CONNECTIONLESS */ |