- /* All results that just return a status, i.e. don't return data
- * go through the following code. This code also chases V2 referrals
- * and checks if all referrals have been chased.
- */
- if ( (tag != LDAP_RES_SEARCH_ENTRY) && (v3ref != V3REF_TOAPP) &&
- (tag != LDAP_RES_INTERMEDIATE ))
- {
- /* For a v3 search referral/reference, only come here if already chased it */
- if ( ld->ld_version >= LDAP_VERSION2 &&
- ( lr->lr_parent != NULL ||
- LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) )
- {
- char *lr_res_error = NULL;
-
- tmpber = *ber; /* struct copy */
- if ( v3ref == V3REF_SUCCESS ) {
- /* V3 search reference or V3 referral
- * sucessfully chased. If this message
- * is a search result, then it has no more
- * outstanding referrals.
- */
- if ( tag == LDAP_RES_SEARCH_RESULT )
- refer_cnt = 0;
- } else if ( ber_scanf( &tmpber, "{eAA}", &lderr,
- &lr->lr_res_matched, &lr_res_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;
- }
- lr_res_error = NULL;
- }