2 Unix SMB/Netbios implementation.
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
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _RPC_NETLOGON_H /* _RPC_NETLOGON_H */
25 #define _RPC_NETLOGON_H
29 #define NET_REQCHAL 0x04
30 #define NET_SRVPWSET 0x06
31 #define NET_SAMLOGON 0x02
32 #define NET_SAMLOGOFF 0x03
34 #define NET_AUTH2 0x0f
35 #define NET_LOGON_CTRL2 0x0e
36 #define NET_TRUST_DOM_LIST 0x13
38 #define NET_SAM_SYNC 0x10
39 #define NET_SAM_DELTAS 0x07
41 /* Secure Channel types. used in NetrServerAuthenticate negotiation */
42 #define SEC_CHAN_WKSTA 2
43 #define SEC_CHAN_DOMAIN 4
44 #define SEC_CHAN_BDC 6
48 typedef struct net_user_info_3
52 NTTIME logon_time; /* logon time */
53 NTTIME logoff_time; /* logoff time */
54 NTTIME kickoff_time; /* kickoff time */
55 NTTIME pass_last_set_time; /* password last set time */
56 NTTIME pass_can_change_time; /* password can change time */
57 NTTIME pass_must_change_time; /* password must change time */
59 UNIHDR hdr_user_name; /* username unicode string header */
60 UNIHDR hdr_full_name; /* user's full name unicode string header */
61 UNIHDR hdr_logon_script; /* logon script unicode string header */
62 UNIHDR hdr_profile_path; /* profile path unicode string header */
63 UNIHDR hdr_home_dir; /* home directory unicode string header */
64 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
66 uint16 logon_count; /* logon count */
67 uint16 bad_pw_count; /* bad password count */
69 uint32 user_id; /* User ID */
70 uint32 group_id; /* Group ID */
71 uint32 num_groups; /* num groups */
72 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
73 uint32 user_flgs; /* user flags */
75 uint8 user_sess_key[16]; /* unused user session key */
77 UNIHDR hdr_logon_srv; /* logon server unicode string header */
78 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
80 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
81 uint8 padding[40]; /* unused padding bytes. expansion room */
83 uint32 num_other_sids; /* 0 - num_sids */
84 uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
86 UNISTR2 uni_user_name; /* username unicode string */
87 UNISTR2 uni_full_name; /* user's full name unicode string */
88 UNISTR2 uni_logon_script; /* logon script unicode string */
89 UNISTR2 uni_profile_path; /* profile path unicode string */
90 UNISTR2 uni_home_dir; /* home directory unicode string */
91 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
93 uint32 num_groups2; /* num groups */
94 DOM_GID gids[LSA_MAX_GROUPS]; /* group info */
96 UNISTR2 uni_logon_srv; /* logon server unicode string */
97 UNISTR2 uni_logon_dom; /* logon domain unicode string */
99 DOM_SID2 dom_sid; /* domain SID */
100 DOM_SID2 other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */
105 /********************************************************
108 query_level 0x1 - pdc status
109 query_level 0x3 - number of logon attempts.
111 ********************************************************/
112 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2*/
113 typedef struct net_q_logon_ctrl2_info
115 uint32 ptr; /* undocumented buffer pointer */
116 UNISTR2 uni_server_name; /* server name, starting with two '\'s */
118 uint32 function_code; /* 0x1 */
119 uint32 query_level; /* 0x1, 0x3 */
120 uint32 switch_value; /* 0x1 */
124 /* NETLOGON_INFO_1 - pdc status info, i presume */
125 typedef struct netlogon_1_info
127 uint32 flags; /* 0x0 - undocumented */
128 uint32 pdc_status; /* 0x0 - undocumented */
132 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
133 typedef struct netlogon_2_info
135 uint32 flags; /* 0x0 - undocumented */
136 uint32 pdc_status; /* 0x0 - undocumented */
137 uint32 ptr_trusted_dc_name; /* pointer to trusted domain controller name */
138 uint32 tc_status; /* 0x051f - ERROR_NO_LOGON_SERVERS */
139 UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
143 /* NETLOGON_INFO_3 - logon status info, i presume */
144 typedef struct netlogon_3_info
146 uint32 flags; /* 0x0 - undocumented */
147 uint32 logon_attempts; /* number of logon attempts */
148 uint32 reserved_1; /* 0x0 - undocumented */
149 uint32 reserved_2; /* 0x0 - undocumented */
150 uint32 reserved_3; /* 0x0 - undocumented */
151 uint32 reserved_4; /* 0x0 - undocumented */
152 uint32 reserved_5; /* 0x0 - undocumented */
156 /*******************************************************
157 Logon Control Response
159 switch_value is same as query_level in request
160 *******************************************************/
162 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
163 typedef struct net_r_logon_ctrl2_info
165 uint32 switch_value; /* 0x1, 0x3 */
170 NETLOGON_INFO_1 info1;
171 NETLOGON_INFO_2 info2;
172 NETLOGON_INFO_3 info3;
176 uint32 status; /* return code */
180 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
181 typedef struct net_q_trust_dom_info
183 uint32 ptr; /* undocumented buffer pointer */
184 UNISTR2 uni_server_name; /* server name, starting with two '\'s */
186 uint32 function_code; /* 0x31 */
188 } NET_Q_TRUST_DOM_LIST;
190 #define MAX_TRUST_DOMS 1
192 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
193 typedef struct net_r_trust_dom_info
195 BUFFER2 uni_trust_dom_name;
197 uint32 status; /* return code */
199 } NET_R_TRUST_DOM_LIST;
203 typedef struct neg_flags_info
205 uint32 neg_flags; /* negotiated flags */
211 typedef struct net_q_req_chal_info
213 uint32 undoc_buffer; /* undocumented buffer pointer */
214 UNISTR2 uni_logon_srv; /* logon server unicode string */
215 UNISTR2 uni_logon_clnt; /* logon client unicode string */
216 DOM_CHAL clnt_chal; /* client challenge */
222 typedef struct net_r_req_chal_info
224 DOM_CHAL srv_chal; /* server challenge */
226 uint32 status; /* return code */
231 typedef struct net_q_auth_info
233 DOM_LOG_INFO clnt_id; /* client identification info */
234 DOM_CHAL clnt_chal; /* client-calculated credentials */
240 typedef struct net_r_auth_info
242 DOM_CHAL srv_chal; /* server-calculated credentials */
244 uint32 status; /* return code */
249 typedef struct net_q_auth2_info
251 DOM_LOG_INFO clnt_id; /* client identification info */
252 DOM_CHAL clnt_chal; /* client-calculated credentials */
254 NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
259 typedef struct net_r_auth2_info
261 DOM_CHAL srv_chal; /* server-calculated credentials */
262 NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
264 uint32 status; /* return code */
268 /* NET_Q_SRV_PWSET */
269 typedef struct net_q_srv_pwset_info
271 DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
272 uint8 pwd[16]; /* new password - undocumented. */
276 /* NET_R_SRV_PWSET */
277 typedef struct net_r_srv_pwset_info
279 DOM_CRED srv_cred; /* server-calculated credentials */
281 uint32 status; /* return code */
286 typedef struct net_network_info_2
288 uint32 ptr_id_info2; /* pointer to id_info_2 */
289 UNIHDR hdr_domain_name; /* domain name unicode header */
290 uint32 param_ctrl; /* param control (0x2) */
291 BIGINT logon_id; /* logon ID */
292 UNIHDR hdr_user_name; /* user name unicode header */
293 UNIHDR hdr_wksta_name; /* workstation name unicode header */
294 uint8 lm_chal[8]; /* lan manager 8 byte challenge */
295 STRHDR hdr_nt_chal_resp; /* nt challenge response */
296 STRHDR hdr_lm_chal_resp; /* lm challenge response */
298 UNISTR2 uni_domain_name; /* domain name unicode string */
299 UNISTR2 uni_user_name; /* user name unicode string */
300 UNISTR2 uni_wksta_name; /* workgroup name unicode string */
301 STRING2 nt_chal_resp; /* nt challenge response */
302 STRING2 lm_chal_resp; /* lm challenge response */
307 typedef struct id_info_1
309 uint32 ptr_id_info1; /* pointer to id_info_1 */
310 UNIHDR hdr_domain_name; /* domain name unicode header */
311 uint32 param_ctrl; /* param control */
312 BIGINT logon_id; /* logon ID */
313 UNIHDR hdr_user_name; /* user name unicode header */
314 UNIHDR hdr_wksta_name; /* workstation name unicode header */
315 OWF_INFO lm_owf; /* LM OWF Password */
316 OWF_INFO nt_owf; /* NT OWF Password */
317 UNISTR2 uni_domain_name; /* domain name unicode string */
318 UNISTR2 uni_user_name; /* user name unicode string */
319 UNISTR2 uni_wksta_name; /* workgroup name unicode string */
323 #define INTERACTIVE_LOGON_TYPE 1
324 #define NET_LOGON_TYPE 2
326 /* NET_ID_INFO_CTR */
327 typedef struct net_id_info_ctr_info
333 NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
334 NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
340 /* SAM_INFO - sam logon/off id structure */
341 typedef struct sam_info
343 DOM_CLNT_INFO2 client;
344 uint32 ptr_rtn_cred; /* pointer to return credentials */
345 DOM_CRED rtn_cred; /* return credentials */
347 NET_ID_INFO_CTR *ctr;
348 uint16 validation_level;
352 /* NET_Q_SAM_LOGON */
353 typedef struct net_q_sam_logon_info
359 /* NET_R_SAM_LOGON */
360 typedef struct net_r_sam_logon_info
362 uint32 buffer_creds; /* undocumented buffer pointer */
363 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
365 uint16 switch_value; /* 3 - indicates type of USER INFO */
366 NET_USER_INFO_3 *user;
368 uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
370 uint32 status; /* return code */
375 /* NET_Q_SAM_LOGOFF */
376 typedef struct net_q_sam_logoff_info
382 /* NET_R_SAM_LOGOFF */
383 typedef struct net_r_sam_logoff_info
385 uint32 buffer_creds; /* undocumented buffer pointer */
386 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
388 uint32 status; /* return code */
394 typedef struct net_q_sam_sync_info
396 UNISTR2 uni_srv_name; /* \\PDC */
397 UNISTR2 uni_cli_name; /* BDC */
402 uint32 restart_state;
405 uint32 max_size; /* preferred maximum length */
409 #define MAX_GROUP_MEM 256
410 #define MAX_SAM_DELTAS 256
413 typedef struct sam_delta_hdr_info
415 uint16 type; /* type of structure attached, see below */
424 /* SAM_DOMAIN_INFO (0x1) */
425 typedef struct sam_domain_info_info
432 uint16 pwd_history_len;
435 BIGINT dom_mod_count;
436 NTTIME creation_time;
438 BUFHDR2 hdr_sec_desc; /* security descriptor */
442 UNISTR2 uni_dom_name;
443 UNISTR2 buf_oem_info; /* never seen */
445 BUFFER4 buf_sec_desc;
450 /* SAM_GROUP_INFO (0x2) */
451 typedef struct sam_group_info_info
456 BUFHDR2 hdr_sec_desc; /* security descriptor */
459 UNISTR2 uni_grp_name;
460 UNISTR2 uni_grp_desc;
461 BUFFER4 buf_sec_desc;
466 typedef struct sam_passwd_info
468 /* this structure probably contains password history */
469 /* this is probably a count of lm/nt pairs */
470 uint32 unk_0; /* 0x0000 0002 */
473 uint8 buf_lm_pwd[16];
476 uint8 buf_nt_pwd[16];
483 /* SAM_ACCOUNT_INFO (0x5) */
484 typedef struct sam_account_info_info
486 UNIHDR hdr_acct_name;
487 UNIHDR hdr_full_name;
493 UNIHDR hdr_dir_drive;
494 UNIHDR hdr_logon_script;
495 UNIHDR hdr_acct_desc;
496 UNIHDR hdr_workstations;
501 uint32 logon_divs; /* 0xA8 */
502 uint32 ptr_logon_hrs;
504 uint16 bad_pwd_count;
506 NTTIME pwd_last_set_time;
507 NTTIME acct_expiry_time;
512 uint8 nt_pwd_present;
513 uint8 lm_pwd_present;
517 UNIHDR hdr_parameters;
521 BUFHDR2 hdr_sec_desc; /* security descriptor */
524 UNIHDR hdr_reserved[3]; /* space for more strings */
525 uint32 dw_reserved[4]; /* space for more data - first two seem to
528 UNISTR2 uni_acct_name;
529 UNISTR2 uni_full_name;
530 UNISTR2 uni_home_dir;
531 UNISTR2 uni_dir_drive;
532 UNISTR2 uni_logon_script;
533 UNISTR2 uni_acct_desc;
534 UNISTR2 uni_workstations;
536 uint32 unknown1; /* 0x4EC */
537 uint32 unknown2; /* 0 */
539 BUFFER4 buf_logon_hrs;
541 UNISTR2 uni_parameters;
543 BUFFER4 buf_sec_desc;
548 /* SAM_GROUP_MEM_INFO (0x8) */
549 typedef struct sam_group_mem_info_info
557 uint32 rids[MAX_GROUP_MEM];
560 uint32 attribs[MAX_GROUP_MEM];
562 } SAM_GROUP_MEM_INFO;
564 /* SAM_ALIAS_INFO (0x9) */
565 typedef struct sam_alias_info_info
569 BUFHDR2 hdr_sec_desc; /* security descriptor */
573 UNISTR2 uni_als_name;
574 BUFFER4 buf_sec_desc;
575 UNISTR2 uni_als_desc;
579 /* SAM_ALIAS_MEM_INFO (0xC) */
580 typedef struct sam_alias_mem_info_info
587 uint32 ptr_sids[MAX_GROUP_MEM];
588 DOM_SID2 sids[MAX_GROUP_MEM];
590 } SAM_ALIAS_MEM_INFO;
593 typedef union sam_delta_ctr_info
595 SAM_DOMAIN_INFO domain_info ;
596 SAM_GROUP_INFO group_info ;
597 SAM_ACCOUNT_INFO account_info;
598 SAM_GROUP_MEM_INFO grp_mem_info;
599 SAM_ALIAS_INFO alias_info ;
600 SAM_ALIAS_MEM_INFO als_mem_info;
605 typedef struct net_r_sam_sync_info
616 SAM_DELTA_HDR *hdr_deltas;
617 SAM_DELTA_CTR *deltas;
624 /* NET_Q_SAM_DELTAS */
625 typedef struct net_q_sam_deltas_info
627 UNISTR2 uni_srv_name;
628 UNISTR2 uni_cli_name;
633 BIGINT dom_mod_count; /* domain mod count at last sync */
635 uint32 max_size; /* preferred maximum length */
639 /* NET_R_SAM_DELTAS */
640 typedef struct net_r_sam_deltas_info
644 BIGINT dom_mod_count; /* new domain mod count */
650 SAM_DELTA_HDR *hdr_deltas;
651 SAM_DELTA_CTR *deltas;
658 #endif /* _RPC_NETLOGON_H */