3.3.5.3 Receiving a DC Referral Request
The domain name in the referral request MUST be either a domain in the current forest or a domain in a trusted forest. The server MUST fail DC referral requests for other domain names with a STATUS_INVALID_PARAMETER (0xC000000D) return code.
DC referrals require that the DFS referral version be 3 or higher, as specified in section 3.1.4.2. If the requested DFS referral version is less than 3, the server SHOULD<37> fail the referral request with the STATUS_UNSUCCESSFUL (0xC0000001) return code.
Because there is no difference between DFS referral versions 3 and 4 for a DC referral response, a server that supports DFS referral version 4 MUST return a DFS referral version 3 response even if the DFS client specified DFS referral version 4.
For a valid domain name, the server MUST return as many complete DC names as can fit in the response buffer. The format of the DC names returned MUST correspond to the format of the domain name in the referral request.
If the request contains a fully qualified domain name, the response MUST contain a fully qualified DC host name.
If the request contains a NetBIOS domain name, the response MUST contain a NetBIOS DC host name.
The server MUST initialize the RESP_GET_DFS_REFERRAL referral header for the response as follows:
The PathConsumed field MUST be set to 0.
The NumberOfReferrals field MUST be set to 1, independent of the number of DC names returned.
The ReferralServers and StorageServers bits MUST be set to 0.
The server MUST place exactly one referral entry structure in the referral response. The server MUST initialize this referral entry as follows:
The VersionNumber field MUST be set to 0x0003.
The Size field MUST be set to the total size of the referral entry in bytes, including any padding at the end of the structure. The Size field of a referral entry structure MUST NOT include the size of referenced strings located after the referral entry in the message.
The NameListReferral bit of the ReferralEntryFlags field MUST be set to 1.
The TimeToLive field MAY be set to a nonzero cache time-out value in seconds.<38> When there is more than one referral entry, the TimeToLive field of each referral entry MUST be the same.
The SpecialNameOffset field MUST be set to the offset in bytes from the beginning of the referral entry to the string that contains the domain name for the referral response. The domain name MUST be a null-terminated string of the form "\<domain>", where <domain> MUST be the domain name specified in the DC referral request.
The NumberOfExpandedNames field MUST be set to the number of DCs returned.
The ExpandedNameOffset field MUST be set to the offset in bytes from the beginning of the referral entry to the first null-terminated DC Unicode string. If multiple DC name strings are being returned in response to a DC referral request, each DC name immediately follows its null-terminated predecessor without any padding and MUST be prefixed with a backslash character ("\"). The total number of consecutive name strings MUST be equal to the value of the NumberOfExpandedNames field.
All other fields SHOULD be set to 0.
The server MUST sort the targets as follows:
If Distributed File System (DFS) referral site costing is disabled or not supported, sort the targets based on the site location, as specified in section 3.2.1.1.
If DFS referral site costing is enabled, sort the targets based on the site cost, as specified in section 3.2.1.2.<39>
If SelfFirst is enabled, the server MUST place itself at the top of the DC referral response.