version 1.97, 2004/10/09 04:13:47
|
version 1.98, 2004/10/18 02:58: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.95 2004/09/04 02:54:29 kurt Exp $ */ |
/* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.97 2004/10/09 04:13:47 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-2004 The OpenLDAP Foundation. |
* Copyright 1998-2004 The OpenLDAP Foundation. |
Line 177 chkResponseList(
|
Line 177 chkResponseList(
|
break; |
break; |
} |
} |
|
|
for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) { |
if ( lm->lm_chain == NULL ) { |
if ( tmp->lm_msgtype != LDAP_RES_SEARCH_ENTRY |
if ((lm->lm_msgtype == LDAP_RES_SEARCH_ENTRY) || |
&& tmp->lm_msgtype != LDAP_RES_SEARCH_REFERENCE |
(lm->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) || |
&& tmp->lm_msgtype != LDAP_RES_INTERMEDIATE ) |
(lm->lm_msgtype == LDAP_RES_INTERMEDIATE)) { |
{ |
tmp = NULL; |
break; |
} else { |
|
tmp = lm; |
|
} |
|
} else { |
|
if ((lm->lm_chain_tail->lm_chain->lm_msgtype |
|
== LDAP_RES_SEARCH_ENTRY) || |
|
(lm->lm_chain_tail->lm_chain->lm_msgtype |
|
== LDAP_RES_SEARCH_REFERENCE) || |
|
(lm->lm_chain_tail->lm_chain->lm_msgtype |
|
== LDAP_RES_INTERMEDIATE)) { |
|
tmp = NULL; |
|
} else { |
|
tmp = lm->lm_chain_tail->lm_chain; |
} |
} |
} |
} |
|
|
Line 365 try_read1msg(
|
Line 377 try_read1msg(
|
LDAPMessage **result ) |
LDAPMessage **result ) |
{ |
{ |
BerElement *ber; |
BerElement *ber; |
LDAPMessage *new, *l, *prev, *tmp; |
LDAPMessage *new, *l, *prev, *tmp, *chain_head; |
ber_int_t id; |
ber_int_t id; |
ber_tag_t tag; |
ber_tag_t tag; |
ber_len_t len; |
ber_len_t len; |
Line 758 lr->lr_res_matched ? lr->lr_res_matched
|
Line 770 lr->lr_res_matched ? lr->lr_res_matched
|
firstmsg = 0; |
firstmsg = 0; |
new->lm_next = ld->ld_responses; |
new->lm_next = ld->ld_responses; |
ld->ld_responses = new; |
ld->ld_responses = new; |
|
new->lm_chain_tail = new; |
|
chain_head = new; |
} else { |
} else { |
tmp->lm_chain = new; |
tmp->lm_chain = new; |
|
chain_head->lm_chain_tail = tmp; |
} |
} |
tmp = new; |
tmp = new; |
/* "ok" means there's more to parse */ |
/* "ok" means there's more to parse */ |
Line 781 lr->lr_res_matched ? lr->lr_res_matched
|
Line 796 lr->lr_res_matched ? lr->lr_res_matched
|
* first response off the head of the chain. |
* first response off the head of the chain. |
*/ |
*/ |
tmp->lm_chain = new; |
tmp->lm_chain = new; |
|
chain_head->lm_chain_tail = tmp; |
*result = chkResponseList( ld, msgid, all ); |
*result = chkResponseList( ld, msgid, all ); |
ld->ld_errno = LDAP_SUCCESS; |
ld->ld_errno = LDAP_SUCCESS; |
return( (*result)->lm_msgtype ); |
return( (*result)->lm_msgtype ); |
Line 824 lr->lr_res_matched ? lr->lr_res_matched
|
Line 840 lr->lr_res_matched ? lr->lr_res_matched
|
|
|
new->lm_next = ld->ld_responses; |
new->lm_next = ld->ld_responses; |
ld->ld_responses = new; |
ld->ld_responses = new; |
|
new->lm_chain_tail = new; |
goto exit; |
goto exit; |
} |
} |
|
|
Line 831 lr->lr_res_matched ? lr->lr_res_matched
|
Line 848 lr->lr_res_matched ? lr->lr_res_matched
|
(long) new->lm_msgid, (long) new->lm_msgtype, 0 ); |
(long) new->lm_msgid, (long) 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 != NULL) && |
if (l->lm_chain == NULL) { |
((tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY) || |
if ((l->lm_msgtype == LDAP_RES_SEARCH_ENTRY) || |
(tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) || |
(l->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) || |
(tmp->lm_chain->lm_msgtype == LDAP_RES_INTERMEDIATE )); |
(l->lm_msgtype == LDAP_RES_INTERMEDIATE)) { |
tmp = tmp->lm_chain ) |
/* do not advance lm_chain_tail in this case */ |
; /* NULL */ |
l->lm_chain = new; |
tmp->lm_chain = new; |
} else { |
|
/*FIXME: ldap_msgfree( l );*/ |
|
l = new; |
|
l->lm_chain_tail = new; |
|
} |
|
} else { |
|
if ((l->lm_chain_tail->lm_chain->lm_msgtype |
|
== LDAP_RES_SEARCH_ENTRY) || |
|
(l->lm_chain_tail->lm_chain->lm_msgtype |
|
== LDAP_RES_SEARCH_REFERENCE) || |
|
(l->lm_chain_tail->lm_chain->lm_msgtype |
|
== LDAP_RES_INTERMEDIATE)) { |
|
l->lm_chain_tail->lm_chain->lm_chain = new; |
|
l->lm_chain_tail = l->lm_chain_tail->lm_chain; |
|
} else { |
|
/*FIXME: ldap_msgfree( l->lm_chain_tail->lm_chain );*/ |
|
l->lm_chain_tail->lm_chain = new; |
|
} |
|
} |
|
|
/* 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 ) { |