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.

339 lines
7.3 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. ntlmcomn.h
  5. Abstract:
  6. Header file describing the interface to code common to the
  7. NT Lanman Security Support Provider (NtLmSsp) Service and the DLL.
  8. Author:
  9. Cliff Van Dyke (CliffV) 17-Sep-1993
  10. Revision History:
  11. ChandanS 03-Aug-1996 Stolen from net\svcdlls\ntlmssp\ntlmcomn.h
  12. --*/
  13. #ifndef _NTLMCOMN_INCLUDED_
  14. #define _NTLMCOMN_INCLUDED_
  15. ////////////////////////////////////////////////////////////////////////////
  16. //
  17. // Common include files needed by ALL NtLmSsp files
  18. //
  19. ////////////////////////////////////////////////////////////////////////////
  20. #include <nt.h>
  21. #include <ntrtl.h>
  22. #include <nturtl.h>
  23. #include <windef.h>
  24. #include <winbase.h>
  25. #include <winsvc.h> // Needed for service controller APIs
  26. #include <ntmsv1_0.h> // MSV 1.0 Authentication Package
  27. #include <security.h> // General definition of a Security Support Provider
  28. #include <spseal.h> // Prototypes for Seal & Unseal
  29. #include <ntlmssp.h> // External definition of the NtLmSsp service
  30. #include <lmcons.h>
  31. #include <debug.h> // NtLmSsp debugging
  32. ////////////////////////////////////////////////////////////////////////
  33. //
  34. // Global Definitions
  35. //
  36. ////////////////////////////////////////////////////////////////////////
  37. #define NTLMSSP_KEY_SALT 0xbd
  38. //
  39. // Procedure forwards from utility.cxx
  40. //
  41. #if DBG
  42. NTSTATUS
  43. SspNtStatusToSecStatus(
  44. IN NTSTATUS NtStatus,
  45. IN SECURITY_STATUS DefaultStatus
  46. );
  47. #else
  48. #define SspNtStatusToSecStatus( x, y ) (x)
  49. #endif
  50. BOOLEAN
  51. SspTimeHasElapsed(
  52. IN ULONG StartTime,
  53. IN ULONG Timeout
  54. );
  55. NTSTATUS
  56. SspDuplicateToken(
  57. IN HANDLE OriginalToken,
  58. IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
  59. OUT PHANDLE DuplicatedToken
  60. );
  61. LPWSTR
  62. SspAllocWStrFromWStr(
  63. IN LPWSTR Unicode
  64. );
  65. VOID
  66. SspHidePassword(
  67. IN OUT PUNICODE_STRING Password
  68. );
  69. VOID
  70. SspRevealPassword(
  71. IN OUT PUNICODE_STRING HiddenPassword
  72. );
  73. BOOLEAN
  74. SspGetTokenBuffer(
  75. IN PSecBufferDesc TokenDescriptor OPTIONAL,
  76. IN ULONG BufferIndex,
  77. OUT PSecBuffer * Token,
  78. IN BOOLEAN ReadonlyOK
  79. );
  80. //
  81. // Procedure forwards from credhand.cxx
  82. //
  83. NTSTATUS
  84. SsprAcquireCredentialHandle(
  85. IN PLUID LogonId,
  86. IN PSECPKG_CLIENT_INFO ClientInfo,
  87. IN ULONG CredentialUseFlags,
  88. OUT PULONG_PTR CredentialHandle,
  89. OUT PTimeStamp Lifetime,
  90. IN OPTIONAL PUNICODE_STRING DomainName,
  91. IN OPTIONAL PUNICODE_STRING UserName,
  92. IN OPTIONAL PUNICODE_STRING Password
  93. );
  94. //
  95. // Procedure forwards from context.cxx
  96. //
  97. PSSP_CONTEXT
  98. SspContextAllocateContext(
  99. VOID
  100. );
  101. NTSTATUS
  102. SspContextGetMessage(
  103. IN PVOID InputMessage,
  104. IN ULONG InputMessageSize,
  105. IN NTLM_MESSAGE_TYPE ExpectedMessageType,
  106. OUT PVOID* OutputMessage
  107. );
  108. BOOLEAN
  109. SspConvertRelativeToAbsolute (
  110. IN PVOID MessageBase,
  111. IN ULONG MessageSize,
  112. IN PSTRING32 StringToRelocate,
  113. IN PSTRING OutputString,
  114. IN BOOLEAN AlignToWchar,
  115. IN BOOLEAN AllowNullString
  116. );
  117. VOID
  118. SspContextCopyString(
  119. IN PVOID MessageBuffer,
  120. OUT PSTRING32 OutString,
  121. IN PSTRING InString,
  122. IN OUT PCHAR *Where
  123. );
  124. BOOL
  125. SsprCheckMinimumSecurity(
  126. IN ULONG NegotiateFlags,
  127. IN ULONG MinimumSecurityFlags
  128. );
  129. SECURITY_STATUS
  130. SspContextReferenceContext(
  131. IN ULONG_PTR ContextHandle,
  132. IN BOOLEAN RemoveContext,
  133. OUT PSSP_CONTEXT *ContextResult
  134. );
  135. VOID
  136. SspContextDereferenceContext(
  137. PSSP_CONTEXT Context
  138. );
  139. VOID
  140. SspContextCopyStringAbsolute(
  141. IN PVOID MessageBuffer,
  142. OUT PSTRING OutString,
  143. IN PSTRING InString,
  144. IN OUT PCHAR *Where
  145. );
  146. SECURITY_STATUS
  147. SsprMakeSessionKey(
  148. IN PSSP_CONTEXT Context,
  149. IN PSTRING LmChallengeResponse,
  150. IN UCHAR NtUserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH], // from the DC or GetChalResp
  151. IN UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH], // from the DC of GetChalResp
  152. IN PSTRING DatagramSessionKey
  153. );
  154. NTSTATUS
  155. SsprQueryTreeName(
  156. OUT PUNICODE_STRING TreeName
  157. );
  158. NTSTATUS
  159. SsprUpdateTargetInfo(
  160. VOID
  161. );
  162. TimeStamp
  163. SspContextGetTimeStamp(
  164. IN PSSP_CONTEXT Context,
  165. IN BOOLEAN GetExpirationTime
  166. );
  167. VOID
  168. SspContextSetTimeStamp(
  169. IN PSSP_CONTEXT Context,
  170. IN LARGE_INTEGER ExpirationTime
  171. );
  172. //
  173. // Procedure forwards from ctxtcli.cxx
  174. //
  175. NTSTATUS
  176. SsprHandleFirstCall(
  177. IN ULONG_PTR CredentialHandle,
  178. IN OUT PULONG_PTR ContextHandle,
  179. IN ULONG ContextReqFlags,
  180. IN ULONG InputTokenSize,
  181. IN PVOID InputToken,
  182. IN PUNICODE_STRING TargetServerName OPTIONAL,
  183. IN OUT PULONG OutputTokenSize,
  184. OUT PVOID *OutputToken,
  185. OUT PULONG ContextAttributes,
  186. OUT PTimeStamp ExpirationTime,
  187. OUT PUCHAR SessionKey,
  188. OUT PULONG NegotiateFlags
  189. );
  190. NTSTATUS
  191. SsprHandleNegotiateMessage(
  192. IN ULONG_PTR CredentialHandle,
  193. IN OUT PULONG_PTR ContextHandle,
  194. IN ULONG ContextReqFlags,
  195. IN ULONG InputTokenSize,
  196. IN PVOID InputToken,
  197. IN OUT PULONG OutputTokenSize,
  198. OUT PVOID *OutputToken,
  199. OUT PULONG ContextAttributes,
  200. OUT PTimeStamp ExpirationTime
  201. );
  202. //
  203. // Procedure forwards from ctxtsrv.cxx
  204. //
  205. NTSTATUS
  206. SsprHandleChallengeMessage(
  207. IN ULONG_PTR CredentialHandle,
  208. IN OUT PULONG_PTR ContextHandle,
  209. IN ULONG ContextReqFlags,
  210. IN ULONG InputTokenSize,
  211. IN PVOID InputToken,
  212. IN ULONG SecondInputTokenSize,
  213. IN PVOID SecondInputToken,
  214. IN PUNICODE_STRING TargetServerName, OPTIONAL
  215. IN OUT PULONG OutputTokenSize,
  216. OUT PVOID *OutputToken,
  217. IN OUT PULONG SecondOutputTokenSize,
  218. OUT PVOID *SecondOutputToken,
  219. OUT PULONG ContextAttributes,
  220. OUT PTimeStamp ExpirationTime,
  221. OUT PUCHAR SessionKey,
  222. OUT PULONG NegotiateFlags
  223. );
  224. NTSTATUS
  225. SsprHandleAuthenticateMessage(
  226. IN ULONG_PTR CredentialHandle,
  227. IN OUT PULONG_PTR ContextHandle,
  228. IN ULONG ContextReqFlags,
  229. IN ULONG InputTokenSize,
  230. IN PVOID InputToken,
  231. IN ULONG SecondInputTokenSize,
  232. IN PVOID SecondInputToken,
  233. IN OUT PULONG OutputTokenSize,
  234. OUT PVOID *OutputToken,
  235. OUT PULONG ContextAttributes,
  236. OUT PTimeStamp ExpirationTime,
  237. OUT PUCHAR SessionKey,
  238. OUT PULONG NegotiateFlags,
  239. OUT PHANDLE TokenHandle,
  240. OUT PNTSTATUS SubStatus,
  241. OUT PTimeStamp PasswordExpiry,
  242. OUT PULONG UserFlags
  243. );
  244. NTSTATUS
  245. SsprDeleteSecurityContext (
  246. ULONG_PTR ContextHandle
  247. );
  248. BOOL
  249. SspEnableAllPrivilegesToken(
  250. IN HANDLE ClientTokenHandle
  251. );
  252. //
  253. // Procedure forwards from encrypt.cxx
  254. //
  255. BOOLEAN
  256. IsEncryptionPermitted(VOID);
  257. //
  258. // Procedure forwards from userapi.cxx
  259. //
  260. NTSTATUS
  261. SspMapContext(
  262. IN PULONG_PTR phContext,
  263. IN PUCHAR pSessionKey,
  264. IN ULONG NegotiateFlags,
  265. IN HANDLE TokenHandle,
  266. IN PTimeStamp PasswordExpiry OPTIONAL,
  267. IN ULONG UserFlags,
  268. OUT PSecBuffer ContextData
  269. );
  270. //
  271. // procedure forwards from nlmain.c
  272. //
  273. NTSTATUS
  274. SspAcceptCredentials(
  275. IN SECURITY_LOGON_TYPE LogonType,
  276. IN PSECPKG_PRIMARY_CRED PrimaryCredentials,
  277. IN PSECPKG_SUPPLEMENTAL_CRED SupplementalCredentials
  278. );
  279. #endif // ifndef _NTLMCOMN_INCLUDED_