Export (0) Print
Expand All

3.5.4.7.1 DsrEnumerateDomainTrusts (Opnum 40)

The DsrEnumerateDomainTrusts method<287> returns an enumerated list of domaintrusts, filtered by a set of flags, from the specified server.

NET_API_STATUS DsrEnumerateDomainTrusts(
  [in, unique, string] LOGONSRV_HANDLE ServerName,
  [in] unsigned long Flags,
  [out] PNETLOGON_TRUSTED_DOMAIN_ARRAY Domains
);

ServerName: The custom RPC binding handle, as specified in section 3.5.4.1.

Flags: A set of bit flags that specify properties that MUST be true for a domain trust to be part of the returned domain name list. A flag is TRUE (or set) if its value is equal to 1. Flags MUST contain one or more of the following bits.


0

1

2

3

4

5

6

7

8

9
1
0

1

2

3

4

5

6

7

8

9
2
0

1

2

3

4

5

6

7

8

9
3
0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

F

E

D

C

B

A

Where the bits are defined as:

Value Description

A

Domain is a member of the forest.

B

Domain is directly trusted by this domain.

C

Domain is the root of a domain tree in the forest.

D

Domain is the primary domain of the queried server.

E

Primary domain is running in native mode.

F

Domain directly trusts this domain.

All other bits MUST be set to zero.

Domains: A pointer to a NETLOGON_TRUSTED_DOMAIN_ARRAY structure, as specified in section 2.2.1.6.3, that contains a list of trusted domains.

Return Values: The method returns 0x00000000 on success; otherwise, it returns a nonzero error code.<288>

On receiving this call, the server MUST perform the following validation step:

  • The Flags parameter MUST be checked to verify that at least one of the above valid bits is set. All other bits (0-24) MUST be zero. The server MUST return ERROR_INVALID_FLAGS if there are invalid bits present.

If the ServerName parameter is not NULL, it is compared against the server's computer name. If the ServerName parameter does not match the server's computer name, the server MUST return ERROR_INVALID_COMPUTERNAME. If the ServerName parameter matches the server's computer name or the ServerName parameter is NULL, then processing proceeds.

If the server is not a DC (section 3.1.4.8), the server SHOULD call NetrLogonGetDomainInfo to a DC in its domain, with the following parameters:

  • The NetlogonWorkstationInfo parameter with the following elements:

    • NetlogonWorkstationInfo.LsaPolicy.LsaPolicySize is set to 0.

    • NetlogonWorkstationInfo.LsaPolicy.LsaPolicy is set to NULL.

    • NetlogonWorkstationInfo.WorkStationFlags has the A flag set.

    • NetlogonWorkstationInfo.DnsHostName set to the DNS computer name.

  • Level MUST be set to 0x1.

If the server is a domain controller (section 3.1.4.8), it MUST perform behavior equivalent to locally invoking NetrLogonGetDomainInfo with the previously described parameters.

If the call returns any other error code other than STATUS_SUCCESS, then the server MUST return that error code and no further processing occurs.

If the call returns STATUS_SUCCESS, the server MUST use the returned domains in the DomBuffer.TrustedDomains parameter to build and return an array of DS_DOMAIN_TRUSTSW structures from the NETLOGON_ONE_DOMAIN_INFO structures as follows:

  • If the primary domain is determined to not be running in mixed mode ([MS-ADTS] section 6.1.4.1), and the E bit is set in the Flags parameter, the server MUST include the primary domain (DomBuffer.PrimaryDomain) in the returned array.

  • For each element of DomBuffer.TrustedDomains, if the bitwise AND of the Flags parameter and the DomBuffer.TrustedDomains.TrustExtension.Flags (Flags & DomBuffer.TrustedDomains.TrustExtension[0-3]) is true, the server MUST include the domain in the returned array.

  • For each element to be included in the returned array, each field in the NETLOGON_ONE_DOMAIN_INFO structure listed in the first column of the following table is copied to the field of the DS_DOMAIN_TRUSTSW structure listed on the same line in the second column:

    NETLOGON_ONE_DOMAIN_INFO element

    DS_DOMAIN_TRUSTSW element

    DomainName

    NetBiosDomainName

    DnsDomainName

    DnsDomainName

    DomainGuid

    DomainGuid

    DomainSid

    DomainSid

    Bytes 0 – 3 of TrustExtension

    Flags

    Bytes 4 – 7 of TrustExtension

    ParentIndex

    Bytes 8 – 11 of TrustExtension

    TrustType

    Bytes 12 – 15 of Trust Extension

    TrustAttributes

 
Show:
© 2014 Microsoft