- /* 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 > -1) &&
- (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 == 1 ) {
- /* 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;
+ /* V2 referrals are in error string */
+ refer_cnt = ldap_chase_referrals( ld, lr,
+ &lr->lr_res_error, -1, &hadref );
+ lr->lr_status = LDAP_REQST_COMPLETED;
+ Debug( LDAP_DEBUG_TRACE,
+ "read1msg: V2 referral chased, "
+ "mark request completed, id = %d\n",
+ lr->lr_msgid, 0, 0 );
+ break;