rpc_netlogon.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. /*
  2. Unix SMB/Netbios implementation.
  3. Version 1.9.
  4. SMB parameters and setup
  5. Copyright (C) Andrew Tridgell 1992-1997
  6. Copyright (C) Luke Kenneth Casson Leighton 1996-1997
  7. Copyright (C) Paul Ashton 1997
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20. #ifndef _RPC_NETLOGON_H /* _RPC_NETLOGON_H */
  21. #define _RPC_NETLOGON_H
  22. /* NETLOGON pipe */
  23. #define NET_REQCHAL 0x04
  24. #define NET_SRVPWSET 0x06
  25. #define NET_SAMLOGON 0x02
  26. #define NET_SAMLOGOFF 0x03
  27. #define NET_AUTH2 0x0f
  28. #define NET_LOGON_CTRL2 0x0e
  29. #define NET_TRUST_DOM_LIST 0x13
  30. /* Secure Channel types. used in NetrServerAuthenticate negotiation */
  31. #define SEC_CHAN_WKSTA 2
  32. #define SEC_CHAN_DOMAIN 4
  33. #if 0
  34. /* JRATEST.... */
  35. /* NET_USER_INFO_2 */
  36. typedef struct net_user_info_2
  37. {
  38. uint32 ptr_user_info;
  39. NTTIME logon_time; /* logon time */
  40. NTTIME logoff_time; /* logoff time */
  41. NTTIME kickoff_time; /* kickoff time */
  42. NTTIME pass_last_set_time; /* password last set time */
  43. NTTIME pass_can_change_time; /* password can change time */
  44. NTTIME pass_must_change_time; /* password must change time */
  45. ....
  46. uint32 user_id; /* User ID */
  47. uint32 group_id; /* Group ID */
  48. ....
  49. uint32 num_groups2; /* num groups */
  50. DOM_GID gids[LSA_MAX_GROUPS]; /* group info */
  51. UNIHDR hdr_logon_srv; /* logon server unicode string header */
  52. UNISTR2 uni_logon_dom; /* logon domain unicode string */
  53. DOM_SID2 dom_sid;
  54. } NET_USER_INFO_2;
  55. /* ! JRATEST.... */
  56. #endif
  57. /* NET_USER_INFO_3 */
  58. typedef struct net_user_info_3
  59. {
  60. uint32 ptr_user_info;
  61. NTTIME logon_time; /* logon time */
  62. NTTIME logoff_time; /* logoff time */
  63. NTTIME kickoff_time; /* kickoff time */
  64. NTTIME pass_last_set_time; /* password last set time */
  65. NTTIME pass_can_change_time; /* password can change time */
  66. NTTIME pass_must_change_time; /* password must change time */
  67. UNIHDR hdr_user_name; /* username unicode string header */
  68. UNIHDR hdr_full_name; /* user's full name unicode string header */
  69. UNIHDR hdr_logon_script; /* logon script unicode string header */
  70. UNIHDR hdr_profile_path; /* profile path unicode string header */
  71. UNIHDR hdr_home_dir; /* home directory unicode string header */
  72. UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
  73. uint16 logon_count; /* logon count */
  74. uint16 bad_pw_count; /* bad password count */
  75. uint32 user_id; /* User ID */
  76. uint32 group_id; /* Group ID */
  77. uint32 num_groups; /* num groups */
  78. uint32 buffer_groups; /* undocumented buffer pointer to groups. */
  79. uint32 user_flgs; /* user flags */
  80. uint8 user_sess_key[16]; /* unused user session key */
  81. UNIHDR hdr_logon_srv; /* logon server unicode string header */
  82. UNIHDR hdr_logon_dom; /* logon domain unicode string header */
  83. uint32 buffer_dom_id; /* undocumented logon domain id pointer */
  84. uint8 padding[40]; /* unused padding bytes. expansion room */
  85. uint32 num_other_sids; /* 0 - num_sids */
  86. uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
  87. UNISTR2 uni_user_name; /* username unicode string */
  88. UNISTR2 uni_full_name; /* user's full name unicode string */
  89. UNISTR2 uni_logon_script; /* logon script unicode string */
  90. UNISTR2 uni_profile_path; /* profile path unicode string */
  91. UNISTR2 uni_home_dir; /* home directory unicode string */
  92. UNISTR2 uni_dir_drive; /* home directory drive unicode string */
  93. uint32 num_groups2; /* num groups */
  94. DOM_GID gids[LSA_MAX_GROUPS]; /* group info */
  95. UNISTR2 uni_logon_srv; /* logon server unicode string */
  96. UNISTR2 uni_logon_dom; /* logon domain unicode string */
  97. DOM_SID2 dom_sid; /* domain SID */
  98. DOM_SID2 other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */
  99. } NET_USER_INFO_3;
  100. /********************************************************
  101. Logon Control Query
  102. query_level 0x1 - pdc status
  103. query_level 0x3 - number of logon attempts.
  104. ********************************************************/
  105. /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2*/
  106. typedef struct net_q_logon_ctrl2_info
  107. {
  108. uint32 ptr; /* undocumented buffer pointer */
  109. UNISTR2 uni_server_name; /* server name, starting with two '\'s */
  110. uint32 function_code; /* 0x1 */
  111. uint32 query_level; /* 0x1, 0x3 */
  112. uint32 switch_value; /* 0x1 */
  113. } NET_Q_LOGON_CTRL2;
  114. /* NETLOGON_INFO_1 - pdc status info, i presume */
  115. typedef struct netlogon_1_info
  116. {
  117. uint32 flags; /* 0x0 - undocumented */
  118. uint32 pdc_status; /* 0x0 - undocumented */
  119. } NETLOGON_INFO_1;
  120. /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
  121. typedef struct netlogon_2_info
  122. {
  123. uint32 flags; /* 0x0 - undocumented */
  124. uint32 pdc_status; /* 0x0 - undocumented */
  125. uint32 ptr_trusted_dc_name; /* pointer to trusted domain controller name */
  126. uint32 tc_status; /* 0x051f - ERROR_NO_LOGON_SERVERS */
  127. UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
  128. } NETLOGON_INFO_2;
  129. /* NETLOGON_INFO_3 - logon status info, i presume */
  130. typedef struct netlogon_3_info
  131. {
  132. uint32 flags; /* 0x0 - undocumented */
  133. uint32 logon_attempts; /* number of logon attempts */
  134. uint32 reserved_1; /* 0x0 - undocumented */
  135. uint32 reserved_2; /* 0x0 - undocumented */
  136. uint32 reserved_3; /* 0x0 - undocumented */
  137. uint32 reserved_4; /* 0x0 - undocumented */
  138. uint32 reserved_5; /* 0x0 - undocumented */
  139. } NETLOGON_INFO_3;
  140. /*******************************************************
  141. Logon Control Response
  142. switch_value is same as query_level in request
  143. *******************************************************/
  144. /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
  145. typedef struct net_r_logon_ctrl2_info
  146. {
  147. uint32 switch_value; /* 0x1, 0x3 */
  148. uint32 ptr;
  149. union
  150. {
  151. NETLOGON_INFO_1 info1;
  152. NETLOGON_INFO_2 info2;
  153. NETLOGON_INFO_3 info3;
  154. } logon;
  155. uint32 status; /* return code */
  156. } NET_R_LOGON_CTRL2;
  157. /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
  158. typedef struct net_q_trust_dom_info
  159. {
  160. uint32 ptr; /* undocumented buffer pointer */
  161. UNISTR2 uni_server_name; /* server name, starting with two '\'s */
  162. uint32 function_code; /* 0x31 */
  163. } NET_Q_TRUST_DOM_LIST;
  164. #define MAX_TRUST_DOMS 1
  165. /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
  166. typedef struct net_r_trust_dom_info
  167. {
  168. UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
  169. uint32 status; /* return code */
  170. } NET_R_TRUST_DOM_LIST;
  171. /* NEG_FLAGS */
  172. typedef struct neg_flags_info
  173. {
  174. uint32 neg_flags; /* negotiated flags */
  175. } NEG_FLAGS;
  176. /* NET_Q_REQ_CHAL */
  177. typedef struct net_q_req_chal_info
  178. {
  179. uint32 undoc_buffer; /* undocumented buffer pointer */
  180. UNISTR2 uni_logon_srv; /* logon server unicode string */
  181. UNISTR2 uni_logon_clnt; /* logon client unicode string */
  182. DOM_CHAL clnt_chal; /* client challenge */
  183. } NET_Q_REQ_CHAL;
  184. /* NET_R_REQ_CHAL */
  185. typedef struct net_r_req_chal_info
  186. {
  187. DOM_CHAL srv_chal; /* server challenge */
  188. uint32 status; /* return code */
  189. } NET_R_REQ_CHAL;
  190. /* NET_Q_AUTH_2 */
  191. typedef struct net_q_auth2_info
  192. {
  193. DOM_LOG_INFO clnt_id; /* client identification info */
  194. DOM_CHAL clnt_chal; /* client-calculated credentials */
  195. NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
  196. } NET_Q_AUTH_2;
  197. /* NET_R_AUTH_2 */
  198. typedef struct net_r_auth2_info
  199. {
  200. DOM_CHAL srv_chal; /* server-calculated credentials */
  201. NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
  202. uint32 status; /* return code */
  203. } NET_R_AUTH_2;
  204. /* NET_Q_SRV_PWSET */
  205. typedef struct net_q_srv_pwset_info
  206. {
  207. DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
  208. uint8 pwd[16]; /* new password - undocumented. */
  209. } NET_Q_SRV_PWSET;
  210. /* NET_R_SRV_PWSET */
  211. typedef struct net_r_srv_pwset_info
  212. {
  213. DOM_CRED srv_cred; /* server-calculated credentials */
  214. uint32 status; /* return code */
  215. } NET_R_SRV_PWSET;
  216. /* NET_ID_INFO_2 */
  217. typedef struct net_network_info_2
  218. {
  219. uint32 ptr_id_info2; /* pointer to id_info_2 */
  220. UNIHDR hdr_domain_name; /* domain name unicode header */
  221. uint32 param_ctrl; /* param control (0x2) */
  222. DOM_LOGON_ID logon_id; /* logon ID */
  223. UNIHDR hdr_user_name; /* user name unicode header */
  224. UNIHDR hdr_wksta_name; /* workstation name unicode header */
  225. uint8 lm_chal[8]; /* lan manager 8 byte challenge */
  226. STRHDR hdr_nt_chal_resp; /* nt challenge response */
  227. STRHDR hdr_lm_chal_resp; /* lm challenge response */
  228. UNISTR2 uni_domain_name; /* domain name unicode string */
  229. UNISTR2 uni_user_name; /* user name unicode string */
  230. UNISTR2 uni_wksta_name; /* workgroup name unicode string */
  231. STRING2 nt_chal_resp; /* nt challenge response */
  232. STRING2 lm_chal_resp; /* lm challenge response */
  233. } NET_ID_INFO_2;
  234. /* NET_ID_INFO_1 */
  235. typedef struct id_info_1
  236. {
  237. uint32 ptr_id_info1; /* pointer to id_info_1 */
  238. UNIHDR hdr_domain_name; /* domain name unicode header */
  239. uint32 param_ctrl; /* param control */
  240. DOM_LOGON_ID logon_id; /* logon ID */
  241. UNIHDR hdr_user_name; /* user name unicode header */
  242. UNIHDR hdr_wksta_name; /* workstation name unicode header */
  243. OWF_INFO lm_owf; /* LM OWF Password */
  244. OWF_INFO nt_owf; /* NT OWF Password */
  245. UNISTR2 uni_domain_name; /* domain name unicode string */
  246. UNISTR2 uni_user_name; /* user name unicode string */
  247. UNISTR2 uni_wksta_name; /* workgroup name unicode string */
  248. } NET_ID_INFO_1;
  249. #define INTERACTIVE_LOGON_TYPE 1
  250. #define NET_LOGON_TYPE 2
  251. /* NET_ID_INFO_CTR */
  252. typedef struct net_id_info_ctr_info
  253. {
  254. uint16 switch_value;
  255. union
  256. {
  257. NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
  258. NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
  259. } auth;
  260. } NET_ID_INFO_CTR;
  261. /* SAM_INFO - sam logon/off id structure */
  262. typedef struct sam_info
  263. {
  264. DOM_CLNT_INFO2 client;
  265. uint32 ptr_rtn_cred; /* pointer to return credentials */
  266. DOM_CRED rtn_cred; /* return credentials */
  267. uint16 logon_level;
  268. NET_ID_INFO_CTR *ctr;
  269. } DOM_SAM_INFO;
  270. /* NET_Q_SAM_LOGON */
  271. typedef struct net_q_sam_logon_info
  272. {
  273. DOM_SAM_INFO sam_id;
  274. uint16 validation_level;
  275. } NET_Q_SAM_LOGON;
  276. /* NET_R_SAM_LOGON */
  277. typedef struct net_r_sam_logon_info
  278. {
  279. uint32 buffer_creds; /* undocumented buffer pointer */
  280. DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
  281. uint16 switch_value; /* 3 - indicates type of USER INFO */
  282. NET_USER_INFO_3 *user;
  283. uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
  284. uint32 status; /* return code */
  285. } NET_R_SAM_LOGON;
  286. /* NET_Q_SAM_LOGOFF */
  287. typedef struct net_q_sam_logoff_info
  288. {
  289. DOM_SAM_INFO sam_id;
  290. } NET_Q_SAM_LOGOFF;
  291. /* NET_R_SAM_LOGOFF */
  292. typedef struct net_r_sam_logoff_info
  293. {
  294. uint32 buffer_creds; /* undocumented buffer pointer */
  295. DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
  296. uint32 status; /* return code */
  297. } NET_R_SAM_LOGOFF;
  298. #endif /* _RPC_NETLOGON_H */