Leaked source code of windows server 2003
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.

125 lines
4.5 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Windows NT Active Directory Service domain trust verification WMI provider
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 2000
  7. //
  8. // File: trust.h
  9. //
  10. // Contents: Trust class definition
  11. //
  12. // Classes: CTrustInfo
  13. //
  14. // History: 27-Mar-00 EricB created
  15. //
  16. //-----------------------------------------------------------------------------
  17. #ifndef TRUSTINF_H
  18. #define TRUSTINF_H
  19. extern PCWSTR CSTR_PROP_TRUSTED_DOMAIN;
  20. extern PCWSTR CSTR_PROP_FLAT_NAME;
  21. extern PCWSTR CSTR_PROP_SID;
  22. extern PCWSTR CSTR_PROP_TRUST_DIRECTION;
  23. extern PCWSTR CSTR_PROP_TRUST_TYPE;
  24. extern PCWSTR CSTR_PROP_TRUST_ATTRIBUTES;
  25. extern PCWSTR CSTR_PROP_TRUST_STATUS; // uint32
  26. extern PCWSTR CSTR_PROP_TRUST_STATUS_STRING;
  27. extern PCWSTR CSTR_PROP_TRUST_IS_OK; // Boolean
  28. extern PCWSTR CSTR_PROP_TRUSTED_DC_NAME;
  29. enum VerifyStatus
  30. {
  31. VerifyStatusNone = 0,
  32. VerifyStatusBroken,
  33. VerifyStatusTrustOK,
  34. VerifyStatusRediscover,
  35. VerifyStatusRetarget,
  36. VerifyStatusNotWindowsTrust,
  37. VerifyStatusNotOutboundTrust,
  38. VerifyStatusTrustNotChecked,
  39. VerifyStatusPwCheckNotSupported
  40. };
  41. class CDomainInfo; // forward declaration
  42. enum TrustCheckLevel; // ditto
  43. //+----------------------------------------------------------------------------
  44. //
  45. // class CTrustInfo
  46. //
  47. // Each instance contains information about one trust
  48. //
  49. //-----------------------------------------------------------------------------
  50. class CTrustInfo
  51. {
  52. public:
  53. CTrustInfo();
  54. ~CTrustInfo() {};
  55. friend class CDomainInfo;
  56. BOOL Verify(TrustCheckLevel CheckLevel);
  57. //Get List of All the DC for the Domain
  58. DWORD GetDCList(PCWSTR pszKnownServer, vector<LPWSTR> & dcList, LPBYTE * pbufptr);
  59. // Rediscover the Trust
  60. DWORD ForceRediscover(PCWSTR pstrDCName, CString * strDCName);
  61. //Funtion to Get/Set Private Members
  62. void SetTrustedDomain(LPWSTR pszTrustedDomain) {m_strTrustedDomainName = (LPCWSTR)pszTrustedDomain;}
  63. PCWSTR GetTrustedDomain() {return m_strTrustedDomainName;}
  64. void SetFlatName(LPWSTR pszFlatName) {m_strFlatName = pszFlatName;}
  65. PCWSTR GetFlatName() {return m_strFlatName;}
  66. BOOL SetSid(PSID pSid);
  67. PCWSTR GetSid(void) {return m_strSid;}
  68. void SetTrustDirection(ULONG ulDir) {m_ulTrustDirection = ulDir;}
  69. ULONG GetTrustDirection(void) {return m_ulTrustDirection;}
  70. void SetTrustType(ULONG ulTrustType) {m_ulTrustType = ulTrustType;}
  71. ULONG GetTrustType(void) {return m_ulTrustType;}
  72. void SetTrustAttributes(ULONG ulTrustAttributes) {m_ulTrustAttributes = ulTrustAttributes;}
  73. ULONG GetTrustAttributes(void) {return m_ulTrustAttributes;}
  74. void SetTrustedDCName(LPWSTR strTrustedDCName) {m_strTrustedDCName = strTrustedDCName;}
  75. PCWSTR GetTrustedDCName(void) {return m_strTrustedDCName;}
  76. void SetTrustStatus(ULONG netStatus, VerifyStatus Status = VerifyStatusNone);
  77. ULONG GetTrustStatus(void) {return m_trustStatus;}
  78. PCWSTR GetTrustStatusString(void) {return m_strTrustStatus;}
  79. ULONG GetFlags(void) {return m_ulFlags;}
  80. void SetFlags(ULONG ulFlags) {m_ulFlags = ulFlags;}
  81. bool IsTrustOK(void) {return (ERROR_SUCCESS == m_trustStatus);}
  82. BOOL IsVerificationStale(LARGE_INTEGER liMaxVerifyAge);
  83. BOOL IsTrustOutbound(void) {return m_ulTrustDirection & TRUST_DIRECTION_OUTBOUND;}
  84. protected:
  85. void SetTrustDirectionFromFlags(ULONG ulFlags);
  86. void SetLastVerifiedTime(void);
  87. private:
  88. //Information about trust, for more info see Doc of TRUSTED_DOMAIN_INFORMATION_EX
  89. CString m_strTrustedDomainName; // name of the trusted domain
  90. CString m_strFlatName; // Netbios name of the trusted domain
  91. CString m_strSid; // Sid of the trusted domian in string format
  92. ULONG m_ulTrustDirection; // indicate the direction of the trust
  93. ULONG m_ulTrustType; // Type of trust
  94. ULONG m_ulTrustAttributes; // Attributes of trust
  95. ULONG m_ulFlags; // DS_DOMAIN_TRUSTS Flags element
  96. CString m_strTrustedDCName; // Name of the DC with which trust is verified
  97. ULONG m_trustStatus; // Status of the trust; win32 error code
  98. CString m_strTrustStatus; // Status string.
  99. VerifyStatus m_VerifyStatus;
  100. LARGE_INTEGER m_liLastVerified;
  101. BOOL m_fPwVerifySupported;
  102. };
  103. #ifdef NT4_BUILD
  104. DWORD ForceReplication(void);
  105. #endif // NT4_BUILD
  106. #endif //TRUSTINF_H