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.

438 lines
13 KiB

  1. /*++
  2. Copyright (c) 1987-1991 Microsoft Corporation
  3. Module Name:
  4. ssi.h
  5. Abstract:
  6. Definition of Netlogon service APIs and structures used for SAM database
  7. replication.
  8. This file is shared by the Netlogon service and the XACT server.
  9. Author:
  10. Cliff Van Dyke (cliffv) 27-Jun-1991
  11. Environment:
  12. User mode only.
  13. Contains NT-specific code.
  14. Requires ANSI C extensions: slash-slash comments, long external names.
  15. Revision History:
  16. 27-Jun-1991 (cliffv)
  17. Ported from LanMan 2.1.
  18. 04-Apr-1992 (madana)
  19. Added support for LSA replication.
  20. --*/
  21. #ifndef _NET_SSI_H_
  22. #define _NET_SSI_H_
  23. //**************************************************************
  24. //
  25. // Data structure template - AUTHENTICATION
  26. //
  27. // ***************************************************************//
  28. typedef struct _NETLOGON_VALIDATION_UAS_INFO {
  29. #ifdef MIDL_PASS
  30. [string] wchar_t * usrlog1_eff_name;
  31. #else // MIDL_PASS
  32. LPWSTR usrlog1_eff_name;
  33. #endif // MIDL_PASS
  34. DWORD usrlog1_priv;
  35. DWORD usrlog1_auth_flags;
  36. DWORD usrlog1_num_logons;
  37. DWORD usrlog1_bad_pw_count;
  38. DWORD usrlog1_last_logon;
  39. DWORD usrlog1_last_logoff;
  40. DWORD usrlog1_logoff_time;
  41. DWORD usrlog1_kickoff_time;
  42. DWORD usrlog1_password_age;
  43. DWORD usrlog1_pw_can_change;
  44. DWORD usrlog1_pw_must_change;
  45. #ifdef MIDL_PASS
  46. [string] wchar_t * usrlog1_computer;
  47. [string] wchar_t * usrlog1_domain;
  48. [string] wchar_t * usrlog1_script_path;
  49. #else // MIDL_PASS
  50. LPWSTR usrlog1_computer;
  51. LPWSTR usrlog1_domain;
  52. LPWSTR usrlog1_script_path;
  53. #endif // MIDL_PASS
  54. DWORD usrlog1_reserved1;
  55. } NETLOGON_VALIDATION_UAS_INFO, *PNETLOGON_VALIDATION_UAS_INFO ;
  56. typedef struct _NETLOGON_LOGOFF_UAS_INFO {
  57. DWORD Duration;
  58. USHORT LogonCount;
  59. } NETLOGON_LOGOFF_UAS_INFORMATION, *PNETLOGON_LOGOFF_UAS_INFO;
  60. // ***************************************************************
  61. //
  62. // Function prototypes - AUTHENTICATION
  63. //
  64. // ***************************************************************
  65. NTSTATUS
  66. I_NetServerReqChallenge(
  67. IN LPWSTR PrimaryName OPTIONAL,
  68. IN LPWSTR ComputerName,
  69. IN PNETLOGON_CREDENTIAL ClientChallenge,
  70. OUT PNETLOGON_CREDENTIAL ServerChallenge
  71. );
  72. NTSTATUS
  73. I_NetServerAuthenticate(
  74. IN LPWSTR PrimaryName OPTIONAL,
  75. IN LPWSTR AccountName,
  76. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  77. IN LPWSTR ComputerName,
  78. IN PNETLOGON_CREDENTIAL ClientCredential,
  79. OUT PNETLOGON_CREDENTIAL ServerCredential
  80. );
  81. NTSTATUS
  82. I_NetServerAuthenticate2(
  83. IN LPWSTR PrimaryName OPTIONAL,
  84. IN LPWSTR AccountName,
  85. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  86. IN LPWSTR ComputerName,
  87. IN PNETLOGON_CREDENTIAL ClientCredential,
  88. OUT PNETLOGON_CREDENTIAL ServerCredential,
  89. IN OUT PULONG NegotiatedFlags
  90. );
  91. NTSTATUS
  92. I_NetServerAuthenticate3(
  93. IN LPWSTR PrimaryName OPTIONAL,
  94. IN LPWSTR AccountName,
  95. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  96. IN LPWSTR ComputerName,
  97. IN PNETLOGON_CREDENTIAL ClientCredential,
  98. OUT PNETLOGON_CREDENTIAL ServerCredential,
  99. IN OUT PULONG NegotiatedFlags,
  100. OUT PULONG AccountRid
  101. );
  102. //
  103. // Values of I_NetServerAuthenticate2 NegotiatedFlags
  104. //
  105. #define NETLOGON_SUPPORTS_ACCOUNT_LOCKOUT 0x00000001
  106. #define NETLOGON_SUPPORTS_PERSISTENT_BDC 0x00000002
  107. #define NETLOGON_SUPPORTS_RC4_ENCRYPTION 0x00000004
  108. #define NETLOGON_SUPPORTS_PROMOTION_COUNT 0x00000008
  109. #define NETLOGON_SUPPORTS_BDC_CHANGELOG 0x00000010
  110. #define NETLOGON_SUPPORTS_FULL_SYNC_RESTART 0x00000020
  111. #define NETLOGON_SUPPORTS_MULTIPLE_SIDS 0x00000040
  112. #define NETLOGON_SUPPORTS_REDO 0x00000080
  113. //
  114. // For NT 3.51, the mask was 0xFF.
  115. //
  116. #define NETLOGON_SUPPORTS_NT351_MASK 0x000000FF
  117. #define NETLOGON_SUPPORTS_REFUSE_CHANGE_PWD 0x00000100
  118. //
  119. // For NT 4.0, the mask was 0x1FF.
  120. // For NT 4 SP 4, the machine might have NETLOGON_SUPPORTS_AUTH_RPC or'd in
  121. //
  122. #define NETLOGON_SUPPORTS_NT4_MASK 0x400001FF
  123. #define NETLOGON_SUPPORTS_PDC_PASSWORD 0x00000200
  124. #define NETLOGON_SUPPORTS_GENERIC_PASSTHRU 0x00000400
  125. #define NETLOGON_SUPPORTS_CONCURRENT_RPC 0x00000800
  126. #define NETLOGON_SUPPORTS_AVOID_SAM_REPL 0x00001000
  127. #define NETLOGON_SUPPORTS_AVOID_LSA_REPL 0x00002000
  128. #define NETLOGON_SUPPORTS_STRONG_KEY 0x00004000 // Added after NT 5 Beta 2
  129. #define NETLOGON_SUPPORTS_TRANSITIVE 0x00008000 // Added after NT 5 Beta 2
  130. #define NETLOGON_SUPPORTS_DNS_DOMAIN_TRUST 0x00010000
  131. #define NETLOGON_SUPPORTS_PASSWORD_SET_2 0x00020000
  132. #define NETLOGON_SUPPORTS_GET_DOMAIN_INFO 0x00040000
  133. #define NETLOGON_SUPPORTS_LSA_AUTH_RPC 0x20000000 // Added after NT 5 Beta 2
  134. #define NETLOGON_SUPPORTS_AUTH_RPC 0x40000000
  135. //
  136. // For Windows 2000, the mask was 0x6007FFFF
  137. #define NETLOGON_SUPPORTS_WIN2000_MASK 0x6007FFFF
  138. //
  139. // Masks added after Windows 2000
  140. //
  141. #define NETLOGON_SUPPORTS_CROSS_FOREST 0x00080000 // Added for Whistler
  142. #define NETLOGON_SUPPORTS_NT4EMULATOR_NEUTRALIZER 0x00100000 // Added for Whistler
  143. //
  144. // Mask of bits always supported by current build (regardless of options)
  145. //
  146. #define NETLOGON_SUPPORTS_MASK ( \
  147. NETLOGON_SUPPORTS_ACCOUNT_LOCKOUT | \
  148. NETLOGON_SUPPORTS_PERSISTENT_BDC | \
  149. NETLOGON_SUPPORTS_RC4_ENCRYPTION | \
  150. NETLOGON_SUPPORTS_PROMOTION_COUNT | \
  151. NETLOGON_SUPPORTS_BDC_CHANGELOG | \
  152. NETLOGON_SUPPORTS_FULL_SYNC_RESTART | \
  153. NETLOGON_SUPPORTS_MULTIPLE_SIDS | \
  154. NETLOGON_SUPPORTS_REDO | \
  155. NETLOGON_SUPPORTS_REFUSE_CHANGE_PWD | \
  156. NETLOGON_SUPPORTS_PDC_PASSWORD | \
  157. NETLOGON_SUPPORTS_GENERIC_PASSTHRU | \
  158. NETLOGON_SUPPORTS_CONCURRENT_RPC | \
  159. NETLOGON_SUPPORTS_TRANSITIVE | \
  160. NETLOGON_SUPPORTS_DNS_DOMAIN_TRUST | \
  161. NETLOGON_SUPPORTS_PASSWORD_SET_2 | \
  162. NETLOGON_SUPPORTS_GET_DOMAIN_INFO | \
  163. NETLOGON_SUPPORTS_CROSS_FOREST )
  164. NTSTATUS
  165. I_NetServerPasswordSet(
  166. IN LPWSTR PrimaryName OPTIONAL,
  167. IN LPWSTR AccountName,
  168. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  169. IN LPWSTR ComputerName,
  170. IN PNETLOGON_AUTHENTICATOR Authenticator,
  171. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  172. IN PENCRYPTED_LM_OWF_PASSWORD UasNewPassword
  173. );
  174. //
  175. // Values of QueryLevel
  176. #define NETLOGON_QUERY_DOMAIN_INFO 1
  177. #define NETLOGON_QUERY_LSA_POLICY_INFO 2
  178. NTSTATUS
  179. I_NetLogonGetDomainInfo(
  180. IN LPWSTR ServerName,
  181. IN LPWSTR ComputerName,
  182. IN PNETLOGON_AUTHENTICATOR Authenticator,
  183. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  184. IN DWORD QueryLevel,
  185. IN LPBYTE InBuffer,
  186. OUT LPBYTE *OutBuffer
  187. );
  188. NET_API_STATUS NET_API_FUNCTION
  189. I_NetLogonUasLogon (
  190. IN LPWSTR UserName,
  191. IN LPWSTR Workstation,
  192. OUT PNETLOGON_VALIDATION_UAS_INFO *ValidationInformation
  193. );
  194. NET_API_STATUS
  195. I_NetLogonUasLogoff (
  196. IN LPWSTR UserName,
  197. IN LPWSTR Workstation,
  198. OUT PNETLOGON_LOGOFF_UAS_INFO LogoffInformation
  199. );
  200. // **************************************************************
  201. //
  202. // Special values and constants - AUTHENTICATION
  203. //
  204. // **************************************************************
  205. // **************************************************************
  206. //
  207. // Data structure template - UAS/SAM REPLICATION
  208. //
  209. // **************************************************************
  210. typedef struct _UAS_INFO_0 {
  211. CHAR ComputerName[LM20_CNLEN+1];
  212. ULONG TimeCreated;
  213. ULONG SerialNumber;
  214. } UAS_INFO_0, *PUAS_INFO_0 ;
  215. // **************************************************************
  216. //
  217. // Function prototypes - UAS/SAM REPLICATION
  218. //
  219. // **************************************************************
  220. NET_API_STATUS NET_API_FUNCTION
  221. I_NetAccountDeltas (
  222. IN LPWSTR primaryname,
  223. IN LPWSTR computername,
  224. IN PNETLOGON_AUTHENTICATOR authenticator,
  225. OUT PNETLOGON_AUTHENTICATOR ret_auth,
  226. IN PUAS_INFO_0 record_id,
  227. IN DWORD count,
  228. IN DWORD level,
  229. OUT LPBYTE buffer,
  230. IN DWORD buffer_len,
  231. OUT PULONG entries_read,
  232. OUT PULONG total_entries,
  233. OUT PUAS_INFO_0 next_record_id
  234. );
  235. NET_API_STATUS NET_API_FUNCTION
  236. I_NetAccountSync (
  237. IN LPWSTR primaryname,
  238. IN LPWSTR computername,
  239. IN PNETLOGON_AUTHENTICATOR authenticator,
  240. OUT PNETLOGON_AUTHENTICATOR ret_auth,
  241. IN DWORD reference,
  242. IN DWORD level,
  243. OUT LPBYTE buffer,
  244. IN DWORD buffer_len,
  245. OUT PULONG entries_read,
  246. OUT PULONG total_entries,
  247. OUT PULONG next_reference,
  248. OUT PUAS_INFO_0 last_record_id
  249. );
  250. typedef enum _NETLOGON_DELTA_TYPE {
  251. AddOrChangeDomain = 1,
  252. AddOrChangeGroup,
  253. DeleteGroup,
  254. RenameGroup,
  255. AddOrChangeUser,
  256. DeleteUser,
  257. RenameUser,
  258. ChangeGroupMembership,
  259. AddOrChangeAlias,
  260. DeleteAlias,
  261. RenameAlias,
  262. ChangeAliasMembership,
  263. AddOrChangeLsaPolicy,
  264. AddOrChangeLsaTDomain,
  265. DeleteLsaTDomain,
  266. AddOrChangeLsaAccount,
  267. DeleteLsaAccount,
  268. AddOrChangeLsaSecret,
  269. DeleteLsaSecret,
  270. // The following deltas require NETLOGON_SUPPORTS_BDC_CHANGELOG to be
  271. // negotiated.
  272. DeleteGroupByName,
  273. DeleteUserByName,
  274. SerialNumberSkip,
  275. DummyChangeLogEntry
  276. } NETLOGON_DELTA_TYPE;
  277. //
  278. // Group and User account used for SSI.
  279. //
  280. #define SSI_ACCOUNT_NAME_POSTFIX L"$"
  281. #define SSI_ACCOUNT_NAME_POSTFIX_CHAR L'$'
  282. #define SSI_ACCOUNT_NAME_POSTFIX_LENGTH 1
  283. #define SSI_ACCOUNT_NAME_LENGTH (CNLEN + SSI_ACCOUNT_NAME_POSTFIX_LENGTH)
  284. #define SSI_SERVER_GROUP_W L"SERVERS"
  285. //
  286. // Structure to pass an encrypted password over the wire. The Length is the
  287. // length of the password, which should be placed at the end of the buffer.
  288. //
  289. #define NL_MAX_PASSWORD_LENGTH 256
  290. typedef struct _NL_TRUST_PASSWORD {
  291. WCHAR Buffer[NL_MAX_PASSWORD_LENGTH];
  292. ULONG Length;
  293. } NL_TRUST_PASSWORD, *PNL_TRUST_PASSWORD;
  294. //
  295. // Structure to be prefixed before the password in the Buffer of NL_TRUST_PASSWORD
  296. // structure passed over the wire. It will be used to distinguish between diferent
  297. // versions of information passed in the buffer. Begining with RC1 NT5, the presence
  298. // of the structure in the buffer and the equality of PasswordVersionPresent to
  299. // PASSWORD_VERSION_PRESENT indicates that the password version number is present
  300. // and is stored in PasswordVersionNumber; the value of ReservedField is set to 0.
  301. // RC0 NT5 clients will generate random numbers in place of NL_PASSWORD_VERSION; it
  302. // is highly unlikely that they will generate PASSWORD_VERSION_PRESENT sequence of
  303. // bits in place where the PasswordVersionPresent would be present. This (very week)
  304. // uncertainty will exist only between RC0 NT5 and RC1 NT5 machines. A server running
  305. // RC1 NT5 will check the PasswordVersionPresent field only for RC0 NT5 and higher
  306. // clients. The ReservedField will be used in future versions to indicate the version
  307. // of the information stored in the buffer.
  308. //
  309. #define PASSWORD_VERSION_NUMBER_PRESENT 0x02231968
  310. typedef struct _NL_PASSWORD_VERSION {
  311. DWORD ReservedField;
  312. DWORD PasswordVersionNumber;
  313. DWORD PasswordVersionPresent;
  314. } NL_PASSWORD_VERSION, *PNL_PASSWORD_VERSION;
  315. NTSTATUS
  316. I_NetServerPasswordSet2(
  317. IN LPWSTR PrimaryName OPTIONAL,
  318. IN LPWSTR AccountName,
  319. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  320. IN LPWSTR ComputerName,
  321. IN PNETLOGON_AUTHENTICATOR Authenticator,
  322. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  323. IN PNL_TRUST_PASSWORD NewPassword
  324. );
  325. NTSTATUS
  326. I_NetServerPasswordGet(
  327. IN LPWSTR PrimaryName,
  328. IN LPWSTR AccountName,
  329. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  330. IN LPWSTR ComputerName,
  331. IN PNETLOGON_AUTHENTICATOR Authenticator,
  332. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  333. OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
  334. );
  335. NTSTATUS
  336. I_NetServerTrustPasswordsGet(
  337. IN LPWSTR TrustedDcName,
  338. IN LPWSTR AccountName,
  339. IN NETLOGON_SECURE_CHANNEL_TYPE AccountType,
  340. IN LPWSTR ComputerName,
  341. IN PNETLOGON_AUTHENTICATOR Authenticator,
  342. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  343. OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNewOwfPassword,
  344. OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedOldOwfPassword
  345. );
  346. NTSTATUS
  347. I_NetLogonSendToSam(
  348. IN LPWSTR PrimaryName,
  349. IN LPWSTR ComputerName,
  350. IN PNETLOGON_AUTHENTICATOR Authenticator,
  351. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  352. IN LPBYTE Buffer,
  353. IN ULONG BufferSize
  354. );
  355. //
  356. // Only define this API if the caller has #included the pre-requisite ntlsa.h
  357. #ifdef _NTLSA_
  358. NTSTATUS
  359. I_NetGetForestTrustInformation (
  360. IN LPWSTR ServerName OPTIONAL,
  361. IN LPWSTR ComputerName,
  362. IN PNETLOGON_AUTHENTICATOR Authenticator,
  363. OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator,
  364. IN DWORD Flags,
  365. OUT PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo
  366. );
  367. #endif // _NTLSA_
  368. #endif // _NET_SSI_H_