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.

272 lines
7.3 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1996
  6. //
  7. // File: kerbp.h
  8. //
  9. // Contents: global include file for Kerberos security package
  10. //
  11. //
  12. // History: 16-April-1996 Created MikeSw
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __KERBP_H__
  16. #define __KERBP_H__
  17. //
  18. // All global variables declared as EXTERN will be allocated in the file
  19. // that defines KERBP_ALLOCATE
  20. //
  21. typedef enum _KERBEROS_MACHINE_ROLE {
  22. KerbRoleRealmlessWksta,
  23. KerbRoleStandalone,
  24. KerbRoleWorkstation,
  25. KerbRoleDomainController
  26. } KERBEROS_MACHINE_ROLE, *PKERBEROS_MACHINE_ROLE;
  27. typedef enum _KERBEROS_STATE {
  28. KerberosLsaMode = 1,
  29. KerberosUserMode
  30. } KERBEROS_STATE, *PKERBEROS_STATE;
  31. #define ISC_REQ_DELEGATE_IF_SAFE ISC_REQ_RESERVED1
  32. #define ISC_RET_DELEGATE_IF_SAFE ISC_RET_RESERVED1
  33. #include "kerbdbg.h"
  34. #include "kerbdefs.h"
  35. #include "kerblist.h"
  36. #include "spncache.h"
  37. #include "kerbs4u.h"
  38. #include "bndcache.h"
  39. #include "kerbtick.h"
  40. #include "kerbutil.h"
  41. #include "kerblist.h"
  42. #include "tktcache.h"
  43. #include "logonses.h"
  44. #include "credmgr.h"
  45. #include "ctxtmgr.h"
  46. #include "kerbfunc.h"
  47. #include "logonapi.h"
  48. #include "krbtoken.h"
  49. #include "rpcutil.h"
  50. #include "timesync.h"
  51. #include "sidcache.h"
  52. #ifndef WIN32_CHICAGO
  53. #include "pkauth.h"
  54. #include "tktlogon.h"
  55. #include "userlist.h"
  56. #endif // WIN32_CHICAGO
  57. #include "mitutil.h"
  58. #include "krbevent.h"
  59. #include "credman.h"
  60. #ifdef WIN32_CHICAGO
  61. #include <kerbstub.h>
  62. #include <debug.h>
  63. #endif // WIN32_CHICAGO
  64. #ifdef _WIN64
  65. #include "kerbwow.h"
  66. #endif // _WIN64
  67. //
  68. // Macros for package information
  69. //
  70. #ifdef EXTERN
  71. #undef EXTERN
  72. #endif
  73. #ifdef KERBP_ALLOCATE
  74. #define EXTERN
  75. #else
  76. #define EXTERN extern
  77. #endif // KERBP_ALLOCATE
  78. //
  79. #define KERBEROS_CAPABILITIES ( SECPKG_FLAG_INTEGRITY | \
  80. SECPKG_FLAG_PRIVACY | \
  81. SECPKG_FLAG_TOKEN_ONLY | \
  82. SECPKG_FLAG_DATAGRAM | \
  83. SECPKG_FLAG_CONNECTION | \
  84. SECPKG_FLAG_MULTI_REQUIRED | \
  85. SECPKG_FLAG_EXTENDED_ERROR | \
  86. SECPKG_FLAG_IMPERSONATION | \
  87. SECPKG_FLAG_ACCEPT_WIN32_NAME | \
  88. SECPKG_FLAG_NEGOTIABLE | \
  89. SECPKG_FLAG_GSS_COMPATIBLE | \
  90. SECPKG_FLAG_LOGON | \
  91. SECPKG_FLAG_MUTUAL_AUTH | \
  92. SECPKG_FLAG_DELEGATION )
  93. #define KERBEROS_MAX_TOKEN 12000
  94. #ifdef WIN32_CHICAGO
  95. #define KERBEROS_PACKAGE_NAME "Kerberos"
  96. #define KERBEROS_PACKAGE_COMMENT "Microsoft Kerberos V1.0"
  97. #else
  98. #define KERBEROS_PACKAGE_NAME L"Kerberos"
  99. #define KERBEROS_PACKAGE_COMMENT L"Microsoft Kerberos V1.0"
  100. #endif
  101. #define NETLOGON_STARTED_EVENT L"\\NETLOGON_SERVICE_STARTED"
  102. //
  103. // Global state variables
  104. //
  105. EXTERN PLSA_SECPKG_FUNCTION_TABLE LsaFunctions;
  106. EXTERN PSECPKG_DLL_FUNCTIONS UserFunctions;
  107. EXTERN SECPKG_FUNCTION_TABLE KerberosFunctionTable;
  108. EXTERN SECPKG_USER_FUNCTION_TABLE KerberosUserFunctionTable;
  109. EXTERN ULONG_PTR KerberosPackageId;
  110. EXTERN BOOLEAN KerbGlobalInitialized;
  111. EXTERN BOOLEAN KerbGlobalSocketsInitialized;
  112. EXTERN UNICODE_STRING KerbGlobalMachineName;
  113. EXTERN STRING KerbGlobalKerbMachineName;
  114. EXTERN UNICODE_STRING KerbGlobalKdcServiceName;
  115. EXTERN UNICODE_STRING KerbPackageName;
  116. EXTERN BOOLEAN KerbKdcStarted;
  117. EXTERN BOOLEAN KerbAfdStarted;
  118. EXTERN BOOLEAN KerbNetlogonStarted;
  119. EXTERN BOOLEAN KerbGlobalDomainIsPreNT5;
  120. EXTERN HMODULE KerbKdcHandle;
  121. EXTERN PKDC_VERIFY_PAC_ROUTINE KerbKdcVerifyPac;
  122. EXTERN PKDC_GET_TICKET_ROUTINE KerbKdcGetTicket;
  123. EXTERN PKDC_GET_TICKET_ROUTINE KerbKdcChangePassword;
  124. EXTERN PKDC_FREE_MEMORY_ROUTINE KerbKdcFreeMemory;
  125. EXTERN BOOLEAN KerbGlobalEncryptionPermitted;
  126. EXTERN BOOLEAN KerbGlobalStrongEncryptionPermitted;
  127. EXTERN BOOLEAN KerbGlobalEnforceTime;
  128. EXTERN BOOLEAN KerbGlobalMachineNameChanged;
  129. #ifndef WIN32_CHICAGO
  130. EXTERN BOOLEAN KerbGlobalSafeModeBootOptionPresent;
  131. #endif // WIN32_CHICAGO
  132. //
  133. // Registry driven globals (see Kerberos\readme.txt for details on these)
  134. //
  135. EXTERN ULONG KerbGlobalKdcWaitTime;
  136. EXTERN ULONG KerbGlobalKdcCallTimeout;
  137. EXTERN ULONG KerbGlobalKdcCallBackoff;
  138. EXTERN ULONG KerbGlobalKdcSendRetries;
  139. EXTERN ULONG KerbGlobalMaxDatagramSize;
  140. EXTERN ULONG KerbGlobalDefaultPreauthEtype;
  141. EXTERN ULONG KerbGlobalMaxReferralCount;
  142. EXTERN ULONG KerbGlobalMaxTokenSize;
  143. EXTERN ULONG KerbGlobalKdcOptions;
  144. EXTERN BOOLEAN KerbGlobalUseSidCache;
  145. EXTERN BOOLEAN KerbGlobalUseStrongEncryptionForDatagram;
  146. EXTERN BOOLEAN KerbGlobalRetryPdc;
  147. EXTERN TimeStamp KerbGlobalFarKdcTimeout;
  148. EXTERN TimeStamp KerbGlobalNearKdcTimeout;
  149. EXTERN TimeStamp KerbGlobalSkewTime;
  150. EXTERN TimeStamp KerbGlobalSpnCacheTimeout;
  151. EXTERN BOOLEAN KerbGlobalUseClientIpAddresses;
  152. EXTERN DWORD KerbGlobalTgtRenewalInterval;
  153. #ifndef WIN32_CHICAGO
  154. EXTERN ULONG KerbGlobalLoggingLevel;
  155. #endif // WIN32_CHICAGO
  156. //
  157. // Globals used for handling domain change or that are affected by domain
  158. // change
  159. //
  160. #ifndef WIN32_CHICAGO
  161. #define KerbGlobalReadLock() RtlAcquireResourceShared(&KerberosGlobalResource, TRUE)
  162. #define KerbGlobalWriteLock() RtlAcquireResourceExclusive(&KerberosGlobalResource, TRUE)
  163. #define KerbGlobalReleaseLock() RtlReleaseResource(&KerberosGlobalResource)
  164. EXTERN RTL_RESOURCE KerberosGlobalResource;
  165. EXTERN PSID KerbGlobalDomainSid;
  166. #else // WIN32_CHICAGO
  167. #define KerbGlobalReadLock()
  168. #define KerbGlobalWriteLock()
  169. #define KerbGlobalReleaseLock()
  170. #endif // WIN32_CHICAGO
  171. EXTERN UNICODE_STRING KerbGlobalDomainName;
  172. EXTERN UNICODE_STRING KerbGlobalDnsDomainName;
  173. EXTERN PKERB_INTERNAL_NAME KerbGlobalInternalMachineServiceName;
  174. EXTERN PKERB_INTERNAL_NAME KerbGlobalMitMachineServiceName;
  175. EXTERN UNICODE_STRING KerbGlobalMachineServiceName;
  176. EXTERN KERBEROS_MACHINE_ROLE KerbGlobalRole;
  177. EXTERN UNICODE_STRING KerbGlobalInitialDcRecord;
  178. EXTERN ULONG KerbGlobalInitialDcFlags;
  179. EXTERN ULONG KerbGlobalInitialDcAddressType;
  180. EXTERN PSOCKADDR_IN KerbGlobalIpAddresses; // also protected by same lock
  181. EXTERN BOOLEAN KerbGlobalNoTcpUdp; // also protected by same lock
  182. EXTERN ULONG KerbGlobalIpAddressCount; // also protected by same lock
  183. EXTERN BOOLEAN KerbGlobalIpAddressesInitialized; // also protected by same lock
  184. //
  185. #ifdef WIN32_CHICAGO
  186. // The capabilities of the security package
  187. //
  188. EXTERN ULONG KerbGlobalCapabilities;
  189. #endif // WIN32_CHICAGO
  190. #if DBG
  191. EXTERN ULONG KerbGlobalLogonSessionsLocked;
  192. EXTERN ULONG KerbGlobalCredentialsLocked;
  193. EXTERN ULONG KerbGlobalContextsLocked;
  194. #endif
  195. //
  196. // Useful globals
  197. //
  198. EXTERN TimeStamp KerbGlobalWillNeverTime;
  199. EXTERN TimeStamp KerbGlobalHasNeverTime;
  200. EXTERN KERBEROS_STATE KerberosState;
  201. //
  202. // handle to LSA policy -- trusted.
  203. //
  204. EXTERN LSAPR_HANDLE KerbGlobalPolicyHandle;
  205. //
  206. // SAM and Domain handles for validation interface.
  207. //
  208. EXTERN SAMPR_HANDLE KerbGlobalSamHandle;
  209. EXTERN SAMPR_HANDLE KerbGlobalDomainHandle;
  210. //
  211. // Null copies of Lanman and NT OWF password.
  212. //
  213. EXTERN LM_OWF_PASSWORD KerbGlobalNullLmOwfPassword;
  214. EXTERN NT_OWF_PASSWORD KerbGlobalNullNtOwfPassword;
  215. //
  216. // Useful macros
  217. //
  218. //
  219. // Macro to return the type field of a SecBuffer
  220. //
  221. #define BUFFERTYPE(_x_) ((_x_).BufferType & ~SECBUFFER_ATTRMASK)
  222. //
  223. // Time to wait for the KDC to start, in seconds
  224. //
  225. #endif // __KERBP_H__