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.

195 lines
4.4 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1996
  6. //
  7. // File: global.h
  8. //
  9. // Contents: global include file for NTDigest security package
  10. //
  11. //
  12. // History: KDamour 15Mar00 Stolen from msv_sspi\global.h
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef NTDIGEST_GLOBAL_H
  16. #define NTDIGEST_GLOBAL_H
  17. #ifndef UNICODE
  18. #define UNICODE
  19. #endif // UNICODE
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif // __cplusplus
  24. #include <nt.h>
  25. #include <ntrtl.h>
  26. #include <nturtl.h>
  27. #ifndef WIN32_LEAN_AND_MEAN
  28. #define WIN32_LEAN_AND_MEAN
  29. #endif // WIN32_LEAN_AND_MEAN
  30. #include <windows.h>
  31. #ifndef RPC_NO_WINDOWS_H
  32. #define RPC_NO_WINDOWS_H
  33. #endif // RPC_NO_WINDOWS_H
  34. #include <rpc.h>
  35. #ifndef SECURITY_WIN32
  36. #define SECURITY_WIN32
  37. #endif // SECURITY_WIN32
  38. #define SECURITY_PACKAGE
  39. #define SECURITY_NTLM
  40. #include <security.h>
  41. #include <secint.h>
  42. #include <dns.h>
  43. // For notify.cxx DsGetDcName
  44. #include <dsgetdc.h>
  45. #include <lm.h>
  46. // For notify.cxx DsRoleGetPrimaryDomainInformation
  47. #include <Dsrole.h>
  48. #include <md5.h>
  49. #include <hmac.h>
  50. #include <pac.hxx>
  51. #include <wow64t.h>
  52. // Local includes for NT Digest Access SSP
  53. #include "debug.h" /* Support for dsysdbg logging */
  54. #include "wdigest.h"
  55. #include "ntdigest.h" /* Prototype functions for package */
  56. #include "digestsspi.h"
  57. #include "func.h" // Forward declearations of functions
  58. #include "util.h"
  59. #include "lsaap.h"
  60. #include "ctxt.h"
  61. #include "cred.h"
  62. #include "logsess.h"
  63. #include "nonce.h"
  64. #include "auth.h"
  65. #include "user.h"
  66. // Code page for latin-1 ISO-8859-1 (for unicode conversion)
  67. #define CP_8859_1 28591
  68. // Various character definiations
  69. #define CHAR_BACKSLASH '\\'
  70. #define CHAR_DQUOTE '"'
  71. #define CHAR_EQUAL '='
  72. #define CHAR_COMMA ','
  73. #define CHAR_NULL '\0'
  74. #define SECONDS_TO_100NANO 10000000 // Convert 100 nanoseconds to seconds
  75. // General Macros
  76. #define CONSTANT_UNICODE_STRING(s) { sizeof( s ) - sizeof( WCHAR ), sizeof( s ), s }
  77. //
  78. // Macro to return the type field of a SecBuffer
  79. //
  80. #define BUFFERTYPE(_x_) ((_x_).BufferType & ~SECBUFFER_ATTRMASK)
  81. #define PBUFFERTYPE(_x_) ((_x_)->BufferType & ~SECBUFFER_ATTRMASK)
  82. //
  83. // Macros for manipulating globals
  84. //
  85. #ifdef EXTERN
  86. #undef EXTERN
  87. #endif
  88. #ifdef NTDIGEST_GLOBAL
  89. #define EXTERN
  90. #else
  91. #define EXTERN extern
  92. #endif // NTDIGEST_GLOBAL
  93. typedef enum _NTDIGEST_STATE {
  94. NtDigestLsaMode = 1,
  95. NtDigestUserMode
  96. } NTDIGEST_STATE, *PNTDIGEST_STATE;
  97. EXTERN NTDIGEST_STATE g_NtDigestState;
  98. EXTERN ULONG_PTR g_NtDigestPackageId;
  99. // Indicate if running on Domain Controller - used in auth.cxx
  100. EXTERN BOOL g_fDomainController;
  101. EXTERN SECPKG_FUNCTION_TABLE g_NtDigestFunctionTable;
  102. // Package name - used only in Generic Passthrough operations
  103. EXTERN UNICODE_STRING g_ustrNtDigestPackageName;
  104. // Helper routines for use by a Security package handed over by Lsa
  105. // User functions established in userapi.cxx
  106. EXTERN SECPKG_USER_FUNCTION_TABLE g_NtDigestUserFuncTable;
  107. EXTERN PSECPKG_DLL_FUNCTIONS g_UserFunctions;
  108. // Save the PSECPKG_PARAMETERS sent in by SpInitialize
  109. EXTERN PLSA_SECPKG_FUNCTION_TABLE g_LsaFunctions;
  110. EXTERN SECPKG_PARAMETERS g_NtDigestSecPkg;
  111. // Parameters set via Registry
  112. // Lifetime is the number seconds a NONCE is valid for before marked Stale
  113. EXTERN DWORD g_dwParameter_Lifetime;
  114. // Max number os contexts to keep; 0 means no limit
  115. EXTERN DWORD g_dwParameter_MaxCtxtCount;
  116. // BOOL if local policy permits Negotiation Protocol
  117. EXTERN BOOL g_fParameter_Negotiate;
  118. // BOOL if local policy permits UTF-8 encoding of username and realm for HTTP requests & SASL
  119. EXTERN BOOL g_fParameter_UTF8HTTP;
  120. EXTERN BOOL g_fParameter_UTF8SASL;
  121. // Value for AcquireCredentialHandle
  122. EXTERN TimeStamp g_TimeForever;
  123. // Amount of time in milliseconds for the garbage collector of expired contexts to sleep
  124. EXTERN DWORD g_dwExpireSleepInterval;
  125. // TokenSource for AuthData to Token Creation
  126. EXTERN TOKEN_SOURCE g_DigestSource;
  127. // TokenSource for AuthData to Token Creation
  128. EXTERN UNICODE_STRING g_ustrWorkstationName;
  129. // Precalculate the UTF8 and ISO versions of the Server's Realm
  130. EXTERN STRING g_strNtDigestUTF8ServerRealm;
  131. EXTERN STRING g_strNTDigestISO8859ServerRealm;
  132. EXTERN PSID g_NtDigestGlobalLocalSystemSid;
  133. EXTERN PSID g_NtDigestGlobalAliasAdminsSid;
  134. // Memory management variables
  135. extern PSTR MD5_AUTH_NAMES[];
  136. #ifdef __cplusplus
  137. }
  138. #endif // __cplusplus
  139. #endif // NTDIGEST_GLOBAL_H