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.

755 lines
23 KiB

  1. /*++
  2. Copyright (c) 1987-1991 Microsoft Corporation
  3. Module Name:
  4. logonmsv.h
  5. Abstract:
  6. Definition of API's to the Netlogon service which are callable
  7. by the MSV1_0 authentication package.
  8. Author:
  9. Cliff Van Dyke (cliffv) 23-Jun-1991
  10. Environment:
  11. User mode only.
  12. Contains NT-specific code.
  13. Requires ANSI C extensions: slash-slash comments, long external names.
  14. Revision History:
  15. --*/
  16. #ifndef __LOGONMSV_H__
  17. #define __LOGONMSV_H__
  18. #include <lsass.h> // OLD_LARGE_INTEGER
  19. //
  20. // Name of secret in LSA secret storage where account passwords are kept.
  21. //
  22. #define SSI_SECRET_PREFIX L"$"
  23. #define SSI_SECRET_PREFIX_LENGTH 1
  24. #define SSI_SECRET_POSTFIX L"MACHINE.ACC"
  25. #define SSI_SECRET_NAME L"$MACHINE.ACC"
  26. //
  27. // Name of the event used to synchronize between the security process and
  28. // the service controller.
  29. //
  30. #define SECURITY_SERVICES_STARTED L"SECURITY_SERVICES_STARTED"
  31. //
  32. // The structures supporting remote logon APIs
  33. //
  34. typedef CYPHER_BLOCK NETLOGON_CREDENTIAL, *PNETLOGON_CREDENTIAL ;
  35. typedef struct _NETLOGON_AUTHENTICATOR {
  36. NETLOGON_CREDENTIAL Credential;
  37. DWORD timestamp;
  38. } NETLOGON_AUTHENTICATOR, *PNETLOGON_AUTHENTICATOR ;
  39. typedef struct _NETLOGON_SESSION_KEY {
  40. BYTE Key[CRYPT_TXT_LEN * 2];
  41. } NETLOGON_SESSION_KEY, *PNETLOGON_SESSION_KEY;
  42. typedef enum _NETLOGON_SECURE_CHANNEL_TYPE {
  43. NullSecureChannel = 0,
  44. MsvApSecureChannel,
  45. WorkstationSecureChannel,
  46. TrustedDnsDomainSecureChannel,
  47. TrustedDomainSecureChannel,
  48. UasServerSecureChannel,
  49. ServerSecureChannel
  50. } NETLOGON_SECURE_CHANNEL_TYPE;
  51. #define IsDomainSecureChannelType( _T ) \
  52. ( (_T) == TrustedDnsDomainSecureChannel || \
  53. (_T) == TrustedDomainSecureChannel )
  54. //
  55. // Input information to NetLogonSamLogon.
  56. //
  57. // begin_ntsubauth
  58. typedef enum _NETLOGON_LOGON_INFO_CLASS {
  59. NetlogonInteractiveInformation = 1,
  60. NetlogonNetworkInformation,
  61. NetlogonServiceInformation,
  62. NetlogonGenericInformation,
  63. NetlogonInteractiveTransitiveInformation,
  64. NetlogonNetworkTransitiveInformation,
  65. NetlogonServiceTransitiveInformation
  66. } NETLOGON_LOGON_INFO_CLASS;
  67. typedef struct _NETLOGON_LOGON_IDENTITY_INFO {
  68. UNICODE_STRING LogonDomainName;
  69. ULONG ParameterControl;
  70. OLD_LARGE_INTEGER LogonId;
  71. UNICODE_STRING UserName;
  72. UNICODE_STRING Workstation;
  73. } NETLOGON_LOGON_IDENTITY_INFO,
  74. *PNETLOGON_LOGON_IDENTITY_INFO;
  75. typedef struct _NETLOGON_INTERACTIVE_INFO {
  76. NETLOGON_LOGON_IDENTITY_INFO Identity;
  77. LM_OWF_PASSWORD LmOwfPassword;
  78. NT_OWF_PASSWORD NtOwfPassword;
  79. } NETLOGON_INTERACTIVE_INFO,
  80. *PNETLOGON_INTERACTIVE_INFO;
  81. typedef struct _NETLOGON_SERVICE_INFO {
  82. NETLOGON_LOGON_IDENTITY_INFO Identity;
  83. LM_OWF_PASSWORD LmOwfPassword;
  84. NT_OWF_PASSWORD NtOwfPassword;
  85. } NETLOGON_SERVICE_INFO, *PNETLOGON_SERVICE_INFO;
  86. typedef struct _NETLOGON_NETWORK_INFO {
  87. NETLOGON_LOGON_IDENTITY_INFO Identity;
  88. LM_CHALLENGE LmChallenge;
  89. STRING NtChallengeResponse;
  90. STRING LmChallengeResponse;
  91. } NETLOGON_NETWORK_INFO, *PNETLOGON_NETWORK_INFO;
  92. typedef struct _NETLOGON_GENERIC_INFO {
  93. NETLOGON_LOGON_IDENTITY_INFO Identity;
  94. UNICODE_STRING PackageName;
  95. ULONG DataLength;
  96. #ifdef MIDL_PASS
  97. [size_is(DataLength)]
  98. #endif
  99. PUCHAR LogonData;
  100. } NETLOGON_GENERIC_INFO, *PNETLOGON_GENERIC_INFO;
  101. // end_ntsubauth
  102. //
  103. // Structure to pass a SID_AND_ATTRIBUTES over the network.
  104. //
  105. typedef struct _NETLOGON_SID_AND_ATTRIBUTES {
  106. #if defined(MIDL_PASS) || defined(RPC_SERVER)
  107. PISID Sid;
  108. #else
  109. PSID Sid;
  110. #endif
  111. ULONG Attributes;
  112. } NETLOGON_SID_AND_ATTRIBUTES, *PNETLOGON_SID_AND_ATTRIBUTES;
  113. //
  114. // Values of ParameterControl
  115. //
  116. // (Obsolete: Use the ParameterControl values from ntmsv1_0.h)
  117. #define CLEARTEXT_PASSWORD_ALLOWED 0x02 // Challenge response fields may
  118. // actually be clear text passwords.
  119. //
  120. // Output information to NetLogonSamLogon.
  121. //
  122. typedef enum _NETLOGON_VALIDATION_INFO_CLASS {
  123. NetlogonValidationUasInfo = 1,
  124. NetlogonValidationSamInfo,
  125. NetlogonValidationSamInfo2,
  126. NetlogonValidationGenericInfo,
  127. NetlogonValidationGenericInfo2,
  128. NetlogonValidationSamInfo4
  129. } NETLOGON_VALIDATION_INFO_CLASS;
  130. typedef struct _NETLOGON_VALIDATION_SAM_INFO {
  131. //
  132. // Information retrieved from SAM.
  133. //
  134. OLD_LARGE_INTEGER LogonTime; // 0 for Network logon
  135. OLD_LARGE_INTEGER LogoffTime;
  136. OLD_LARGE_INTEGER KickOffTime;
  137. OLD_LARGE_INTEGER PasswordLastSet; // 0 for Network logon
  138. OLD_LARGE_INTEGER PasswordCanChange; // 0 for Network logon
  139. OLD_LARGE_INTEGER PasswordMustChange; // 0 for Network logon
  140. UNICODE_STRING EffectiveName; // 0 for Network logon
  141. UNICODE_STRING FullName; // 0 for Network logon
  142. UNICODE_STRING LogonScript; // 0 for Network logon
  143. UNICODE_STRING ProfilePath; // 0 for Network logon
  144. UNICODE_STRING HomeDirectory; // 0 for Network logon
  145. UNICODE_STRING HomeDirectoryDrive; // 0 for Network logon
  146. USHORT LogonCount; // 0 for Network logon
  147. USHORT BadPasswordCount; // 0 for Network logon
  148. ULONG UserId;
  149. ULONG PrimaryGroupId;
  150. ULONG GroupCount;
  151. #ifdef MIDL_PASS
  152. [size_is(GroupCount)]
  153. #endif // MIDL_PASS
  154. PGROUP_MEMBERSHIP GroupIds;
  155. //
  156. // Information supplied by the MSV AP/Netlogon service.
  157. //
  158. ULONG UserFlags;
  159. USER_SESSION_KEY UserSessionKey;
  160. UNICODE_STRING LogonServer;
  161. UNICODE_STRING LogonDomainName;
  162. #if defined(MIDL_PASS) || defined(RPC_SERVER)
  163. PISID LogonDomainId;
  164. #else
  165. PSID LogonDomainId;
  166. #endif
  167. ULONG ExpansionRoom[10]; // Put new fields here
  168. } NETLOGON_VALIDATION_SAM_INFO, *PNETLOGON_VALIDATION_SAM_INFO ;
  169. //
  170. // New output information for NetLogonSamLogon. This structure is identical
  171. // to the above structure with some new fields added at the end.
  172. //
  173. typedef struct _NETLOGON_VALIDATION_SAM_INFO2 {
  174. //
  175. // Information retrieved from SAM.
  176. //
  177. OLD_LARGE_INTEGER LogonTime; // 0 for Network logon
  178. OLD_LARGE_INTEGER LogoffTime;
  179. OLD_LARGE_INTEGER KickOffTime;
  180. OLD_LARGE_INTEGER PasswordLastSet; // 0 for Network logon
  181. OLD_LARGE_INTEGER PasswordCanChange; // 0 for Network logon
  182. OLD_LARGE_INTEGER PasswordMustChange; // 0 for Network logon
  183. UNICODE_STRING EffectiveName; // 0 for Network logon
  184. UNICODE_STRING FullName; // 0 for Network logon
  185. UNICODE_STRING LogonScript; // 0 for Network logon
  186. UNICODE_STRING ProfilePath; // 0 for Network logon
  187. UNICODE_STRING HomeDirectory; // 0 for Network logon
  188. UNICODE_STRING HomeDirectoryDrive; // 0 for Network logon
  189. USHORT LogonCount; // 0 for Network logon
  190. USHORT BadPasswordCount; // 0 for Network logon
  191. ULONG UserId;
  192. ULONG PrimaryGroupId;
  193. ULONG GroupCount;
  194. #ifdef MIDL_PASS
  195. [size_is(GroupCount)]
  196. #endif // MIDL_PASS
  197. PGROUP_MEMBERSHIP GroupIds;
  198. //
  199. // Information supplied by the MSV AP/Netlogon service.
  200. //
  201. ULONG UserFlags;
  202. USER_SESSION_KEY UserSessionKey;
  203. UNICODE_STRING LogonServer;
  204. UNICODE_STRING LogonDomainName;
  205. #if defined(MIDL_PASS) || defined(RPC_SERVER)
  206. PISID LogonDomainId;
  207. #else
  208. PSID LogonDomainId;
  209. #endif
  210. ULONG ExpansionRoom[10]; // Put new fields here
  211. //
  212. // The new fields in this structure are a count and a pointer to
  213. // an array of SIDs and attributes.
  214. //
  215. ULONG SidCount;
  216. #ifdef MIDL_PASS
  217. [size_is(SidCount)]
  218. #endif // MIDL_PASS
  219. PNETLOGON_SID_AND_ATTRIBUTES ExtraSids;
  220. } NETLOGON_VALIDATION_SAM_INFO2, *PNETLOGON_VALIDATION_SAM_INFO2 ;
  221. //
  222. // Info level 3 is a version used internally by kerberos. It never appears on the wire.
  223. //
  224. typedef struct _NETLOGON_VALIDATION_SAM_INFO3 {
  225. //
  226. // Information retrieved from SAM.
  227. //
  228. OLD_LARGE_INTEGER LogonTime; // 0 for Network logon
  229. OLD_LARGE_INTEGER LogoffTime;
  230. OLD_LARGE_INTEGER KickOffTime;
  231. OLD_LARGE_INTEGER PasswordLastSet; // 0 for Network logon
  232. OLD_LARGE_INTEGER PasswordCanChange; // 0 for Network logon
  233. OLD_LARGE_INTEGER PasswordMustChange; // 0 for Network logon
  234. UNICODE_STRING EffectiveName; // 0 for Network logon
  235. UNICODE_STRING FullName; // 0 for Network logon
  236. UNICODE_STRING LogonScript; // 0 for Network logon
  237. UNICODE_STRING ProfilePath; // 0 for Network logon
  238. UNICODE_STRING HomeDirectory; // 0 for Network logon
  239. UNICODE_STRING HomeDirectoryDrive; // 0 for Network logon
  240. USHORT LogonCount; // 0 for Network logon
  241. USHORT BadPasswordCount; // 0 for Network logon
  242. ULONG UserId;
  243. ULONG PrimaryGroupId;
  244. ULONG GroupCount;
  245. #ifdef MIDL_PASS
  246. [size_is(GroupCount)]
  247. #endif // MIDL_PASS
  248. PGROUP_MEMBERSHIP GroupIds;
  249. //
  250. // Information supplied by the MSV AP/Netlogon service.
  251. //
  252. ULONG UserFlags;
  253. USER_SESSION_KEY UserSessionKey;
  254. UNICODE_STRING LogonServer;
  255. UNICODE_STRING LogonDomainName;
  256. #if defined(MIDL_PASS) || defined(RPC_SERVER)
  257. PISID LogonDomainId;
  258. #else
  259. PSID LogonDomainId;
  260. #endif
  261. ULONG ExpansionRoom[10]; // Put new fields here
  262. //
  263. // The new fields in this structure are a count and a pointer to
  264. // an array of SIDs and attributes.
  265. //
  266. ULONG SidCount;
  267. #ifdef MIDL_PASS
  268. [size_is(SidCount)]
  269. #endif // MIDL_PASS
  270. PNETLOGON_SID_AND_ATTRIBUTES ExtraSids;
  271. //
  272. // Resource groups. These are present if LOGON_RESOURCE_GROUPS bit is
  273. // set in the user flags
  274. //
  275. #if defined(MIDL_PASS) || defined(RPC_SERVER)
  276. PISID ResourceGroupDomainSid;
  277. #else
  278. PSID ResourceGroupDomainSid;
  279. #endif
  280. ULONG ResourceGroupCount;
  281. #ifdef MIDL_PASS
  282. [size_is(ResourceGroupCount)]
  283. #endif // MIDL_PASS
  284. PGROUP_MEMBERSHIP ResourceGroupIds;
  285. } NETLOGON_VALIDATION_SAM_INFO3, *PNETLOGON_VALIDATION_SAM_INFO3 ;
  286. //
  287. // New output information for NetLogonSamLogon. This structure is identical
  288. // to the NETLOGON_VALIDATION_SAM_INFO2 with some new fields added at the end.
  289. //
  290. // This version was introduced in Whistler.
  291. //
  292. typedef struct _NETLOGON_VALIDATION_SAM_INFO4 {
  293. //
  294. // Information retrieved from SAM.
  295. //
  296. OLD_LARGE_INTEGER LogonTime; // 0 for Network logon
  297. OLD_LARGE_INTEGER LogoffTime;
  298. OLD_LARGE_INTEGER KickOffTime;
  299. OLD_LARGE_INTEGER PasswordLastSet; // 0 for Network logon
  300. OLD_LARGE_INTEGER PasswordCanChange; // 0 for Network logon
  301. OLD_LARGE_INTEGER PasswordMustChange; // 0 for Network logon
  302. UNICODE_STRING EffectiveName; // 0 for Network logon
  303. UNICODE_STRING FullName; // 0 for Network logon
  304. UNICODE_STRING LogonScript; // 0 for Network logon
  305. UNICODE_STRING ProfilePath; // 0 for Network logon
  306. UNICODE_STRING HomeDirectory; // 0 for Network logon
  307. UNICODE_STRING HomeDirectoryDrive; // 0 for Network logon
  308. USHORT LogonCount; // 0 for Network logon
  309. USHORT BadPasswordCount; // 0 for Network logon
  310. ULONG UserId;
  311. ULONG PrimaryGroupId;
  312. ULONG GroupCount;
  313. #ifdef MIDL_PASS
  314. [size_is(GroupCount)]
  315. #endif // MIDL_PASS
  316. PGROUP_MEMBERSHIP GroupIds;
  317. //
  318. // Information supplied by the MSV AP/Netlogon service.
  319. //
  320. ULONG UserFlags;
  321. USER_SESSION_KEY UserSessionKey;
  322. UNICODE_STRING LogonServer;
  323. UNICODE_STRING LogonDomainName;
  324. #if defined(MIDL_PASS) || defined(RPC_SERVER)
  325. PISID LogonDomainId;
  326. #else
  327. PSID LogonDomainId;
  328. #endif
  329. //
  330. // The First two longwords (8 bytes) of ExpansionRoom are reserved for the
  331. // LanManSession Key.
  332. //
  333. #define SAMINFO_LM_SESSION_KEY 0
  334. #define SAMINFO_LM_SESSION_KEY_EXT 1
  335. #define SAMINFO_LM_SESSION_KEY_SIZE (2*sizeof(ULONG))
  336. //
  337. // The third longword (4 bytes) of ExpansionRoom is the user account
  338. // control flag from the account.
  339. //
  340. #define SAMINFO_USER_ACCOUNT_CONTROL 2
  341. #define SAMINFO_USER_ACCOUNT_CONTROL_SIZE sizeof(ULONG)
  342. //
  343. // The fourth longword (4 bytes) of ExpansionRoom is for the status
  344. // returned for subauth users, not from subauth packages (NT5 onwards)
  345. //
  346. #define SAMINFO_SUBAUTH_STATUS 3
  347. #define SAMINFO_SUBAUTH_STATUS_SIZE sizeof(ULONG)
  348. ULONG ExpansionRoom[10]; // Put new fields here
  349. //
  350. // The new fields in this structure are a count and a pointer to
  351. // an array of SIDs and attributes.
  352. //
  353. ULONG SidCount;
  354. #ifdef MIDL_PASS
  355. [size_is(SidCount)]
  356. #endif // MIDL_PASS
  357. PNETLOGON_SID_AND_ATTRIBUTES ExtraSids;
  358. //
  359. // New fields added for version 4 of the structure
  360. //
  361. UNICODE_STRING DnsLogonDomainName; // Dns version of LogonDomainName
  362. UNICODE_STRING Upn; // UPN of the user account
  363. UNICODE_STRING ExpansionString1; // Put new strings here
  364. UNICODE_STRING ExpansionString2; // Put new strings here
  365. UNICODE_STRING ExpansionString3; // Put new strings here
  366. UNICODE_STRING ExpansionString4; // Put new strings here
  367. UNICODE_STRING ExpansionString5; // Put new strings here
  368. UNICODE_STRING ExpansionString6; // Put new strings here
  369. UNICODE_STRING ExpansionString7; // Put new strings here
  370. UNICODE_STRING ExpansionString8; // Put new strings here
  371. UNICODE_STRING ExpansionString9; // Put new strings here
  372. UNICODE_STRING ExpansionString10; // Put new strings here
  373. } NETLOGON_VALIDATION_SAM_INFO4, *PNETLOGON_VALIDATION_SAM_INFO4 ;
  374. // This structure is bogus since it doesn't have a size_is
  375. // Everyone should use the generic info2 structure
  376. typedef struct _NETLOGON_VALIDATION_GENERIC_INFO {
  377. ULONG DataLength;
  378. PUCHAR ValidationData;
  379. } NETLOGON_VALIDATION_GENERIC_INFO, *PNETLOGON_VALIDATION_GENERIC_INFO;
  380. typedef struct _NETLOGON_VALIDATION_GENERIC_INFO2 {
  381. ULONG DataLength;
  382. #ifdef MIDL_PASS
  383. [size_is(DataLength)]
  384. #endif // MIDL_PASS
  385. PUCHAR ValidationData;
  386. } NETLOGON_VALIDATION_GENERIC_INFO2, *PNETLOGON_VALIDATION_GENERIC_INFO2;
  387. //
  388. // S4U Delegation Info
  389. //
  390. typedef struct _S4U_DELEGATION_INFO {
  391. UNICODE_STRING S4U2proxyTarget;
  392. ULONG TransitedListSize;
  393. #ifdef MIDL_PASS
  394. [size_is(TransitedListSize)]
  395. #endif // MIDL_PASS
  396. PUNICODE_STRING S4UTransitedServices;
  397. } S4U_DELEGATION_INFO, * PS4U_DELEGATION_INFO;
  398. //
  399. // Status codes that indicate the password is bad and the call should
  400. // be passed through to the PDC of the domain.
  401. //
  402. #define BAD_PASSWORD( _x ) \
  403. ((_x) == STATUS_WRONG_PASSWORD || \
  404. (_x) == STATUS_PASSWORD_EXPIRED || \
  405. (_x) == STATUS_PASSWORD_MUST_CHANGE || \
  406. (_x) == STATUS_ACCOUNT_LOCKED_OUT )
  407. //
  408. // Error status codes from the PDC that indicate that the bad password
  409. // count should be zeroed locally on the BDC.
  410. //
  411. #define ZERO_BAD_PWD_COUNT( _x ) \
  412. ((_x) == STATUS_PASSWORD_EXPIRED || \
  413. (_x) == STATUS_PASSWORD_MUST_CHANGE )
  414. //
  415. // The actual logon and logoff routines.
  416. //
  417. // The following 2 procedure definitions must match
  418. NTSTATUS
  419. I_NetLogonSamLogon(
  420. IN LPWSTR LogonServer OPTIONAL,
  421. IN LPWSTR ComputerName OPTIONAL,
  422. IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
  423. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
  424. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  425. IN LPBYTE LogonInformation,
  426. IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
  427. OUT LPBYTE * ValidationInformation,
  428. OUT PBOOLEAN Authoritative
  429. );
  430. typedef NTSTATUS
  431. (*PNETLOGON_SAM_LOGON_PROCEDURE)(
  432. IN LPWSTR LogonServer OPTIONAL,
  433. IN LPWSTR ComputerName OPTIONAL,
  434. IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
  435. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
  436. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  437. IN LPBYTE LogonInformation,
  438. IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
  439. OUT LPBYTE * ValidationInformation,
  440. OUT PBOOLEAN Authoritative
  441. );
  442. //
  443. // Values of ExtraFlags
  444. //
  445. // For OS earlier that WIN 2K. This field didn't exist.
  446. //
  447. // A WIN 2K client always passes zero and ignores the return.
  448. // A WIN 2K server always returns what it is passed.
  449. //
  450. // A whistler client can pass the NETLOGON_SUPPORTS_CROSS_FOREST bits and ignores the return.
  451. // A whistler server always returns what it is passed.
  452. //
  453. // In all cases, the flags correspond to the hop at hand. Each hop computes which flags it
  454. // want to pass to the next hop. It will only set bits that it understands.
  455. //
  456. // Flags introduced with NETLOGON_SUPPORTS_CROSS_FOREST
  457. #define NL_EXFLAGS_EXPEDITE_TO_ROOT 0x0001 // Pass this request to DC at root of forest
  458. #define NL_EXFLAGS_CROSS_FOREST_HOP 0x0002 // Request is first hop over cross forest trust TDO
  459. NTSTATUS
  460. I_NetLogonSamLogonEx (
  461. IN PVOID ContextHandle,
  462. IN LPWSTR LogonServer OPTIONAL,
  463. IN LPWSTR ComputerName OPTIONAL,
  464. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  465. IN LPBYTE LogonInformation,
  466. IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
  467. OUT LPBYTE * ValidationInformation,
  468. OUT PBOOLEAN Authoritative,
  469. IN OUT PULONG ExtraFlags,
  470. OUT PBOOLEAN RpcFailed
  471. );
  472. NTSTATUS
  473. I_NetLogonSamLogonWithFlags (
  474. IN LPWSTR LogonServer OPTIONAL,
  475. IN LPWSTR ComputerName OPTIONAL,
  476. IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
  477. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
  478. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  479. IN LPBYTE LogonInformation,
  480. IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
  481. OUT LPBYTE * ValidationInformation,
  482. OUT PBOOLEAN Authoritative,
  483. IN OUT PULONG ExtraFlags
  484. );
  485. // The following 2 procedure definitions must match
  486. NTSTATUS
  487. I_NetLogonSamLogoff (
  488. IN LPWSTR LogonServer OPTIONAL,
  489. IN LPWSTR ComputerName OPTIONAL,
  490. IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
  491. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
  492. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  493. IN LPBYTE LogonInformation
  494. );
  495. typedef NTSTATUS
  496. (*PNETLOGON_SAM_LOGOFF_PROCEDURE) (
  497. IN LPWSTR LogonServer OPTIONAL,
  498. IN LPWSTR ComputerName OPTIONAL,
  499. IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
  500. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
  501. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  502. IN LPBYTE LogonInformation
  503. );
  504. //
  505. // Actual logon/logoff routines for Cairo
  506. //
  507. NET_API_STATUS
  508. NetlogonInitialize(
  509. PVOID Context
  510. );
  511. NTSTATUS
  512. NetlogonSamLogon (
  513. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  514. IN LPBYTE LogonInformation,
  515. IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
  516. OUT LPBYTE *ValidationInformation,
  517. OUT PBOOLEAN Authoritative
  518. );
  519. //
  520. // Routine to get a list of NT DC's in the specified domain.
  521. //
  522. NET_API_STATUS NET_API_FUNCTION
  523. I_NetGetDCList (
  524. IN LPWSTR ServerName OPTIONAL,
  525. IN LPWSTR TrustedDomainName,
  526. OUT PULONG DCCount,
  527. OUT PUNICODE_STRING * DCNames
  528. );
  529. //
  530. // Validation routine which lives in msv1_0.dll
  531. //
  532. NTSTATUS
  533. MsvSamValidate (
  534. IN SAM_HANDLE DomainHandle,
  535. IN BOOLEAN UasCompatibilityRequired,
  536. IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType,
  537. IN PUNICODE_STRING LogonServer,
  538. IN PUNICODE_STRING LogonDomainName,
  539. IN PSID LogonDomainId,
  540. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  541. IN PVOID LogonInformation,
  542. IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
  543. OUT PVOID * ValidationInformation,
  544. OUT PBOOLEAN Authoritative,
  545. OUT PBOOLEAN BadPasswordCountZeroed,
  546. IN DWORD AccountsToTry
  547. );
  548. //
  549. // Routine to get running number of logon attempts which lives in msv1_0.dll
  550. //
  551. ULONG
  552. MsvGetLogonAttemptCount (
  553. VOID
  554. );
  555. // Values for AccountsToTry
  556. #define MSVSAM_SPECIFIED 0x01 // Try specified account
  557. #define MSVSAM_GUEST 0x02 // Try guest account
  558. NTSTATUS
  559. MsvSamLogoff (
  560. IN SAM_HANDLE DomainHandle,
  561. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  562. IN PVOID LogonInformation
  563. );
  564. // begin_ntsubauth
  565. // Values for Flags
  566. #define MSV1_0_PASSTHRU 0x01
  567. #define MSV1_0_GUEST_LOGON 0x02
  568. NTSTATUS NTAPI
  569. Msv1_0SubAuthenticationRoutine(
  570. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  571. IN PVOID LogonInformation,
  572. IN ULONG Flags,
  573. IN PUSER_ALL_INFORMATION UserAll,
  574. OUT PULONG WhichFields,
  575. OUT PULONG UserFlags,
  576. OUT PBOOLEAN Authoritative,
  577. OUT PLARGE_INTEGER LogoffTime,
  578. OUT PLARGE_INTEGER KickoffTime
  579. );
  580. typedef struct _MSV1_0_VALIDATION_INFO {
  581. LARGE_INTEGER LogoffTime;
  582. LARGE_INTEGER KickoffTime;
  583. UNICODE_STRING LogonServer;
  584. UNICODE_STRING LogonDomainName;
  585. USER_SESSION_KEY SessionKey;
  586. BOOLEAN Authoritative;
  587. ULONG UserFlags;
  588. ULONG WhichFields;
  589. ULONG UserId;
  590. } MSV1_0_VALIDATION_INFO, *PMSV1_0_VALIDATION_INFO;
  591. // values for WhichFields
  592. #define MSV1_0_VALIDATION_LOGOFF_TIME 0x00000001
  593. #define MSV1_0_VALIDATION_KICKOFF_TIME 0x00000002
  594. #define MSV1_0_VALIDATION_LOGON_SERVER 0x00000004
  595. #define MSV1_0_VALIDATION_LOGON_DOMAIN 0x00000008
  596. #define MSV1_0_VALIDATION_SESSION_KEY 0x00000010
  597. #define MSV1_0_VALIDATION_USER_FLAGS 0x00000020
  598. #define MSV1_0_VALIDATION_USER_ID 0x00000040
  599. // legal values for ActionsPerformed
  600. #define MSV1_0_SUBAUTH_ACCOUNT_DISABLED 0x00000001
  601. #define MSV1_0_SUBAUTH_PASSWORD 0x00000002
  602. #define MSV1_0_SUBAUTH_WORKSTATIONS 0x00000004
  603. #define MSV1_0_SUBAUTH_LOGON_HOURS 0x00000008
  604. #define MSV1_0_SUBAUTH_ACCOUNT_EXPIRY 0x00000010
  605. #define MSV1_0_SUBAUTH_PASSWORD_EXPIRY 0x00000020
  606. #define MSV1_0_SUBAUTH_ACCOUNT_TYPE 0x00000040
  607. #define MSV1_0_SUBAUTH_LOCKOUT 0x00000080
  608. NTSTATUS NTAPI
  609. Msv1_0SubAuthenticationRoutineEx(
  610. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  611. IN PVOID LogonInformation,
  612. IN ULONG Flags,
  613. IN PUSER_ALL_INFORMATION UserAll,
  614. IN SAM_HANDLE UserHandle,
  615. IN OUT PMSV1_0_VALIDATION_INFO ValidationInfo,
  616. OUT PULONG ActionsPerformed
  617. );
  618. NTSTATUS NTAPI
  619. Msv1_0SubAuthenticationRoutineGeneric(
  620. IN PVOID SubmitBuffer,
  621. IN ULONG SubmitBufferLength,
  622. OUT PULONG ReturnBufferLength,
  623. OUT PVOID *ReturnBuffer
  624. );
  625. NTSTATUS NTAPI
  626. Msv1_0SubAuthenticationFilter(
  627. IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
  628. IN PVOID LogonInformation,
  629. IN ULONG Flags,
  630. IN PUSER_ALL_INFORMATION UserAll,
  631. OUT PULONG WhichFields,
  632. OUT PULONG UserFlags,
  633. OUT PBOOLEAN Authoritative,
  634. OUT PLARGE_INTEGER LogoffTime,
  635. OUT PLARGE_INTEGER KickoffTime
  636. );
  637. // end_ntsubauth
  638. #endif // __LOGONMSV_H__