int		i, rc, unknown;
int		rc = LDAP_SUCCESS; int		i, unknown;
nsldapi_chase_v3_refs( LDAP *ld, LDAPRequest *lr, char **v3refs,    int is_reference, int *totalcountp, int *chasingcountp ){	int		i, rc, unknown;	LDAPRequest	*origreq;	*totalcountp = *chasingcountp = 0;	if ( v3refs == NULL || v3refs[0] == NULL ) {		return( LDAP_SUCCESS );	}	*totalcountp = 1;	if ( lr->lr_parentcnt >= ld->ld_refhoplimit ) {		LDAPDebug( LDAP_DEBUG_TRACE,		    "more than %d referral hops (dropping)\n",		    ld->ld_refhoplimit, 0, 0 );		return( LDAP_REFERRAL_LIMIT_EXCEEDED );	}	/* find original request */	for ( origreq = lr; origreq->lr_parent != NULL;	    origreq = origreq->lr_parent ) {		;	}	/*	 * in LDAPv3, we just need to follow one referral in the set.	 * we dp this by stopping as soon as we succeed in initiating a	 * chase on any referral (basically this means we were able to connect	 * to the server and bind).	 */	for ( i = 0; v3refs[i] != NULL; ++i ) {		rc = chase_one_referral( ld, lr, origreq, v3refs[i],		    is_reference ? "v3 reference" : "v3 referral", &unknown );		if ( rc == LDAP_SUCCESS && !unknown ) {			*chasingcountp = 1;			break;		}	}	/* XXXmcs: should we save unfollowed referrals somewhere? */	return( rc );	/* last error is as good as any other I guess... */}