7.6.2.6 Following an LDAP Referral or Continuation Reference

This task follows an LDAP referral or continuation reference ([RFC2251] sections 4.1.11, Referral, and 4.5.3, Continuation References in the Search Result, and section 3.1.1.3.1.4, Referrals in LDAPv2 and LDAPv3).

The parameters for this task are as follows:

Name

Type

Description

Optional

TaskInputLdapRequest

LDAPRequest

The request that originally generated this referral or continuation reference.

No

TaskInputReferralUrl

LDAP URL

An LDAP URL (see [RFC2255]) that was returned by the server.

No

The task returns the following results to the caller:

Name

Type

Description

TaskReturnStatus

Boolean

This task returns TRUE if the client successfully sends the referral request to the directory server. Otherwise, it returns FALSE.

The task performs the following actions:

  1. Let containingConnectionInfo be the ConnectionInfo instance for which containingConnectionInfo.pendingRequestList contains TaskInputLdapRequest.

  2. Let containingADConnection be the ADConnection instance contained in ADCList for which containingADConnection.primaryConnection is set to containingConnectionInfo or for which the containingADConnection.referralConnections list contains containingConnectionInfo.

  3. If TaskInputLdapRequest.numReferrals is greater than or equal to containingADConnection.LDAP_OPT_REFERRAL_HOP_LIMIT, return FALSE.

  4. Let newServer be a string initialized to the host portion of the hostport element of TaskInputReferralUrl, or NULL if there is no host portion. See [RFC2255].

  5. Let newPort be an unsigned integer initialized to the port portion of the hostport element of TaskInputReferralUrl, or 389 if there is no port portion. See [RFC2255].

  6. Let newConnectionInfo be the result of invoking the Initializing a Connection to a Directory Server (section 7.6.2.1) task with the following parameters: TaskInputTargetName is set to newServer and TaskInputPortNumber is set to newPort.

  7. Append newConnectionInfo to containingADConnection.referralConnections.

  8. Invoke the Connecting to a Directory Server (section 7.6.2.2) task with the following parameter: TaskInputConnectionInfo is set to newConnectionInfo. If the invocation returns FALSE, remove newConnectionInfo from containingADConnection.referralConnections and this task returns FALSE.

  9. If containingConnectionInfo.bindHasHappened is TRUE:

  10. The fields of TaskInputLdapRequest.requestMessage are modified, for example setting the dn or filter, based on TaskInputReferralUrl according to the rules in [RFC2255] section 5, URL Processing, and [RFC2251] sections 4.1.1, Message Envelope, and 4.5.3, Continuation References in the Search Result.

  11. Invoke the Performing an LDAP Operation Against a Directory Server (section 7.6.2.5) task with the following parameters: TaskInputConnectionInfo is set to newConnectionInfo and TaskInputRequestMessage is set to the TaskInputLdapRequest parameter of this task.

  12. Invoke the Performing an LDAP Unbind Against a Directory Server (section 7.6.2.4) task with the following parameter: TaskInputConnectionInfo is set to newConnectionInfo.

  13. Remove newConnectionInfo from containingADConnection.referralConnections.

  14. If the invocation of Performing an LDAP Operation Against a Directory Server (section 7.6.2.5) task in step 11 returned TRUE, then TaskInputLdapRequest.numReferrals is incremented and this task returns TRUE. Otherwise this task returns FALSE.