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.

327 lines
10 KiB

  1. /*++ BUILD Version: 0005 Increment this if a change has global effects
  2. Copyright (c) 1990-1998 Microsoft Corporation
  3. Module Name:
  4. subauth.h
  5. Abstract:
  6. This module defines types and macros for Subauthentication Packages.
  7. *******************************NOTE*********************************
  8. This file is a copy of \nt\public\sdk\inc\subauth.h with a few
  9. definitions removed? Why? Because we need to use some SAM internal
  10. calls defined with SAMRPC.H, LSARPC.H, SAMISRV.H, etc. and these define
  11. some types which are redefined in \nt\public\sdk\inc\subauth.h causing
  12. compile errors. This hack is temporary until post B3 when SAM adds the
  13. necessary semantics we need to avoid calling into SamrQueryInformationUser.
  14. ********************************************************************
  15. Revision History:
  16. --*/
  17. #ifndef _NTSUBAUTH_
  18. #define _NTSUBAUTH_
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #if (!defined(_NTDEF_)) && (!defined(_NTSECAPI_))
  23. typedef LONG NTSTATUS, *PNTSTATUS;
  24. typedef struct _UNICODE_STRING {
  25. USHORT Length;
  26. USHORT MaximumLength;
  27. PWSTR Buffer;
  28. } UNICODE_STRING, *PUNICODE_STRING;
  29. typedef struct _STRING {
  30. USHORT Length;
  31. USHORT MaximumLength;
  32. PCHAR Buffer;
  33. } STRING, *PSTRING;
  34. #endif
  35. #ifndef _NTDEF_
  36. typedef struct _OLD_LARGE_INTEGER {
  37. ULONG LowPart;
  38. LONG HighPart;
  39. } OLD_LARGE_INTEGER, *POLD_LARGE_INTEGER;
  40. #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
  41. #endif
  42. #ifndef _NTSAM_SAM_HANDLE_
  43. typedef PVOID SAM_HANDLE, *PSAM_HANDLE;
  44. #define _NTSAM_SAM_HANDLE_
  45. #endif
  46. #ifndef _NTSAM_USER_ACCOUNT_FLAGS_
  47. //
  48. // User account control flags...
  49. //
  50. #define USER_ACCOUNT_DISABLED (0x00000001)
  51. #define USER_HOME_DIRECTORY_REQUIRED (0x00000002)
  52. #define USER_PASSWORD_NOT_REQUIRED (0x00000004)
  53. #define USER_TEMP_DUPLICATE_ACCOUNT (0x00000008)
  54. #define USER_NORMAL_ACCOUNT (0x00000010)
  55. #define USER_MNS_LOGON_ACCOUNT (0x00000020)
  56. #define USER_INTERDOMAIN_TRUST_ACCOUNT (0x00000040)
  57. #define USER_WORKSTATION_TRUST_ACCOUNT (0x00000080)
  58. #define USER_SERVER_TRUST_ACCOUNT (0x00000100)
  59. #define USER_DONT_EXPIRE_PASSWORD (0x00000200)
  60. #define USER_ACCOUNT_AUTO_LOCKED (0x00000400)
  61. #define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED (0x00000800)
  62. #define USER_SMARTCARD_REQUIRED (0x00001000)
  63. #define USER_TRUSTED_FOR_DELEGATION (0x00002000)
  64. #define USER_NOT_DELEGATED (0x00004000)
  65. #define USER_USE_DES_KEY_ONLY (0x00008000)
  66. #define USER_DONT_REQUIRE_PREAUTH (0x00010000)
  67. #define NEXT_FREE_ACCOUNT_CONTROL_BIT (USER_DONT_REQUIRE_PREAUTH << 1)
  68. #define USER_MACHINE_ACCOUNT_MASK \
  69. ( USER_INTERDOMAIN_TRUST_ACCOUNT |\
  70. USER_WORKSTATION_TRUST_ACCOUNT |\
  71. USER_SERVER_TRUST_ACCOUNT)
  72. #define USER_ACCOUNT_TYPE_MASK \
  73. ( USER_TEMP_DUPLICATE_ACCOUNT |\
  74. USER_NORMAL_ACCOUNT |\
  75. USER_MACHINE_ACCOUNT_MASK )
  76. //
  77. // Logon times may be expressed in day, hour, or minute granularity.
  78. //
  79. // Days per week = 7
  80. // Hours per week = 168
  81. // Minutes per week = 10080
  82. //
  83. #define SAM_DAYS_PER_WEEK (7)
  84. #define SAM_HOURS_PER_WEEK (24 * SAM_DAYS_PER_WEEK)
  85. #define SAM_MINUTES_PER_WEEK (60 * SAM_HOURS_PER_WEEK)
  86. #define _NTSAM_USER_ACCOUNT_FLAG_
  87. #endif
  88. #ifndef _NTSAM_USER_ALL_INFO_
  89. #include "pshpack4.h"
  90. typedef struct _USER_ALL_INFORMATION {
  91. LARGE_INTEGER LastLogon;
  92. LARGE_INTEGER LastLogoff;
  93. LARGE_INTEGER PasswordLastSet;
  94. LARGE_INTEGER AccountExpires;
  95. LARGE_INTEGER PasswordCanChange;
  96. LARGE_INTEGER PasswordMustChange;
  97. UNICODE_STRING UserName;
  98. UNICODE_STRING FullName;
  99. UNICODE_STRING HomeDirectory;
  100. UNICODE_STRING HomeDirectoryDrive;
  101. UNICODE_STRING ScriptPath;
  102. UNICODE_STRING ProfilePath;
  103. UNICODE_STRING AdminComment;
  104. UNICODE_STRING WorkStations;
  105. UNICODE_STRING UserComment;
  106. UNICODE_STRING Parameters;
  107. UNICODE_STRING LmPassword;
  108. UNICODE_STRING NtPassword;
  109. UNICODE_STRING PrivateData;
  110. SR_SECURITY_DESCRIPTOR SecurityDescriptor;
  111. ULONG UserId;
  112. ULONG PrimaryGroupId;
  113. ULONG UserAccountControl;
  114. ULONG WhichFields;
  115. LOGON_HOURS LogonHours;
  116. USHORT BadPasswordCount;
  117. USHORT LogonCount;
  118. USHORT CountryCode;
  119. USHORT CodePage;
  120. BOOLEAN LmPasswordPresent;
  121. BOOLEAN NtPasswordPresent;
  122. BOOLEAN PasswordExpired;
  123. BOOLEAN PrivateDataSensitive;
  124. } USER_ALL_INFORMATION, *PUSER_ALL_INFORMATION;
  125. #include "poppack.h"
  126. #define _NTSAM_USER_ALL_INFO_
  127. #endif
  128. #ifndef _NTSAM_SAM_USER_PARMS_
  129. #define USER_ALL_PARAMETERS 0x00200000
  130. #define _NTSAM_SAM_USER_PARMS_
  131. #endif
  132. #define CLEAR_BLOCK_LENGTH 8
  133. typedef CYPHER_BLOCK * PCYPHER_BLOCK;
  134. typedef LM_OWF_PASSWORD * PLM_OWF_PASSWORD;
  135. typedef CLEAR_BLOCK LM_CHALLENGE;
  136. typedef LM_CHALLENGE * PLM_CHALLENGE;
  137. typedef LM_OWF_PASSWORD NT_OWF_PASSWORD;
  138. typedef NT_OWF_PASSWORD * PNT_OWF_PASSWORD;
  139. typedef LM_CHALLENGE NT_CHALLENGE;
  140. typedef NT_CHALLENGE * PNT_CHALLENGE;
  141. #define USER_SESSION_KEY_LENGTH (CYPHER_BLOCK_LENGTH * 2)
  142. typedef USER_SESSION_KEY * PUSER_SESSION_KEY;
  143. typedef enum _NETLOGON_LOGON_INFO_CLASS {
  144. NetlogonInteractiveInformation = 1,
  145. NetlogonNetworkInformation,
  146. NetlogonServiceInformation,
  147. NetlogonGenericInformation,
  148. NetlogonInteractiveTransitiveInformation,
  149. NetlogonNetworkTransitiveInformation,
  150. NetlogonServiceTransitiveInformation
  151. } NETLOGON_LOGON_INFO_CLASS;
  152. typedef struct _NETLOGON_LOGON_IDENTITY_INFO {
  153. UNICODE_STRING LogonDomainName;
  154. ULONG ParameterControl;
  155. OLD_LARGE_INTEGER LogonId;
  156. UNICODE_STRING UserName;
  157. UNICODE_STRING Workstation;
  158. } NETLOGON_LOGON_IDENTITY_INFO,
  159. *PNETLOGON_LOGON_IDENTITY_INFO;
  160. typedef struct _NETLOGON_INTERACTIVE_INFO {
  161. NETLOGON_LOGON_IDENTITY_INFO Identity;
  162. LM_OWF_PASSWORD LmOwfPassword;
  163. NT_OWF_PASSWORD NtOwfPassword;
  164. } NETLOGON_INTERACTIVE_INFO,
  165. *PNETLOGON_INTERACTIVE_INFO;
  166. typedef struct _NETLOGON_SERVICE_INFO {
  167. NETLOGON_LOGON_IDENTITY_INFO Identity;
  168. LM_OWF_PASSWORD LmOwfPassword;
  169. NT_OWF_PASSWORD NtOwfPassword;
  170. } NETLOGON_SERVICE_INFO, *PNETLOGON_SERVICE_INFO;
  171. typedef struct _NETLOGON_NETWORK_INFO {
  172. NETLOGON_LOGON_IDENTITY_INFO Identity;
  173. LM_CHALLENGE LmChallenge;
  174. STRING NtChallengeResponse;
  175. STRING LmChallengeResponse;
  176. } NETLOGON_NETWORK_INFO, *PNETLOGON_NETWORK_INFO;
  177. typedef struct _NETLOGON_GENERIC_INFO {
  178. NETLOGON_LOGON_IDENTITY_INFO Identity;
  179. UNICODE_STRING PackageName;
  180. ULONG DataLength;
  181. #ifdef MIDL_PASS
  182. [size_is(DataLength)]
  183. #endif
  184. PUCHAR LogonData;
  185. } NETLOGON_GENERIC_INFO, *PNETLOGON_GENERIC_INFO;
  186. // Values for Flags
  187. #define MSV1_0_PASSTHRU 0x01
  188. #define MSV1_0_GUEST_LOGON 0x02
  189. NTSTATUS NTAPI
  190. Msv1_0SubAuthenticationRoutine(
  191. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  192. IN PVOID LogonInformation,
  193. IN ULONG Flags,
  194. IN PUSER_ALL_INFORMATION UserAll,
  195. OUT PULONG WhichFields,
  196. OUT PULONG UserFlags,
  197. OUT PBOOLEAN Authoritative,
  198. OUT PLARGE_INTEGER LogoffTime,
  199. OUT PLARGE_INTEGER KickoffTime
  200. );
  201. typedef struct _MSV1_0_VALIDATION_INFO {
  202. LARGE_INTEGER LogoffTime;
  203. LARGE_INTEGER KickoffTime;
  204. UNICODE_STRING LogonServer;
  205. UNICODE_STRING LogonDomainName;
  206. USER_SESSION_KEY SessionKey;
  207. BOOLEAN Authoritative;
  208. ULONG UserFlags;
  209. ULONG WhichFields;
  210. ULONG UserId;
  211. } MSV1_0_VALIDATION_INFO, *PMSV1_0_VALIDATION_INFO;
  212. // values for WhichFields
  213. #define MSV1_0_VALIDATION_LOGOFF_TIME 0x00000001
  214. #define MSV1_0_VALIDATION_KICKOFF_TIME 0x00000002
  215. #define MSV1_0_VALIDATION_LOGON_SERVER 0x00000004
  216. #define MSV1_0_VALIDATION_LOGON_DOMAIN 0x00000008
  217. #define MSV1_0_VALIDATION_SESSION_KEY 0x00000010
  218. #define MSV1_0_VALIDATION_USER_FLAGS 0x00000020
  219. #define MSV1_0_VALIDATION_USER_ID 0x00000040
  220. // legal values for ActionsPerformed
  221. #define MSV1_0_SUBAUTH_ACCOUNT_DISABLED 0x00000001
  222. #define MSV1_0_SUBAUTH_PASSWORD 0x00000002
  223. #define MSV1_0_SUBAUTH_WORKSTATIONS 0x00000004
  224. #define MSV1_0_SUBAUTH_LOGON_HOURS 0x00000008
  225. #define MSV1_0_SUBAUTH_ACCOUNT_EXPIRY 0x00000010
  226. #define MSV1_0_SUBAUTH_PASSWORD_EXPIRY 0x00000020
  227. #define MSV1_0_SUBAUTH_ACCOUNT_TYPE 0x00000040
  228. #define MSV1_0_SUBAUTH_LOCKOUT 0x00000080
  229. NTSTATUS NTAPI
  230. Msv1_0SubAuthenticationRoutineEx(
  231. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  232. IN PVOID LogonInformation,
  233. IN ULONG Flags,
  234. IN PUSER_ALL_INFORMATION UserAll,
  235. IN SAM_HANDLE UserHandle,
  236. IN OUT PMSV1_0_VALIDATION_INFO ValidationInfo,
  237. OUT PULONG ActionsPerformed
  238. );
  239. NTSTATUS NTAPI
  240. Msv1_0SubAuthenticationRoutineGeneric(
  241. IN PVOID SubmitBuffer,
  242. IN ULONG SubmitBufferLength,
  243. OUT PULONG ReturnBufferLength,
  244. OUT PVOID *ReturnBuffer
  245. );
  246. NTSTATUS NTAPI
  247. Msv1_0SubAuthenticationFilter(
  248. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  249. IN PVOID LogonInformation,
  250. IN ULONG Flags,
  251. IN PUSER_ALL_INFORMATION UserAll,
  252. OUT PULONG WhichFields,
  253. OUT PULONG UserFlags,
  254. OUT PBOOLEAN Authoritative,
  255. OUT PLARGE_INTEGER LogoffTime,
  256. OUT PLARGE_INTEGER KickoffTime
  257. );
  258. #define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
  259. #define STATUS_INVALID_INFO_CLASS ((NTSTATUS)0xC0000003L)
  260. #define STATUS_NO_SUCH_USER ((NTSTATUS)0xC0000064L)
  261. #define STATUS_WRONG_PASSWORD ((NTSTATUS)0xC000006AL)
  262. #define STATUS_PASSWORD_RESTRICTION ((NTSTATUS)0xC000006CL)
  263. #define STATUS_LOGON_FAILURE ((NTSTATUS)0xC000006DL)
  264. #define STATUS_ACCOUNT_RESTRICTION ((NTSTATUS)0xC000006EL)
  265. #define STATUS_INVALID_LOGON_HOURS ((NTSTATUS)0xC000006FL)
  266. #define STATUS_INVALID_WORKSTATION ((NTSTATUS)0xC0000070L)
  267. #define STATUS_PASSWORD_EXPIRED ((NTSTATUS)0xC0000071L)
  268. #define STATUS_ACCOUNT_DISABLED ((NTSTATUS)0xC0000072L)
  269. #define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS)0xC000009AL)
  270. #define STATUS_ACCOUNT_EXPIRED ((NTSTATUS)0xC0000193L)
  271. #define STATUS_PASSWORD_MUST_CHANGE ((NTSTATUS)0xC0000224L)
  272. #define STATUS_ACCOUNT_LOCKED_OUT ((NTSTATUS)0xC0000234L)
  273. #ifdef __cplusplus
  274. }
  275. #endif
  276. #endif /* _NTSUBAUTH_ */