Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

728 lines
19 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1996, Microsoft Corporation
  4. //
  5. // File: dominfo.h
  6. //
  7. // Contents: Code to figure out domain dfs addresses
  8. //
  9. // Classes: None
  10. //
  11. // Functions: DfsInitDomainList
  12. //
  13. // DfspInitDomainListFromLSA
  14. // DfspInsertLsaDomainList
  15. //
  16. // History: Feb 7, 1996 Milans created
  17. //
  18. //-----------------------------------------------------------------------------
  19. #include <nt.h>
  20. #include <ntrtl.h>
  21. #include <nturtl.h>
  22. #include <ntlsa.h> // LsaEnumerateTrustedDomains
  23. #include <dfsfsctl.h>
  24. #include <tdi.h>
  25. #include <gluon.h>
  26. #include <windows.h>
  27. #include <lm.h> // NetGetAnyDC, NetUseAdd
  28. #include <netlogon.h> // Needed by logonp.h
  29. #include <logonp.h> // I_NetGetDCList
  30. #include <dfsstr.h>
  31. #include <nodetype.h>
  32. #include <libsup.h>
  33. #include <dfsmrshl.h>
  34. #include <dfsgluon.h>
  35. #include "dominfo.h"
  36. #include "svcwml.h"
  37. extern DWORD
  38. DfsCreateSpcArg(
  39. LPWSTR DomainName,
  40. ULONG Timeout,
  41. ULONG Flags,
  42. ULONG TrustDirection,
  43. ULONG TrustType,
  44. LONG NameCount,
  45. PUNICODE_STRING pustrDCNames,
  46. PDFS_CREATE_SPECIAL_INFO_ARG *ppSpcArg,
  47. PULONG pSize);
  48. //
  49. // Global structure describing list of trusted domains
  50. //
  51. DFS_DOMAIN_INFO DfsDomainInfo;
  52. BOOLEAN DfsDomainInfoInit = FALSE;
  53. extern WCHAR DomainName[MAX_PATH];
  54. extern WCHAR DomainNameDns[MAX_PATH];
  55. extern CRITICAL_SECTION DomListCritSection;
  56. //
  57. // Event logging and debugging globals
  58. //
  59. extern ULONG DfsSvcVerbose;
  60. extern ULONG DfsEventLog;
  61. //
  62. // Private functions
  63. //
  64. DWORD
  65. DfspInitDomainListFromLSA();
  66. NTSTATUS
  67. DfspInsertLsaDomainList(
  68. PTRUSTED_DOMAIN_INFORMATION_EX rglsaDomainList,
  69. ULONG cDomains);
  70. NTSTATUS
  71. DfspInsertDsDomainList(
  72. PDS_DOMAIN_TRUSTS pDsDomainTrusts,
  73. ULONG cDomains);
  74. BOOLEAN
  75. IsDupDomainInfo(
  76. PDS_DOMAIN_TRUSTS pDsDomainTrusts);
  77. //+----------------------------------------------------------------------------
  78. //
  79. // Function: DfsInitDomainList
  80. //
  81. // Synopsis: Initializes the list of trusted domains so that their Dfs's
  82. // may be accessed.
  83. //
  84. // Arguments: None
  85. //
  86. // Returns: Nothing.
  87. //
  88. //-----------------------------------------------------------------------------
  89. VOID
  90. DfsInitDomainList()
  91. {
  92. PDS_DOMAIN_TRUSTS pDsDomainTrusts = NULL;
  93. ULONG DsDomainCount = 0;
  94. DWORD dwErr;
  95. DFS_DOMAIN_INFO OldDfsDomainInfo;
  96. ULONG i, j;
  97. HANDLE dfsHandle;
  98. NTSTATUS status;
  99. PDFS_CREATE_SPECIAL_INFO_ARG pSpcArg;
  100. ULONG Size;
  101. IO_STATUS_BLOCK ioStatus;
  102. EnterCriticalSection(&DomListCritSection);
  103. if (DfsDomainInfoInit == FALSE) {
  104. ZeroMemory( &DfsDomainInfo, sizeof(DfsDomainInfo) );
  105. ZeroMemory( &OldDfsDomainInfo, sizeof(DfsDomainInfo) );
  106. } else {
  107. OldDfsDomainInfo = DfsDomainInfo;
  108. ZeroMemory( &DfsDomainInfo, sizeof(DfsDomainInfo) );
  109. }
  110. //
  111. // Handle our domain name
  112. //
  113. RtlInitUnicodeString(&DfsDomainInfo.ustrThisDomainFlat, DomainName);
  114. RtlInitUnicodeString(&DfsDomainInfo.ustrThisDomain, DomainNameDns);
  115. //
  116. // And the trusted domains
  117. //
  118. DfspInitDomainListFromLSA();
  119. //
  120. // Use Ds for another list
  121. //
  122. dwErr = DsEnumerateDomainTrusts(
  123. NULL,
  124. DS_DOMAIN_VALID_FLAGS,
  125. &pDsDomainTrusts,
  126. &DsDomainCount);
  127. if (dwErr == ERROR_SUCCESS) {
  128. //
  129. // Merge that list in
  130. //
  131. DfspInsertDsDomainList(
  132. pDsDomainTrusts,
  133. DsDomainCount);
  134. NetApiBufferFree(pDsDomainTrusts);
  135. }
  136. #if DBG
  137. if (DfsSvcVerbose) {
  138. ULONG i;
  139. for (i = 0; i < DfsDomainInfo.cDomains; i++) {
  140. DbgPrint("%d:[%wZ:%wZ]\n",
  141. i,
  142. &DfsDomainInfo.rgustrDomains[i].FlatName,
  143. &DfsDomainInfo.rgustrDomains[i].DnsName);
  144. }
  145. }
  146. #endif
  147. if (dwErr == ERROR_SUCCESS) {
  148. for (i = 0; i < OldDfsDomainInfo.cDomains; i++) {
  149. for (j = 0; j < DfsDomainInfo.cDomains; j++) {
  150. if ((RtlCompareUnicodeString(
  151. &OldDfsDomainInfo.rgustrDomains[i].FlatName,
  152. &DfsDomainInfo.rgustrDomains[j].FlatName,
  153. TRUE) == 0) ||
  154. (RtlCompareUnicodeString(
  155. &OldDfsDomainInfo.rgustrDomains[i].DnsName,
  156. &DfsDomainInfo.rgustrDomains[j].DnsName,
  157. TRUE) == 0)) {
  158. break;
  159. }
  160. }
  161. if (j == DfsDomainInfo.cDomains) {
  162. status = DfsOpen(&dfsHandle, NULL);
  163. if (NT_SUCCESS(status)) {
  164. status = DfsCreateSpcArg(
  165. OldDfsDomainInfo.rgustrDomains[i].FlatName.Buffer,
  166. 0,
  167. DFS_SPECIAL_INFO_NETBIOS,
  168. TRUST_DIRECTION_BIDIRECTIONAL,
  169. TRUST_TYPE_UPLEVEL,
  170. 0,
  171. NULL,
  172. &pSpcArg,
  173. &Size);
  174. if (status == ERROR_SUCCESS) {
  175. status = NtFsControlFile(
  176. dfsHandle,
  177. NULL, // Event,
  178. NULL, // ApcRoutine,
  179. NULL, // ApcContext,
  180. &ioStatus,
  181. FSCTL_DFS_DELETE_SPECIAL_INFO,
  182. pSpcArg,
  183. Size,
  184. NULL,
  185. 0);
  186. free(pSpcArg);
  187. }
  188. status = DfsCreateSpcArg(
  189. OldDfsDomainInfo.rgustrDomains[i].DnsName.Buffer,
  190. 0,
  191. 0,
  192. TRUST_DIRECTION_BIDIRECTIONAL,
  193. TRUST_TYPE_UPLEVEL,
  194. 0,
  195. NULL,
  196. &pSpcArg,
  197. &Size);
  198. if (status == ERROR_SUCCESS) {
  199. status = NtFsControlFile(
  200. dfsHandle,
  201. NULL, // Event,
  202. NULL, // ApcRoutine,
  203. NULL, // ApcContext,
  204. &ioStatus,
  205. FSCTL_DFS_DELETE_SPECIAL_INFO,
  206. pSpcArg,
  207. Size,
  208. NULL,
  209. 0);
  210. free(pSpcArg);
  211. }
  212. NtClose(dfsHandle);
  213. }
  214. }
  215. }
  216. if (OldDfsDomainInfo.rgustrDomains)
  217. free(OldDfsDomainInfo.rgustrDomains);
  218. if (OldDfsDomainInfo.wszNameBuffer)
  219. free(OldDfsDomainInfo.wszNameBuffer);
  220. }
  221. DfsDomainInfoInit = TRUE;
  222. LeaveCriticalSection(&DomListCritSection);
  223. }
  224. //+----------------------------------------------------------------------------
  225. //
  226. // Function: DfspInitDomainListFromLSA
  227. //
  228. // Synopsis: Retrieves the list of trusted domains from the LSA.
  229. //
  230. // Arguments: None
  231. //
  232. // Returns: [ERROR_SUCCESS] -- Successfully inited list.
  233. //
  234. // [ERROR_NOT_ENOUGH_MEMORY] -- Out of memory condition
  235. //
  236. //-----------------------------------------------------------------------------
  237. DWORD
  238. DfspInitDomainListFromLSA()
  239. {
  240. DWORD dwErr;
  241. NTSTATUS status;
  242. ULONG cEnum;
  243. OBJECT_ATTRIBUTES oa;
  244. LSA_HANDLE hlsa = NULL;
  245. LSA_ENUMERATION_HANDLE hEnum = (LSA_ENUMERATION_HANDLE)0;
  246. PTRUSTED_DOMAIN_INFORMATION_EX rglsaDomainInfo = NULL;
  247. ZeroMemory( &oa, sizeof(OBJECT_ATTRIBUTES) );
  248. status = LsaOpenPolicy(
  249. NULL, // SystemName
  250. &oa, // LSA Object Attributes
  251. POLICY_VIEW_LOCAL_INFORMATION, // Desired Access
  252. &hlsa);
  253. if (NT_SUCCESS(status)) {
  254. do {
  255. cEnum = 0;
  256. status = LsaEnumerateTrustedDomainsEx(
  257. hlsa,
  258. &hEnum,
  259. (PVOID) &rglsaDomainInfo,
  260. LSA_MAXIMUM_ENUMERATION_LENGTH,
  261. &cEnum);
  262. if (
  263. NT_SUCCESS(status)
  264. ||
  265. (status == STATUS_NO_MORE_ENTRIES && cEnum > 0 && rglsaDomainInfo != NULL)
  266. ) {
  267. status = DfspInsertLsaDomainList(
  268. rglsaDomainInfo,
  269. cEnum);
  270. }
  271. if (rglsaDomainInfo != NULL) {
  272. LsaFreeMemory(rglsaDomainInfo);
  273. rglsaDomainInfo = NULL;
  274. }
  275. } while (status == STATUS_SUCCESS);
  276. }
  277. switch (status) {
  278. case STATUS_SUCCESS:
  279. case STATUS_NO_MORE_ENTRIES:
  280. dwErr = ERROR_SUCCESS;
  281. break;
  282. case STATUS_INSUFFICIENT_RESOURCES:
  283. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  284. break;
  285. default:
  286. dwErr = ERROR_UNEXP_NET_ERR;
  287. break;
  288. }
  289. if (hlsa != NULL) {
  290. LsaClose(hlsa);
  291. }
  292. return( dwErr );
  293. }
  294. //+----------------------------------------------------------------------------
  295. //
  296. // Function: DfspInsertLsaDomainList
  297. //
  298. // Synopsis: Helper function to insert a part of the trusted domain list
  299. // into the DfsDomainInfo.
  300. //
  301. // Arguments: [rglsaDomainList] -- Array of LSA_TRUST_INFORMATIONs.
  302. // [cDomains] -- Number of elements in rglsaDomainList
  303. //
  304. // Returns: [STATUS_SUCCESS] -- Successfully appended domain list to
  305. // DfsDomainInfo.
  306. //
  307. // [STATUS_INSUFFICIENT_RESOURCES] -- Unable to allocate memory
  308. // for new list.
  309. //
  310. //-----------------------------------------------------------------------------
  311. NTSTATUS
  312. DfspInsertLsaDomainList(
  313. PTRUSTED_DOMAIN_INFORMATION_EX rglsaDomainList,
  314. ULONG cDomains)
  315. {
  316. PDFS_TRUSTED_DOMAIN_INFO rgustrDomains = NULL;
  317. PWSTR wszNameBuffer = NULL, pwch;
  318. ULONG cTotalDomains, cbNameBuffer, i, j;
  319. DFSSVC_TRACE_NORM(DEFAULT, DfspInsertLsaDomainList_Entry,
  320. LOGPTR(rglsaDomainList)
  321. LOGULONG(cDomains));
  322. #if DBG
  323. if (DfsSvcVerbose)
  324. DbgPrint("DfspInsertLsaDomainList(%d)\n", cDomains);
  325. #endif
  326. cTotalDomains = DfsDomainInfo.cDomains + cDomains;
  327. cbNameBuffer = DfsDomainInfo.cbNameBuffer;
  328. for (i = 0; i < cDomains; i++) {
  329. cbNameBuffer += rglsaDomainList[i].Name.Length
  330. + sizeof(UNICODE_NULL) +
  331. rglsaDomainList[i].FlatName.Length +
  332. sizeof(UNICODE_NULL);
  333. }
  334. wszNameBuffer = (PWSTR) malloc( cbNameBuffer );
  335. if (wszNameBuffer == NULL) {
  336. return( STATUS_INSUFFICIENT_RESOURCES );
  337. }
  338. rgustrDomains = (PDFS_TRUSTED_DOMAIN_INFO) malloc(
  339. cTotalDomains * sizeof(DFS_TRUSTED_DOMAIN_INFO));
  340. if (rgustrDomains == NULL) {
  341. free( wszNameBuffer );
  342. return( STATUS_INSUFFICIENT_RESOURCES );
  343. }
  344. //
  345. // Copy over the existing DfsDomainInfo
  346. //
  347. if (DfsDomainInfo.cDomains != 0) {
  348. CopyMemory(
  349. wszNameBuffer,
  350. DfsDomainInfo.wszNameBuffer,
  351. DfsDomainInfo.cbNameBuffer);
  352. CopyMemory(
  353. rgustrDomains,
  354. DfsDomainInfo.rgustrDomains,
  355. DfsDomainInfo.cDomains * sizeof(DFS_TRUSTED_DOMAIN_INFO));
  356. }
  357. for (i = 0; i < DfsDomainInfo.cDomains; i++) {
  358. rgustrDomains[i].FlatName.Buffer = (WCHAR *)((PCHAR)wszNameBuffer +
  359. ((PCHAR)DfsDomainInfo.rgustrDomains[i].FlatName.Buffer - (PCHAR)DfsDomainInfo.wszNameBuffer));
  360. rgustrDomains[i].DnsName.Buffer = (WCHAR *)((PCHAR)wszNameBuffer +
  361. ((PCHAR)DfsDomainInfo.rgustrDomains[i].DnsName.Buffer - (PCHAR)DfsDomainInfo.wszNameBuffer));
  362. }
  363. //
  364. // Now copy in the new
  365. //
  366. pwch = (PWSTR) (((PCHAR) wszNameBuffer) + DfsDomainInfo.cbNameBuffer);
  367. for (j = 0, i = DfsDomainInfo.cDomains; j < cDomains; j++, i++) {
  368. //
  369. // Dns name
  370. //
  371. CopyMemory(
  372. pwch,
  373. rglsaDomainList[j].Name.Buffer,
  374. rglsaDomainList[j].Name.Length);
  375. pwch[ rglsaDomainList[j].Name.Length / sizeof(WCHAR) ] = UNICODE_NULL;
  376. RtlInitUnicodeString( &rgustrDomains[i].DnsName, pwch);
  377. pwch += (rglsaDomainList[j].Name.Length / sizeof(WCHAR) + 1);
  378. //
  379. // FlatName (Netbios)
  380. //
  381. CopyMemory(
  382. pwch,
  383. rglsaDomainList[j].FlatName.Buffer,
  384. rglsaDomainList[j].FlatName.Length);
  385. pwch[ rglsaDomainList[j].FlatName.Length / sizeof(WCHAR) ] = UNICODE_NULL;
  386. RtlInitUnicodeString( &rgustrDomains[i].FlatName, pwch);
  387. pwch += (rglsaDomainList[j].FlatName.Length / sizeof(WCHAR) + 1);
  388. rgustrDomains[i].TrustDirection = rglsaDomainList[j].TrustDirection;
  389. rgustrDomains[i].TrustType = rglsaDomainList[j].TrustType;
  390. rgustrDomains[i].TrustAttributes = rglsaDomainList[j].TrustAttributes;
  391. }
  392. if (DfsDomainInfo.wszNameBuffer != NULL)
  393. free(DfsDomainInfo.wszNameBuffer);
  394. if (DfsDomainInfo.rgustrDomains != NULL)
  395. free( DfsDomainInfo.rgustrDomains );
  396. DfsDomainInfo.cDomains = cTotalDomains;
  397. DfsDomainInfo.rgustrDomains = rgustrDomains;
  398. DfsDomainInfo.wszNameBuffer = wszNameBuffer;
  399. DfsDomainInfo.cbNameBuffer = cbNameBuffer;
  400. #if DBG
  401. if (DfsSvcVerbose)
  402. DbgPrint("DfspInsertLsaDomainList exit\n");
  403. #endif
  404. return( STATUS_SUCCESS );
  405. }
  406. //+----------------------------------------------------------------------------
  407. //
  408. // Function: DfspInsertDsDomainList
  409. //
  410. // Synopsis: Helper function to insert a part of the trusted domain list
  411. // into the DfsDomainInfo.
  412. //
  413. // Arguments: [pDsDomainTrusts] -- Array of DS_DOMAIN_TRUSTS
  414. // [cDomains] -- Number of elements in pDsDomainTrusts
  415. //
  416. // Returns: [STATUS_SUCCESS] -- Successfully appended domain list to
  417. // DfsDomainInfo.
  418. //
  419. // [STATUS_INSUFFICIENT_RESOURCES] -- Unable to allocate memory
  420. // for new list.
  421. //
  422. //-----------------------------------------------------------------------------
  423. NTSTATUS
  424. DfspInsertDsDomainList(
  425. PDS_DOMAIN_TRUSTS pDsDomainTrusts,
  426. ULONG cDomains)
  427. {
  428. PDFS_TRUSTED_DOMAIN_INFO rgustrDomains = NULL;
  429. PWSTR wszNameBuffer = NULL, pwch;
  430. ULONG cTotalDomains, cbNameBuffer, i, j;
  431. ULONG Len;
  432. ULONG Count;
  433. DFSSVC_TRACE_NORM(DEFAULT, DfspInsertDsDomainList_Entry,
  434. LOGPTR(pDsDomainTrusts)
  435. LOGULONG(cDomains));
  436. #if DBG
  437. if (DfsSvcVerbose)
  438. DbgPrint("DfspInsertDsDomainList(%d)\n", cDomains);
  439. #endif
  440. cTotalDomains = DfsDomainInfo.cDomains + cDomains;
  441. cbNameBuffer = DfsDomainInfo.cbNameBuffer;
  442. for (i = 0; i < cDomains; i++) {
  443. if (pDsDomainTrusts[i].NetbiosDomainName != NULL
  444. &&
  445. pDsDomainTrusts[i].DnsDomainName != NULL
  446. ) {
  447. cbNameBuffer += wcslen(pDsDomainTrusts[i].NetbiosDomainName) * sizeof(WCHAR) +
  448. sizeof(UNICODE_NULL) +
  449. wcslen(pDsDomainTrusts[i].DnsDomainName) * sizeof(WCHAR) +
  450. sizeof(UNICODE_NULL);
  451. }
  452. }
  453. wszNameBuffer = (PWSTR) malloc( cbNameBuffer );
  454. if (wszNameBuffer == NULL) {
  455. return( STATUS_INSUFFICIENT_RESOURCES );
  456. }
  457. rgustrDomains = (PDFS_TRUSTED_DOMAIN_INFO) malloc(
  458. cTotalDomains * sizeof(DFS_TRUSTED_DOMAIN_INFO));
  459. if (rgustrDomains == NULL) {
  460. free( wszNameBuffer );
  461. return( STATUS_INSUFFICIENT_RESOURCES );
  462. }
  463. //
  464. // Copy over the existing DfsDomainInfo
  465. //
  466. if (DfsDomainInfo.cDomains != 0) {
  467. CopyMemory(
  468. wszNameBuffer,
  469. DfsDomainInfo.wszNameBuffer,
  470. DfsDomainInfo.cbNameBuffer);
  471. CopyMemory(
  472. rgustrDomains,
  473. DfsDomainInfo.rgustrDomains,
  474. DfsDomainInfo.cDomains * sizeof(DFS_TRUSTED_DOMAIN_INFO));
  475. }
  476. for (i = 0; i < DfsDomainInfo.cDomains; i++) {
  477. rgustrDomains[i].FlatName.Buffer = (WCHAR *)((PCHAR)wszNameBuffer +
  478. ((PCHAR)DfsDomainInfo.rgustrDomains[i].FlatName.Buffer - (PCHAR)DfsDomainInfo.wszNameBuffer));
  479. rgustrDomains[i].DnsName.Buffer = (WCHAR *)((PCHAR)wszNameBuffer +
  480. ((PCHAR)DfsDomainInfo.rgustrDomains[i].DnsName.Buffer - (PCHAR)DfsDomainInfo.wszNameBuffer));
  481. }
  482. //
  483. // Now copy in the new
  484. //
  485. pwch = (PWSTR) (((PCHAR) wszNameBuffer) + DfsDomainInfo.cbNameBuffer);
  486. for (Count = j = 0, i = DfsDomainInfo.cDomains; j < cDomains; j++) {
  487. if (IsDupDomainInfo(&pDsDomainTrusts[j]) == TRUE) {
  488. continue;
  489. }
  490. //
  491. // Dns name
  492. //
  493. Len = wcslen(pDsDomainTrusts[j].DnsDomainName) * sizeof(WCHAR);
  494. CopyMemory(
  495. pwch,
  496. pDsDomainTrusts[j].DnsDomainName,
  497. Len);
  498. pwch[ Len / sizeof(WCHAR) ] = UNICODE_NULL;
  499. RtlInitUnicodeString( &rgustrDomains[i].DnsName, pwch);
  500. pwch += (Len / sizeof(WCHAR) + 1);
  501. //
  502. // FlatName (Netbios)
  503. //
  504. Len = wcslen(pDsDomainTrusts[j].NetbiosDomainName) * sizeof(WCHAR);
  505. CopyMemory(
  506. pwch,
  507. pDsDomainTrusts[j].NetbiosDomainName,
  508. Len);
  509. pwch[ Len / sizeof(WCHAR) ] = UNICODE_NULL;
  510. RtlInitUnicodeString( &rgustrDomains[i].FlatName, pwch);
  511. pwch += (Len / sizeof(WCHAR) + 1);
  512. rgustrDomains[i].TrustDirection = pDsDomainTrusts[j].Flags;
  513. rgustrDomains[i].TrustType = pDsDomainTrusts[j].TrustType;
  514. rgustrDomains[i].TrustAttributes = pDsDomainTrusts[j].TrustAttributes;
  515. Count++;
  516. i++;
  517. }
  518. if (DfsDomainInfo.wszNameBuffer != NULL)
  519. free(DfsDomainInfo.wszNameBuffer);
  520. if (DfsDomainInfo.rgustrDomains != NULL)
  521. free( DfsDomainInfo.rgustrDomains );
  522. DfsDomainInfo.cDomains += Count;
  523. DfsDomainInfo.rgustrDomains = rgustrDomains;
  524. DfsDomainInfo.wszNameBuffer = wszNameBuffer;
  525. DfsDomainInfo.cbNameBuffer = cbNameBuffer;
  526. #if DBG
  527. if (DfsSvcVerbose)
  528. DbgPrint("DfspInsertDsDomainList (%d inserted)\n", Count);
  529. #endif
  530. return( STATUS_SUCCESS );
  531. }
  532. BOOLEAN
  533. IsDupDomainInfo(
  534. PDS_DOMAIN_TRUSTS pDsDomainTrusts)
  535. {
  536. ULONG i;
  537. if ( pDsDomainTrusts->NetbiosDomainName == NULL ||
  538. pDsDomainTrusts->DnsDomainName == NULL
  539. ) {
  540. return TRUE;
  541. }
  542. if (_wcsicmp(pDsDomainTrusts->NetbiosDomainName, DomainName) == 0
  543. ||
  544. _wcsicmp(pDsDomainTrusts->DnsDomainName, DomainNameDns) == 0
  545. ){
  546. return TRUE;
  547. }
  548. for (i = 0; i < DfsDomainInfo.cDomains; i++) {
  549. if (_wcsicmp(pDsDomainTrusts->NetbiosDomainName,
  550. DfsDomainInfo.rgustrDomains[i].FlatName.Buffer) == 0
  551. ||
  552. _wcsicmp(pDsDomainTrusts->DnsDomainName,
  553. DfsDomainInfo.rgustrDomains[i].DnsName.Buffer) == 0
  554. ) {
  555. return TRUE;
  556. }
  557. }
  558. return FALSE;
  559. }