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.

308 lines
6.4 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. kerbcomn.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. --*/
  12. #ifndef _KERBSTUB_INCLUDED_
  13. #define _KERBSTUB_INCLUDED_
  14. //
  15. // kerbstub.cxx will #include this file with KERBCOMN_ALLOCATE defined.
  16. // That will cause each of these variables to be allocated.
  17. //
  18. #ifdef EXTERN
  19. #undef EXTERN
  20. #endif
  21. #ifdef KERBSTUB_ALLOCATE
  22. #define EXTERN
  23. #else
  24. #define EXTERN extern
  25. #endif
  26. EXTERN CRITICAL_SECTION KerbDllCritSect; // Serializes access to all globals in module
  27. #if DBG
  28. //
  29. // To serialize access to log file.
  30. //
  31. EXTERN CRITICAL_SECTION KerbGlobalLogFileCritSect;
  32. //
  33. // Control which messages get displayed
  34. //
  35. EXTERN DWORD KerbInfoLevel;
  36. #endif // DBG
  37. #define KERBEROS_TICKET_KEY TEXT("Network\\KerberosLogon")
  38. #define KERBEROS_TICKET_USERNAME_KEY TEXT("UserName")
  39. #define KERBEROS_TICKET_DOMAINNAME_KEY TEXT("DomainName")
  40. #define KERBEROS_TICKET_LOGONSESSION_KEY TEXT("LogonSession")
  41. EXTERN SecurityFunctionTable KerbDllSecurityFunctionTable;
  42. EXTERN LSA_SECPKG_FUNCTION_TABLE FunctionTable;
  43. ////////////////////////////////////////////////////////////////////////
  44. //
  45. // Typedefs required for dumping to/from registry
  46. //
  47. ////////////////////////////////////////////////////////////////////////
  48. typedef struct _KERB_LOGON_SESSION_CACHE {
  49. TimeStamp Lifetime;
  50. ULONG LogonSessionFlags;
  51. UNICODE_STRING UserName;
  52. UNICODE_STRING DomainName;
  53. USHORT Revision;
  54. USHORT Flags;
  55. USHORT CredentialCount;
  56. KERB_ENCRYPTION_KEY Credentials[ANYSIZE_ARRAY];
  57. } KERB_LOGON_SESSION_CACHE, *PKERB_LOGON_SESSION_CACHE;
  58. ////////////////////////////////////////////////////////////////////////
  59. //
  60. // Procedure Forwards
  61. //
  62. ////////////////////////////////////////////////////////////////////////
  63. //
  64. // Procedure forwards from stub.c
  65. //
  66. SECURITY_STATUS
  67. KerbEnumerateSecurityPackages(
  68. OUT PULONG PackageCount,
  69. OUT PSecPkgInfo *PackageInfo
  70. );
  71. SECURITY_STATUS
  72. KerbQuerySecurityPackageInfo (
  73. LPTSTR PackageName,
  74. PSecPkgInfo * Package
  75. );
  76. SECURITY_STATUS SEC_ENTRY
  77. KerbFreeContextBuffer (
  78. void __SEC_FAR * ContextBuffer
  79. );
  80. SECURITY_STATUS
  81. KerbAcquireCredentialsHandle(
  82. IN LPTSTR PrincipalName,
  83. IN LPTSTR PackageName,
  84. IN ULONG CredentialUseFlags,
  85. IN PVOID LogonId,
  86. IN PVOID AuthData,
  87. IN SEC_GET_KEY_FN GetKeyFunction,
  88. IN PVOID GetKeyArgument,
  89. OUT PCredHandle CredentialHandle,
  90. OUT PTimeStamp Lifetime
  91. );
  92. SECURITY_STATUS
  93. KerbFreeCredentialsHandle(
  94. IN PCredHandle CredentialHandle
  95. );
  96. SECURITY_STATUS
  97. KerbQueryCredentialsAttributes(
  98. IN PCredHandle CredentialsHandle,
  99. IN ULONG Attribute,
  100. OUT PVOID Buffer
  101. );
  102. SECURITY_STATUS
  103. KerbSspiLogonUser(
  104. IN LPTSTR PackageName,
  105. IN LPTSTR UserName,
  106. IN LPTSTR DomainName,
  107. IN LPTSTR Password
  108. );
  109. SECURITY_STATUS
  110. KerbInitializeSecurityContext(
  111. IN PCredHandle CredentialHandle,
  112. IN PCtxtHandle OldContextHandle,
  113. IN LPTSTR TargetName,
  114. IN ULONG ContextReqFlags,
  115. IN ULONG Reserved1,
  116. IN ULONG TargetDataRep,
  117. IN PSecBufferDesc InputToken,
  118. IN ULONG Reserved2,
  119. OUT PCtxtHandle NewContextHandle,
  120. OUT PSecBufferDesc OutputToken,
  121. OUT PULONG ContextAttributes,
  122. OUT PTimeStamp ExpirationTime
  123. );
  124. SECURITY_STATUS
  125. KerbDeleteSecurityContext (
  126. PCtxtHandle ContextHandle
  127. );
  128. SECURITY_STATUS
  129. KerbApplyControlToken (
  130. PCtxtHandle ContextHandle,
  131. PSecBufferDesc Input
  132. );
  133. SECURITY_STATUS
  134. KerbImpersonateSecurityContext (
  135. PCtxtHandle ContextHandle
  136. );
  137. SECURITY_STATUS
  138. KerbRevertSecurityContext (
  139. PCtxtHandle ContextHandle
  140. );
  141. SECURITY_STATUS
  142. KerbQueryContextAttributes(
  143. IN PCtxtHandle ContextHandle,
  144. IN ULONG Attribute,
  145. OUT PVOID Buffer
  146. );
  147. SECURITY_STATUS SEC_ENTRY
  148. KerbCompleteAuthToken (
  149. PCtxtHandle ContextHandle,
  150. PSecBufferDesc BufferDescriptor
  151. );
  152. SECURITY_STATUS
  153. KerbMakeSignature (
  154. PCtxtHandle ContextHandle,
  155. unsigned long QualityOfProtection,
  156. PSecBufferDesc Message,
  157. unsigned long SequenceNumber
  158. );
  159. SECURITY_STATUS
  160. KerbVerifySignature (
  161. PCtxtHandle ContextHandle,
  162. PSecBufferDesc Message,
  163. unsigned long SequenceNumber,
  164. unsigned long * QualityOfProtection
  165. );
  166. SECURITY_STATUS
  167. KerbSealMessage (
  168. PCtxtHandle ContextHandle,
  169. unsigned long QualityOfProtection,
  170. PSecBufferDesc Message,
  171. unsigned long SequenceNumber
  172. );
  173. SECURITY_STATUS
  174. KerbUnsealMessage (
  175. PCtxtHandle ContextHandle,
  176. PSecBufferDesc Message,
  177. unsigned long SequenceNumber,
  178. unsigned long * QualityOfProtection
  179. );
  180. NTSTATUS
  181. GetClientInfo(
  182. OUT PSECPKG_CLIENT_INFO ClientInfo
  183. );
  184. BOOLEAN
  185. GetCallInfo(
  186. OUT PSECPKG_CALL_INFO CallInfo
  187. );
  188. // fake it.
  189. //typedef ULONG LSA_CLIENT_REQUEST;
  190. //typedef LSA_CLIENT_REQUEST *LSA_CLIENT_REQUEST;
  191. NTSTATUS
  192. CopyFromClientBuffer(
  193. IN PLSA_CLIENT_REQUEST ClientRequest,
  194. IN ULONG Length,
  195. IN PVOID BufferToCopy,
  196. IN PVOID ClientBaseAddress
  197. );
  198. NTSTATUS
  199. AllocateClientBuffer(
  200. IN PLSA_CLIENT_REQUEST ClientRequest,
  201. IN ULONG LengthRequired,
  202. OUT PVOID *ClientBaseAddress
  203. );
  204. NTSTATUS
  205. CopyToClientBuffer(
  206. IN PLSA_CLIENT_REQUEST ClientRequest,
  207. IN ULONG Length,
  208. IN PVOID ClientBaseAddress,
  209. IN PVOID BufferToCopy
  210. );
  211. NTSTATUS
  212. FreeClientBuffer (
  213. IN PLSA_CLIENT_REQUEST ClientRequest,
  214. IN PVOID ClientBaseAddress
  215. );
  216. VOID
  217. AuditLogon(
  218. IN NTSTATUS Status,
  219. IN NTSTATUS SubStatus,
  220. IN PUNICODE_STRING AccountName,
  221. IN PUNICODE_STRING AuthenticatingAuthority,
  222. IN PUNICODE_STRING WorkstationName,
  223. IN OPTIONAL PSID UserSid,
  224. IN SECURITY_LOGON_TYPE LogonType,
  225. IN PTOKEN_SOURCE TokenSource,
  226. IN PLUID LogonId
  227. );
  228. NTSTATUS
  229. MapBuffer(
  230. IN PSecBuffer InputBuffer,
  231. OUT PSecBuffer OutputBuffer
  232. );
  233. NTSTATUS
  234. KerbDuplicateHandle(
  235. IN HANDLE SourceHandle,
  236. OUT PHANDLE DestionationHandle
  237. );
  238. PVOID
  239. AllocateLsaHeap(
  240. IN ULONG Length
  241. );
  242. VOID
  243. FreeLsaHeap(
  244. IN PVOID Base
  245. );
  246. VOID
  247. FreeReturnBuffer(
  248. IN PVOID Base
  249. );
  250. #endif // ifndef _KERBSTUB_INCLUDED_