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.

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