version 1.108, 2005/07/30 14:26:25
|
version 1.109, 2005/08/01 21:35:44
|
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.107 2005/07/23 20:04:04 ando Exp $ */ |
/* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.108 2005/07/30 14:26:25 ando 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-2005 The OpenLDAP Foundation. |
* Copyright 1998-2005 The OpenLDAP Foundation. |
Line 484 retry_ber:
|
Line 484 retry_ber:
|
return( -2 ); /* continue looking */ |
return( -2 ); /* continue looking */ |
} |
} |
|
|
if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) { |
lr = ldap_find_request_by_msgid( ld, id ); |
|
if ( lr == NULL ) { |
Debug( LDAP_DEBUG_ANY, |
Debug( LDAP_DEBUG_ANY, |
"no request for response with msgid %ld (tossing)\n", |
"no request for response with msgid %ld (tossing)\n", |
(long) id, 0, 0 ); |
(long) id, 0, 0 ); |
Line 551 nextresp2:
|
Line 552 nextresp2:
|
} |
} |
} else { |
} else { |
/* Check for V3 referral */ |
/* Check for V3 referral */ |
ber_len_t len; |
ber_len_t len; |
|
char *lr_res_error = NULL; |
|
|
if ( ber_scanf( &tmpber, "{iaa",/*}*/ &lderr, |
if ( ber_scanf( &tmpber, "{iaa",/*}*/ &lderr, |
&lr->lr_res_matched, &lr->lr_res_error ) |
&lr->lr_res_matched, &lr_res_error ) |
!= LBER_ERROR ) { |
!= LBER_ERROR ) |
|
{ |
|
if ( lr_res_error != NULL ) { |
|
if ( lr->lr_res_error != NULL ) { |
|
(void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error ); |
|
LDAP_FREE( (char *)lr_res_error ); |
|
|
|
} else { |
|
lr->lr_res_error = lr_res_error; |
|
} |
|
} |
|
|
/* Check if V3 referral */ |
/* Check if V3 referral */ |
if( ber_peek_tag( &tmpber, &len) == LDAP_TAG_REFERRAL ) { |
if ( ber_peek_tag( &tmpber, &len ) == LDAP_TAG_REFERRAL ) { |
/* We have a V3 referral, assume we cannot chase it */ |
/* We have a V3 referral, assume we cannot chase it */ |
v3ref = -1; |
v3ref = -1; |
if( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) |
if( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) |
Line 611 nextresp2:
|
Line 625 nextresp2:
|
( lr->lr_parent != NULL || |
( lr->lr_parent != NULL || |
LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) ) |
LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) ) |
{ |
{ |
|
char *lr_res_error = NULL; |
|
|
tmpber = *ber; /* struct copy */ |
tmpber = *ber; /* struct copy */ |
if ( v3ref == 1 ) { |
if ( v3ref == 1 ) { |
/* V3 search reference or V3 referral |
/* V3 search reference or V3 referral |
Line 621 nextresp2:
|
Line 637 nextresp2:
|
if ( tag == LDAP_RES_SEARCH_RESULT ) |
if ( tag == LDAP_RES_SEARCH_RESULT ) |
refer_cnt = 0; |
refer_cnt = 0; |
} else if ( ber_scanf( &tmpber, "{iaa}", &lderr, |
} else if ( ber_scanf( &tmpber, "{iaa}", &lderr, |
&lr->lr_res_matched, &lr->lr_res_error ) |
&lr->lr_res_matched, &lr_res_error ) |
!= LBER_ERROR ) { |
!= LBER_ERROR ) |
|
{ |
|
if ( lr_res_error != NULL ) { |
|
if ( lr->lr_res_error != NULL ) { |
|
(void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error ); |
|
LDAP_FREE( (char *)lr_res_error ); |
|
} else { |
|
lr->lr_res_error = lr_res_error; |
|
} |
|
} |
|
|
if ( lderr != LDAP_SUCCESS ) { |
if ( lderr != LDAP_SUCCESS ) { |
/* referrals are in error string */ |
/* referrals are in error string */ |
refer_cnt = ldap_chase_referrals( ld, lr, |
refer_cnt = ldap_chase_referrals( ld, lr, |
Line 929 build_result_ber( LDAP *ld, BerElement *
|
Line 955 build_result_ber( LDAP *ld, BerElement *
|
} |
} |
|
|
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid, |
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid, |
lr->lr_res_msgtype, lr->lr_res_errno, |
lr->lr_res_msgtype, lr->lr_res_errno, |
lr->lr_res_matched ? lr->lr_res_matched : "", |
lr->lr_res_matched ? lr->lr_res_matched : "", |
lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) { |
lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) |
|
{ |
ld->ld_errno = LDAP_ENCODING_ERROR; |
ld->ld_errno = LDAP_ENCODING_ERROR; |
ber_free(ber, 1); |
ber_free(ber, 1); |
return( LBER_ERROR ); |
return( LBER_ERROR ); |
Line 978 merge_error_info( LDAP *ld, LDAPRequest
|
Line 1004 merge_error_info( LDAP *ld, LDAPRequest
|
lr->lr_res_error ); |
lr->lr_res_error ); |
} |
} |
} else if ( lr->lr_res_errno != LDAP_SUCCESS && |
} else if ( lr->lr_res_errno != LDAP_SUCCESS && |
parentr->lr_res_errno == LDAP_SUCCESS ) { |
parentr->lr_res_errno == LDAP_SUCCESS ) |
|
{ |
parentr->lr_res_errno = lr->lr_res_errno; |
parentr->lr_res_errno = lr->lr_res_errno; |
if ( parentr->lr_res_error != NULL ) { |
if ( parentr->lr_res_error != NULL ) { |
LDAP_FREE( parentr->lr_res_error ); |
LDAP_FREE( parentr->lr_res_error ); |
} |
} |
parentr->lr_res_error = lr->lr_res_error; |
parentr->lr_res_error = lr->lr_res_error; |
lr->lr_res_error = NULL; |
lr->lr_res_error = NULL; |
if ( LDAP_NAME_ERROR( lr->lr_res_errno )) { |
if ( LDAP_NAME_ERROR( lr->lr_res_errno ) ) { |
if ( parentr->lr_res_matched != NULL ) { |
if ( parentr->lr_res_matched != NULL ) { |
LDAP_FREE( parentr->lr_res_matched ); |
LDAP_FREE( parentr->lr_res_matched ); |
} |
} |