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.

172 lines
3.8 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: cainfop.h
  7. //
  8. // Contents: Private definitions for CA Info
  9. //
  10. // History: 12-dec-97 petesk created
  11. //
  12. //---------------------------------------------------------------------------
  13. #ifndef __CAINFOP_H__
  14. #define __CAINFOP_H__
  15. #include <winldap.h>
  16. #define SYSTEM_CN TEXT("System")
  17. #define PUBLIC_KEY_SERVICES_CN TEXT("Public Key Services")
  18. #define CAS_CN TEXT("CAs")
  19. VOID CACleanup();
  20. DWORD
  21. DNStoRFC1779Name(
  22. WCHAR *rfcDomain,
  23. ULONG *rfcDomainLength,
  24. LPCWSTR dnsDomain);
  25. DWORD
  26. myGetSidFromDomain(
  27. IN LPWSTR wszDomain,
  28. OUT PSID *ppDomainSid);
  29. DWORD
  30. myGetEnterpriseDnsName(
  31. OUT LPWSTR *pwszDomain);
  32. BOOL
  33. myNetLogonUser(
  34. LPTSTR UserName,
  35. LPTSTR DomainName,
  36. LPTSTR Password,
  37. PHANDLE phToken);
  38. #ifndef DNS_MAX_NAME_LENGTH
  39. #define DNS_MAX_NAME_LENGTH 255
  40. #endif
  41. typedef WCHAR *CERTSTR;
  42. //
  43. // CAGetAuthoritativeDomainDn - retrieve the Domain root DN for this
  44. // domain. This retrieves config info from the DS for the default domain.
  45. //
  46. HRESULT
  47. CAGetAuthoritativeDomainDn(
  48. IN LDAP* LdapHandle,
  49. OUT CERTSTR *DomainDn,
  50. OUT CERTSTR *ConfigDN);
  51. //
  52. // CASCreateCADSEntry - This creates a CA entry in the DS for this CA,
  53. // and sets the appropriate entries for name, DN, certificate, dnsname.
  54. // It is for use by setup.
  55. // It creates the CA entry at the location
  56. // CN=bstrCAName,CN=CAs,CN=PublicKeyServices,CN=System,DC....root dc path...
  57. //
  58. HRESULT
  59. CASCreateCADSEntry(
  60. IN CERTSTR bstrCAName, // Name of the CA
  61. IN PCCERT_CONTEXT pCertificate); // Certificate of the CA
  62. HRESULT
  63. GetCertAuthorityDSLocation(
  64. IN LDAP *LdapHandle,
  65. CERTSTR bstrCAName,
  66. CERTSTR bstrDomainDN,
  67. CERTSTR *bstrDSLocation);
  68. class CCAProperty
  69. {
  70. public:
  71. CCAProperty(LPCWSTR wszName);
  72. HRESULT Find(LPCWSTR wszName, CCAProperty **ppCAProp);
  73. static HRESULT Append(CCAProperty **ppCAPropChain, CCAProperty *pNewProp);
  74. static HRESULT DeleteChain(CCAProperty **ppCAProp);
  75. HRESULT SetValue(LPWSTR * awszProperties);
  76. HRESULT GetValue(LPWSTR ** pawszProperties);
  77. HRESULT LoadFromRegValue(HKEY hkReg, LPCWSTR wszValue);
  78. HRESULT UpdateToRegValue(HKEY hkReg, LPCWSTR wszValue);
  79. protected:
  80. // Only call via DeleteChain
  81. ~CCAProperty();
  82. HRESULT _Cleanup();
  83. WCHAR ** m_awszValues;
  84. CERTSTR m_wszName;
  85. CCAProperty *m_pNext;
  86. private:
  87. };
  88. HRESULT CertFreeString(CERTSTR cstrString);
  89. CERTSTR CertAllocString(LPCWSTR wszString);
  90. CERTSTR CertAllocStringLen(LPCWSTR wszString, UINT len);
  91. CERTSTR CertAllocStringByteLen(LPCSTR szString, UINT len);
  92. UINT CertStringLen(CERTSTR cstrString);
  93. UINT CertStringByteLen(CERTSTR cstrString);
  94. #define RLBF_TRUE TRUE
  95. #define RLBF_REQUIRE_GC 0x00000002
  96. #define RLBF_ATTEMPT_REDISCOVER 0x00000004
  97. #define RLBF_REQUIRE_SECURE_LDAP 0x00000008
  98. #define RLBF_REQUIRE_LDAP_INTEG 0x00000010
  99. // dwFlags must be BOOL to preserve signature
  100. HRESULT
  101. myRobustLdapBind(
  102. OUT LDAP **ppldap,
  103. IN BOOL dwFlags); // RLBF_* (TRUE --> RLBF_REQUIRE_GC)
  104. // dwFlags1 & dwFlags2 must be BOOL to preserve signature
  105. HRESULT
  106. myRobustLdapBindEx(
  107. IN BOOL dwFlags1, // TRUE --> RLBF_REQUIRE_GC
  108. IN BOOL dwFlags2, // RLBF_* (TRUE --> RLBF_ATTEMPT_REDISCOVER)
  109. IN ULONG uVersion,
  110. OPTIONAL IN WCHAR const *pwszDomainName,
  111. OUT LDAP **ppldap,
  112. OPTIONAL OUT WCHAR **ppwszForestDNSName);
  113. HRESULT
  114. CAAccessCheckp(
  115. HANDLE ClientToken,
  116. PSECURITY_DESCRIPTOR pSD);
  117. HRESULT
  118. CAAccessCheckpEx(
  119. IN HANDLE ClientToken,
  120. IN PSECURITY_DESCRIPTOR pSD,
  121. IN DWORD dwOption);
  122. #endif // __CAINFOP_H__