tiny simplification
[Samba/gebeck_regimport.git] / source3 / include / rpc_netlogon.h
blob244e37d85a3170cbbba2a479a0fbcbe0cdfa5e69
1 /*
2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-1997
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
6 Copyright (C) Paul Ashton 1997
7 Copyright (C) Jean François Micouleau 2002
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 3 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, see <http://www.gnu.org/licenses/>.
23 #ifndef _RPC_NETLOGON_H /* _RPC_NETLOGON_H */
24 #define _RPC_NETLOGON_H
27 /* NETLOGON pipe */
28 #define NET_SAMLOGON 0x02
29 #define NET_SAMLOGOFF 0x03
30 #define NET_REQCHAL 0x04
31 #define NET_AUTH 0x05
32 #define NET_SRVPWSET 0x06
33 #define NET_SAM_DELTAS 0x07
34 #define NET_GETDCNAME 0x0b
35 #define NET_LOGON_CTRL 0x0c
36 #define NET_GETANYDCNAME 0x0d
37 #define NET_AUTH2 0x0f
38 #define NET_LOGON_CTRL2 0x0e
39 #define NET_SAM_SYNC 0x10
40 #define NET_TRUST_DOM_LIST 0x13
41 #define NET_DSR_GETDCNAME 0x14
42 #define NET_AUTH3 0x1a
43 #define NET_DSR_GETDCNAMEEX 0x1b
44 #define NET_DSR_GETSITENAME 0x1c
45 #define NET_DSR_GETDCNAMEEX2 0x22
46 #define NET_SAMLOGON_EX 0x27
48 /* Returned delta types */
49 #define SAM_DELTA_DOMAIN_INFO 0x01
50 #define SAM_DELTA_GROUP_INFO 0x02
51 #define SAM_DELTA_RENAME_GROUP 0x04
52 #define SAM_DELTA_ACCOUNT_INFO 0x05
53 #define SAM_DELTA_RENAME_USER 0x07
54 #define SAM_DELTA_GROUP_MEM 0x08
55 #define SAM_DELTA_ALIAS_INFO 0x09
56 #define SAM_DELTA_RENAME_ALIAS 0x0b
57 #define SAM_DELTA_ALIAS_MEM 0x0c
58 #define SAM_DELTA_POLICY_INFO 0x0d
59 #define SAM_DELTA_TRUST_DOMS 0x0e
60 #define SAM_DELTA_PRIVS_INFO 0x10 /* DT_DELTA_ACCOUNTS */
61 #define SAM_DELTA_SECRET_INFO 0x12
62 #define SAM_DELTA_DELETE_GROUP 0x14
63 #define SAM_DELTA_DELETE_USER 0x15
64 #define SAM_DELTA_MODIFIED_COUNT 0x16
66 /* SAM database types */
67 #define SAM_DATABASE_DOMAIN 0x00 /* Domain users and groups */
68 #define SAM_DATABASE_BUILTIN 0x01 /* BUILTIN users and groups */
69 #define SAM_DATABASE_PRIVS 0x02 /* Privileges */
71 /* flags use when sending a NETLOGON_CONTROL request */
73 #define NETLOGON_CONTROL_SYNC 0x2
74 #define NETLOGON_CONTROL_REDISCOVER 0x5
75 #define NETLOGON_CONTROL_TC_QUERY 0x6
76 #define NETLOGON_CONTROL_TRANSPORT_NOTIFY 0x7
77 #define NETLOGON_CONTROL_SET_DBFLAG 0xfffe
79 /* Some flag values reverse engineered from NLTEST.EXE */
80 /* used in the NETLOGON_CONTROL[2] reply */
82 #define NL_CTRL_IN_SYNC 0x0000
83 #define NL_CTRL_REPL_NEEDED 0x0001
84 #define NL_CTRL_REPL_IN_PROGRESS 0x0002
85 #define NL_CTRL_FULL_SYNC 0x0004
87 #define LOGON_KRB5_FAIL_CLOCK_SKEW 0x02000000
89 /* Flags for controlling the behaviour of a particular logon */
91 /* sets NETLOGON_SERVER_TRUST_ACCOUNT user_flag */
92 #if 0
93 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020
94 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800
96 /* updates the "logon time" on network logon */
97 #define MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004
99 /* returns the user parameters in the driveletter */
100 #define MSV1_0_RETURN_USER_PARAMETERS 0x00000008
102 /* returns the profilepath in the driveletter and
103 * sets LOGON_PROFILE_PATH_RETURNED user_flag */
104 #define MSV1_0_RETURN_PROFILE_PATH 0x00000200
105 #endif
107 #if 0
108 /* I think this is correct - it's what gets parsed on the wire. JRA. */
109 /* NET_USER_INFO_2 */
110 typedef struct net_user_info_2 {
111 uint32 ptr_user_info;
113 NTTIME logon_time; /* logon time */
114 NTTIME logoff_time; /* logoff time */
115 NTTIME kickoff_time; /* kickoff time */
116 NTTIME pass_last_set_time; /* password last set time */
117 NTTIME pass_can_change_time; /* password can change time */
118 NTTIME pass_must_change_time; /* password must change time */
120 UNIHDR hdr_user_name; /* username unicode string header */
121 UNIHDR hdr_full_name; /* user's full name unicode string header */
122 UNIHDR hdr_logon_script; /* logon script unicode string header */
123 UNIHDR hdr_profile_path; /* profile path unicode string header */
124 UNIHDR hdr_home_dir; /* home directory unicode string header */
125 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
127 uint16 logon_count; /* logon count */
128 uint16 bad_pw_count; /* bad password count */
130 uint32 user_id; /* User ID */
131 uint32 group_id; /* Group ID */
132 uint32 num_groups; /* num groups */
133 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
134 uint32 user_flgs; /* user flags */
136 uint8 user_sess_key[16]; /* unused user session key */
138 UNIHDR hdr_logon_srv; /* logon server unicode string header */
139 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
141 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
142 uint8 padding[40]; /* unused padding bytes. expansion room */
144 UNISTR2 uni_user_name; /* username unicode string */
145 UNISTR2 uni_full_name; /* user's full name unicode string */
146 UNISTR2 uni_logon_script; /* logon script unicode string */
147 UNISTR2 uni_profile_path; /* profile path unicode string */
148 UNISTR2 uni_home_dir; /* home directory unicode string */
149 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
151 uint32 num_groups2; /* num groups */
152 DOM_GID *gids; /* group info */
154 UNISTR2 uni_logon_srv; /* logon server unicode string */
155 UNISTR2 uni_logon_dom; /* logon domain unicode string */
157 DOM_SID2 dom_sid; /* domain SID */
159 uint32 num_other_groups; /* other groups */
160 DOM_GID *other_gids; /* group info */
161 DOM_SID2 *other_sids; /* undocumented - domain SIDs */
163 } NET_USER_INFO_2;
164 #endif
166 /* NET_USER_INFO_2 */
167 typedef struct net_user_info_2 {
168 uint32 ptr_user_info;
170 NTTIME logon_time; /* logon time */
171 NTTIME logoff_time; /* logoff time */
172 NTTIME kickoff_time; /* kickoff time */
173 NTTIME pass_last_set_time; /* password last set time */
174 NTTIME pass_can_change_time; /* password can change time */
175 NTTIME pass_must_change_time; /* password must change time */
177 UNIHDR hdr_user_name; /* username unicode string header */
178 UNIHDR hdr_full_name; /* user's full name unicode string header */
179 UNIHDR hdr_logon_script; /* logon script unicode string header */
180 UNIHDR hdr_profile_path; /* profile path unicode string header */
181 UNIHDR hdr_home_dir; /* home directory unicode string header */
182 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
184 uint16 logon_count; /* logon count */
185 uint16 bad_pw_count; /* bad password count */
187 uint32 user_rid; /* User RID */
188 uint32 group_rid; /* Group RID */
190 uint32 num_groups; /* num groups */
191 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
192 uint32 user_flgs; /* user flags */
194 uint8 user_sess_key[16]; /* user session key */
196 UNIHDR hdr_logon_srv; /* logon server unicode string header */
197 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
199 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
200 uint8 lm_sess_key[8]; /* lm session key */
201 uint32 acct_flags; /* account flags */
202 uint32 unknown[7]; /* unknown */
204 UNISTR2 uni_user_name; /* username unicode string */
205 UNISTR2 uni_full_name; /* user's full name unicode string */
206 UNISTR2 uni_logon_script; /* logon script unicode string */
207 UNISTR2 uni_profile_path; /* profile path unicode string */
208 UNISTR2 uni_home_dir; /* home directory unicode string */
209 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
211 UNISTR2 uni_logon_srv; /* logon server unicode string */
212 UNISTR2 uni_logon_dom; /* logon domain unicode string */
214 DOM_SID2 dom_sid; /* domain SID */
215 } NET_USER_INFO_2;
217 /* NET_USER_INFO_3 */
218 typedef struct net_user_info_3 {
219 uint32 ptr_user_info;
221 NTTIME logon_time; /* logon time */
222 NTTIME logoff_time; /* logoff time */
223 NTTIME kickoff_time; /* kickoff time */
224 NTTIME pass_last_set_time; /* password last set time */
225 NTTIME pass_can_change_time; /* password can change time */
226 NTTIME pass_must_change_time; /* password must change time */
228 UNIHDR hdr_user_name; /* username unicode string header */
229 UNIHDR hdr_full_name; /* user's full name unicode string header */
230 UNIHDR hdr_logon_script; /* logon script unicode string header */
231 UNIHDR hdr_profile_path; /* profile path unicode string header */
232 UNIHDR hdr_home_dir; /* home directory unicode string header */
233 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
235 uint16 logon_count; /* logon count */
236 uint16 bad_pw_count; /* bad password count */
238 uint32 user_rid; /* User RID */
239 uint32 group_rid; /* Group RID */
241 uint32 num_groups; /* num groups */
242 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
243 uint32 user_flgs; /* user flags */
245 uint8 user_sess_key[16]; /* user session key */
247 UNIHDR hdr_logon_srv; /* logon server unicode string header */
248 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
250 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
251 uint8 lm_sess_key[8]; /* lm session key */
252 uint32 acct_flags; /* account flags */
253 uint32 unknown[7]; /* unknown */
255 uint32 num_other_sids; /* number of foreign/trusted domain sids */
256 uint32 buffer_other_sids;
258 /* The next three uint32 are not really part of user_info_3 but here
259 * for parsing convenience. They are only valid in Kerberos PAC
260 * parsing - Guenther */
261 uint32 ptr_res_group_dom_sid;
262 uint32 res_group_count;
263 uint32 ptr_res_groups;
265 UNISTR2 uni_user_name; /* username unicode string */
266 UNISTR2 uni_full_name; /* user's full name unicode string */
267 UNISTR2 uni_logon_script; /* logon script unicode string */
268 UNISTR2 uni_profile_path; /* profile path unicode string */
269 UNISTR2 uni_home_dir; /* home directory unicode string */
270 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
272 uint32 num_groups2; /* num groups */
273 DOM_GID *gids; /* group info */
275 UNISTR2 uni_logon_srv; /* logon server unicode string */
276 UNISTR2 uni_logon_dom; /* logon domain unicode string */
278 DOM_SID2 dom_sid; /* domain SID */
280 DOM_SID2 *other_sids; /* foreign/trusted domain SIDs */
281 uint32 *other_sids_attrib;
282 } NET_USER_INFO_3;
285 /* NETLOGON_INFO_1 - pdc status info, i presume */
286 typedef struct netlogon_1_info {
287 uint32 flags; /* 0x0 - undocumented */
288 uint32 pdc_status; /* 0x0 - undocumented */
289 } NETLOGON_INFO_1;
291 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
292 typedef struct netlogon_2_info {
293 uint32 flags; /* 0x0 - undocumented */
294 uint32 pdc_status; /* 0x0 - undocumented */
295 uint32 ptr_trusted_dc_name; /* pointer to trusted domain controller name */
296 uint32 tc_status;
297 UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
298 } NETLOGON_INFO_2;
300 /* NETLOGON_INFO_3 - logon status info, i presume */
301 typedef struct netlogon_3_info {
302 uint32 flags; /* 0x0 - undocumented */
303 uint32 logon_attempts; /* number of logon attempts */
304 uint32 reserved_1; /* 0x0 - undocumented */
305 uint32 reserved_2; /* 0x0 - undocumented */
306 uint32 reserved_3; /* 0x0 - undocumented */
307 uint32 reserved_4; /* 0x0 - undocumented */
308 uint32 reserved_5; /* 0x0 - undocumented */
309 } NETLOGON_INFO_3;
311 /********************************************************
312 Logon Control Query
314 This is generated by a nltest /bdc_query:DOMAIN
316 query_level 0x1, function_code 0x1
318 ********************************************************/
320 /* NET_Q_LOGON_CTRL - LSA Netr Logon Control */
322 typedef struct net_q_logon_ctrl_info {
323 uint32 ptr;
324 UNISTR2 uni_server_name;
325 uint32 function_code;
326 uint32 query_level;
327 } NET_Q_LOGON_CTRL;
329 /* NET_R_LOGON_CTRL - LSA Netr Logon Control */
331 typedef struct net_r_logon_ctrl_info {
332 uint32 switch_value;
333 uint32 ptr;
335 union {
336 NETLOGON_INFO_1 info1;
337 } logon;
339 NTSTATUS status;
340 } NET_R_LOGON_CTRL;
343 typedef struct ctrl_data_info_5 {
344 uint32 function_code;
346 uint32 ptr_domain;
347 UNISTR2 domain;
348 } CTRL_DATA_INFO_5;
350 typedef struct ctrl_data_info_6 {
351 uint32 function_code;
353 uint32 ptr_domain;
354 UNISTR2 domain;
355 } CTRL_DATA_INFO_6;
358 /********************************************************
359 Logon Control2 Query
361 query_level 0x1 - pdc status
362 query_level 0x3 - number of logon attempts.
364 ********************************************************/
366 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2 */
367 typedef struct net_q_logon_ctrl2_info {
368 uint32 ptr; /* undocumented buffer pointer */
369 UNISTR2 uni_server_name; /* server name, starting with two '\'s */
371 uint32 function_code;
372 uint32 query_level;
373 union {
374 CTRL_DATA_INFO_5 info5;
375 CTRL_DATA_INFO_6 info6;
376 } info;
377 } NET_Q_LOGON_CTRL2;
379 /*******************************************************
380 Logon Control Response
382 switch_value is same as query_level in request
383 *******************************************************/
385 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
386 typedef struct net_r_logon_ctrl2_info {
387 uint32 switch_value; /* 0x1, 0x3 */
388 uint32 ptr;
390 union
392 NETLOGON_INFO_1 info1;
393 NETLOGON_INFO_2 info2;
394 NETLOGON_INFO_3 info3;
396 } logon;
398 NTSTATUS status; /* return code */
399 } NET_R_LOGON_CTRL2;
401 /* NET_Q_GETANYDCNAME - Ask a DC for a trusted DC name */
403 typedef struct net_q_getanydcname {
404 uint32 ptr_logon_server;
405 UNISTR2 uni_logon_server;
406 uint32 ptr_domainname;
407 UNISTR2 uni_domainname;
408 } NET_Q_GETANYDCNAME;
410 /* NET_R_GETANYDCNAME - Ask a DC for a trusted DC name */
412 typedef struct net_r_getanydcname {
413 uint32 ptr_dcname;
414 UNISTR2 uni_dcname;
415 WERROR status;
416 } NET_R_GETANYDCNAME;
419 /* NET_Q_GETDCNAME - Ask a DC for a trusted DC name */
421 typedef struct net_q_getdcname {
422 UNISTR2 uni_logon_server;
423 uint32 ptr_domainname;
424 UNISTR2 uni_domainname;
425 } NET_Q_GETDCNAME;
427 /* NET_R_GETDCNAME - Ask a DC for a trusted DC name */
429 typedef struct net_r_getdcname {
430 uint32 ptr_dcname;
431 UNISTR2 uni_dcname;
432 WERROR status;
433 } NET_R_GETDCNAME;
435 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
436 typedef struct net_q_trust_dom_info {
437 uint32 ptr; /* undocumented buffer pointer */
438 UNISTR2 uni_server_name; /* server name, starting with two '\'s */
439 } NET_Q_TRUST_DOM_LIST;
441 #define MAX_TRUST_DOMS 1
443 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
444 typedef struct net_r_trust_dom_info {
445 UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
447 NTSTATUS status; /* return code */
448 } NET_R_TRUST_DOM_LIST;
451 /* NEG_FLAGS */
452 typedef struct neg_flags_info {
453 uint32 neg_flags; /* negotiated flags */
454 } NEG_FLAGS;
457 /* NET_Q_REQ_CHAL */
458 typedef struct net_q_req_chal_info {
459 uint32 undoc_buffer; /* undocumented buffer pointer */
460 UNISTR2 uni_logon_srv; /* logon server unicode string */
461 UNISTR2 uni_logon_clnt; /* logon client unicode string */
462 DOM_CHAL clnt_chal; /* client challenge */
463 } NET_Q_REQ_CHAL;
466 /* NET_R_REQ_CHAL */
467 typedef struct net_r_req_chal_info {
468 DOM_CHAL srv_chal; /* server challenge */
469 NTSTATUS status; /* return code */
470 } NET_R_REQ_CHAL;
472 /* NET_Q_AUTH */
473 typedef struct net_q_auth_info {
474 DOM_LOG_INFO clnt_id; /* client identification info */
475 DOM_CHAL clnt_chal; /* client-calculated credentials */
476 } NET_Q_AUTH;
478 /* NET_R_AUTH */
479 typedef struct net_r_auth_info {
480 DOM_CHAL srv_chal; /* server-calculated credentials */
481 NTSTATUS status; /* return code */
482 } NET_R_AUTH;
484 /* NET_Q_AUTH_2 */
485 typedef struct net_q_auth2_info {
486 DOM_LOG_INFO clnt_id; /* client identification info */
487 DOM_CHAL clnt_chal; /* client-calculated credentials */
489 NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
490 } NET_Q_AUTH_2;
493 /* NET_R_AUTH_2 */
494 typedef struct net_r_auth2_info {
495 DOM_CHAL srv_chal; /* server-calculated credentials */
496 NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
497 NTSTATUS status; /* return code */
498 } NET_R_AUTH_2;
500 /* NET_Q_AUTH_3 */
501 typedef struct net_q_auth3_info {
502 DOM_LOG_INFO clnt_id; /* client identification info */
503 DOM_CHAL clnt_chal; /* client-calculated credentials */
504 NEG_FLAGS clnt_flgs; /* usually 0x6007 ffff */
505 } NET_Q_AUTH_3;
507 /* NET_R_AUTH_3 */
508 typedef struct net_r_auth3_info {
509 DOM_CHAL srv_chal; /* server-calculated credentials */
510 NEG_FLAGS srv_flgs; /* usually 0x6007 ffff */
511 uint32 unknown; /* 0x0000045b */
512 NTSTATUS status; /* return code */
513 } NET_R_AUTH_3;
516 /* NET_Q_SRV_PWSET */
517 typedef struct net_q_srv_pwset_info {
518 DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
519 uint8 pwd[16]; /* new password - undocumented. */
520 } NET_Q_SRV_PWSET;
522 /* NET_R_SRV_PWSET */
523 typedef struct net_r_srv_pwset_info {
524 DOM_CRED srv_cred; /* server-calculated credentials */
526 NTSTATUS status; /* return code */
527 } NET_R_SRV_PWSET;
529 /* NET_ID_INFO_2 */
530 typedef struct net_network_info_2 {
531 uint32 ptr_id_info2; /* pointer to id_info_2 */
532 UNIHDR hdr_domain_name; /* domain name unicode header */
533 uint32 param_ctrl; /* param control (0x2) */
534 DOM_LOGON_ID logon_id; /* logon ID */
535 UNIHDR hdr_user_name; /* user name unicode header */
536 UNIHDR hdr_wksta_name; /* workstation name unicode header */
537 uint8 lm_chal[8]; /* lan manager 8 byte challenge */
538 STRHDR hdr_nt_chal_resp; /* nt challenge response */
539 STRHDR hdr_lm_chal_resp; /* lm challenge response */
541 UNISTR2 uni_domain_name; /* domain name unicode string */
542 UNISTR2 uni_user_name; /* user name unicode string */
543 UNISTR2 uni_wksta_name; /* workgroup name unicode string */
544 STRING2 nt_chal_resp; /* nt challenge response */
545 STRING2 lm_chal_resp; /* lm challenge response */
546 } NET_ID_INFO_2;
548 /* NET_ID_INFO_1 */
549 typedef struct id_info_1 {
550 uint32 ptr_id_info1; /* pointer to id_info_1 */
551 UNIHDR hdr_domain_name; /* domain name unicode header */
552 uint32 param_ctrl; /* param control */
553 DOM_LOGON_ID logon_id; /* logon ID */
554 UNIHDR hdr_user_name; /* user name unicode header */
555 UNIHDR hdr_wksta_name; /* workstation name unicode header */
556 OWF_INFO lm_owf; /* LM OWF Password */
557 OWF_INFO nt_owf; /* NT OWF Password */
558 UNISTR2 uni_domain_name; /* domain name unicode string */
559 UNISTR2 uni_user_name; /* user name unicode string */
560 UNISTR2 uni_wksta_name; /* workgroup name unicode string */
561 } NET_ID_INFO_1;
563 #define INTERACTIVE_LOGON_TYPE 1
564 #define NET_LOGON_TYPE 2
566 /* NET_ID_INFO_CTR */
567 typedef struct net_id_info_ctr_info {
568 uint16 switch_value;
570 union {
571 NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
572 NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
573 } auth;
574 } NET_ID_INFO_CTR;
576 /* SAM_INFO - sam logon/off id structure */
577 typedef struct sam_info {
578 DOM_CLNT_INFO2 client;
579 uint32 ptr_rtn_cred; /* pointer to return credentials */
580 DOM_CRED rtn_cred; /* return credentials */
581 uint16 logon_level;
582 NET_ID_INFO_CTR *ctr;
583 } DOM_SAM_INFO;
585 /* SAM_INFO - sam logon/off id structure - no creds */
586 typedef struct sam_info_ex {
587 DOM_CLNT_SRV client;
588 uint16 logon_level;
589 NET_ID_INFO_CTR *ctr;
590 } DOM_SAM_INFO_EX;
592 /* NET_Q_SAM_LOGON */
593 typedef struct net_q_sam_logon_info {
594 DOM_SAM_INFO sam_id;
595 uint16 validation_level;
596 } NET_Q_SAM_LOGON;
598 /* NET_Q_SAM_LOGON_EX */
599 typedef struct net_q_sam_logon_info_ex {
600 DOM_SAM_INFO_EX sam_id;
601 uint16 validation_level;
602 uint32 flags;
603 } NET_Q_SAM_LOGON_EX;
605 /* NET_R_SAM_LOGON */
606 typedef struct net_r_sam_logon_info {
607 uint32 buffer_creds; /* undocumented buffer pointer */
608 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
610 uint16 switch_value; /* 3 - indicates type of USER INFO */
611 NET_USER_INFO_3 *user;
613 uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
615 NTSTATUS status; /* return code */
616 } NET_R_SAM_LOGON;
618 /* NET_R_SAM_LOGON_EX */
619 typedef struct net_r_sam_logon_info_ex {
620 uint16 switch_value; /* 3 - indicates type of USER INFO */
621 NET_USER_INFO_3 *user;
623 uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
624 uint32 flags;
626 NTSTATUS status; /* return code */
627 } NET_R_SAM_LOGON_EX;
630 /* NET_Q_SAM_LOGOFF */
631 typedef struct net_q_sam_logoff_info {
632 DOM_SAM_INFO sam_id;
633 } NET_Q_SAM_LOGOFF;
635 /* NET_R_SAM_LOGOFF */
636 typedef struct net_r_sam_logoff_info {
637 uint32 buffer_creds; /* undocumented buffer pointer */
638 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
639 NTSTATUS status; /* return code */
640 } NET_R_SAM_LOGOFF;
642 /* NET_Q_SAM_SYNC */
643 typedef struct net_q_sam_sync_info {
644 UNISTR2 uni_srv_name; /* \\PDC */
645 UNISTR2 uni_cli_name; /* BDC */
646 DOM_CRED cli_creds;
647 DOM_CRED ret_creds;
649 uint32 database_id;
650 uint32 restart_state;
651 uint32 sync_context;
653 uint32 max_size; /* preferred maximum length */
654 } NET_Q_SAM_SYNC;
656 /* SAM_DELTA_HDR */
657 typedef struct sam_delta_hdr_info {
658 uint16 type; /* type of structure attached */
659 uint16 type2;
660 uint32 target_rid;
662 uint32 type3;
663 uint32 ptr_delta;
664 } SAM_DELTA_HDR;
666 /* LOCKOUT_STRING */
667 typedef struct account_lockout_string {
668 uint32 array_size;
669 uint32 offset;
670 uint32 length;
671 /* uint16 *bindata; */
672 uint64 lockout_duration;
673 uint64 reset_count;
674 uint32 bad_attempt_lockout;
675 uint32 dummy;
676 } LOCKOUT_STRING;
678 /* HDR_LOCKOUT_STRING */
679 typedef struct hdr_account_lockout_string {
680 uint16 size;
681 uint16 length;
682 uint32 buffer;
683 } HDR_LOCKOUT_STRING;
685 /* SAM_DOMAIN_INFO (0x1) */
686 typedef struct sam_domain_info_info {
687 UNIHDR hdr_dom_name;
688 UNIHDR hdr_oem_info;
690 uint64 force_logoff;
691 uint16 min_pwd_len;
692 uint16 pwd_history_len;
693 uint64 max_pwd_age;
694 uint64 min_pwd_age;
695 uint64 dom_mod_count;
696 NTTIME creation_time;
697 uint32 security_information;
699 BUFHDR4 hdr_sec_desc; /* security descriptor */
701 HDR_LOCKOUT_STRING hdr_account_lockout;
703 UNIHDR hdr_unknown2;
704 UNIHDR hdr_unknown3;
705 UNIHDR hdr_unknown4;
707 UNISTR2 uni_dom_name;
708 UNISTR2 buf_oem_info;
710 RPC_DATA_BLOB buf_sec_desc;
712 LOCKOUT_STRING account_lockout;
714 UNISTR2 buf_unknown2;
715 UNISTR2 buf_unknown3;
716 UNISTR2 buf_unknown4;
718 uint32 logon_chgpass;
719 uint32 unknown6;
720 uint32 unknown7;
721 uint32 unknown8;
722 } SAM_DOMAIN_INFO;
724 /* SAM_GROUP_INFO (0x2) */
725 typedef struct sam_group_info_info {
726 UNIHDR hdr_grp_name;
727 DOM_GID gid;
728 UNIHDR hdr_grp_desc;
729 BUFHDR2 hdr_sec_desc; /* security descriptor */
730 uint8 reserved[48];
732 UNISTR2 uni_grp_name;
733 UNISTR2 uni_grp_desc;
734 RPC_DATA_BLOB buf_sec_desc;
735 } SAM_GROUP_INFO;
737 /* SAM_PWD */
738 typedef struct sam_passwd_info {
739 /* this structure probably contains password history */
740 /* this is probably a count of lm/nt pairs */
741 uint32 unk_0; /* 0x0000 0002 */
743 UNIHDR hdr_lm_pwd;
744 uint8 buf_lm_pwd[16];
746 UNIHDR hdr_nt_pwd;
747 uint8 buf_nt_pwd[16];
749 UNIHDR hdr_empty_lm;
750 UNIHDR hdr_empty_nt;
751 } SAM_PWD;
753 /* SAM_ACCOUNT_INFO (0x5) */
754 typedef struct sam_account_info_info {
755 UNIHDR hdr_acct_name;
756 UNIHDR hdr_full_name;
758 uint32 user_rid;
759 uint32 group_rid;
761 UNIHDR hdr_home_dir;
762 UNIHDR hdr_dir_drive;
763 UNIHDR hdr_logon_script;
764 UNIHDR hdr_acct_desc;
765 UNIHDR hdr_workstations;
767 NTTIME logon_time;
768 NTTIME logoff_time;
770 uint32 logon_divs; /* 0xA8 */
771 uint32 ptr_logon_hrs;
773 uint16 bad_pwd_count;
774 uint16 logon_count;
775 NTTIME pwd_last_set_time;
776 NTTIME acct_expiry_time;
778 uint32 acb_info;
779 uint8 nt_pwd[16];
780 uint8 lm_pwd[16];
781 uint8 nt_pwd_present;
782 uint8 lm_pwd_present;
783 uint8 pwd_expired;
785 UNIHDR hdr_comment;
786 UNIHDR hdr_parameters;
787 uint16 country;
788 uint16 codepage;
790 BUFHDR2 hdr_sec_desc; /* security descriptor */
792 UNIHDR hdr_profile;
793 UNIHDR hdr_reserved[3]; /* space for more strings */
794 uint32 dw_reserved[4]; /* space for more data - first two seem to
795 be an NTTIME */
797 UNISTR2 uni_acct_name;
798 UNISTR2 uni_full_name;
799 UNISTR2 uni_home_dir;
800 UNISTR2 uni_dir_drive;
801 UNISTR2 uni_logon_script;
802 UNISTR2 uni_acct_desc;
803 UNISTR2 uni_workstations;
805 uint32 unknown1; /* 0x4EC */
806 uint32 unknown2; /* 0 */
808 RPC_DATA_BLOB buf_logon_hrs;
809 UNISTR2 uni_comment;
810 UNISTR2 uni_parameters;
811 SAM_PWD pass;
812 RPC_DATA_BLOB buf_sec_desc;
813 UNISTR2 uni_profile;
814 } SAM_ACCOUNT_INFO;
816 /* SAM_GROUP_MEM_INFO (0x8) */
817 typedef struct sam_group_mem_info_info {
818 uint32 ptr_rids;
819 uint32 ptr_attribs;
820 uint32 num_members;
821 uint8 unknown[16];
823 uint32 num_members2;
824 uint32 *rids;
826 uint32 num_members3;
827 uint32 *attribs;
829 } SAM_GROUP_MEM_INFO;
831 /* SAM_ALIAS_INFO (0x9) */
832 typedef struct sam_alias_info_info {
833 UNIHDR hdr_als_name;
834 uint32 als_rid;
835 BUFHDR2 hdr_sec_desc; /* security descriptor */
836 UNIHDR hdr_als_desc;
837 uint8 reserved[40];
839 UNISTR2 uni_als_name;
840 RPC_DATA_BLOB buf_sec_desc;
841 UNISTR2 uni_als_desc;
842 } SAM_ALIAS_INFO;
844 /* SAM_ALIAS_MEM_INFO (0xC) */
845 typedef struct sam_alias_mem_info_info {
846 uint32 num_members;
847 uint32 ptr_members;
848 uint8 unknown[16];
850 uint32 num_sids;
851 uint32 *ptr_sids;
852 DOM_SID2 *sids;
853 } SAM_ALIAS_MEM_INFO;
856 /* SAM_DELTA_POLICY (0x0D) */
857 typedef struct {
858 uint32 max_log_size; /* 0x5000 */
859 uint64 audit_retention_period; /* 0 */
860 uint32 auditing_mode; /* 0 */
861 uint32 num_events;
862 uint32 ptr_events;
863 UNIHDR hdr_dom_name;
864 uint32 sid_ptr;
866 uint32 paged_pool_limit; /* 0x02000000 */
867 uint32 non_paged_pool_limit; /* 0x00100000 */
868 uint32 min_workset_size; /* 0x00010000 */
869 uint32 max_workset_size; /* 0x0f000000 */
870 uint32 page_file_limit; /* 0 */
871 uint64 time_limit; /* 0 */
872 NTTIME modify_time; /* 0x3c*/
873 NTTIME create_time; /* a7080110 */
874 BUFHDR2 hdr_sec_desc;
876 uint32 num_event_audit_options;
877 uint32 event_audit_option;
879 UNISTR2 domain_name;
880 DOM_SID2 domain_sid;
882 RPC_DATA_BLOB buf_sec_desc;
883 } SAM_DELTA_POLICY;
885 /* SAM_DELTA_TRUST_DOMS */
886 typedef struct {
887 uint32 buf_size;
888 SEC_DESC *sec_desc;
889 DOM_SID2 sid;
890 UNIHDR hdr_domain;
892 uint32 unknown0;
893 uint32 unknown1;
894 uint32 unknown2;
896 uint32 buf_size2;
897 uint32 ptr;
899 uint32 unknown3;
900 UNISTR2 domain;
901 } SAM_DELTA_TRUSTDOMS;
903 /* SAM_DELTA_PRIVS (0x10) */
904 typedef struct {
905 DOM_SID2 sid;
907 uint32 priv_count;
908 uint32 priv_control;
910 uint32 priv_attr_ptr;
911 uint32 priv_name_ptr;
913 uint32 paged_pool_limit; /* 0x02000000 */
914 uint32 non_paged_pool_limit; /* 0x00100000 */
915 uint32 min_workset_size; /* 0x00010000 */
916 uint32 max_workset_size; /* 0x0f000000 */
917 uint32 page_file_limit; /* 0 */
918 uint64 time_limit; /* 0 */
919 uint32 system_flags; /* 1 */
920 BUFHDR2 hdr_sec_desc;
922 uint32 buf_size2;
924 uint32 attribute_count;
925 uint32 *attributes;
927 uint32 privlist_count;
928 UNIHDR *hdr_privslist;
929 UNISTR2 *uni_privslist;
931 RPC_DATA_BLOB buf_sec_desc;
932 } SAM_DELTA_PRIVS;
934 /* SAM_DELTA_SECRET */
935 typedef struct {
936 uint32 buf_size;
937 SEC_DESC *sec_desc;
938 UNISTR2 secret;
940 uint32 count1;
941 uint32 count2;
942 uint32 ptr;
943 NTTIME time1;
944 uint32 count3;
945 uint32 count4;
946 uint32 ptr2;
947 NTTIME time2;
948 uint32 unknow1;
950 uint32 buf_size2;
951 uint32 ptr3;
952 uint32 unknow2; /* 0x0 12 times */
954 uint32 chal_len;
955 uint32 reserved1; /* 0 */
956 uint32 chal_len2;
957 uint8 chal[16];
959 uint32 key_len;
960 uint32 reserved2; /* 0 */
961 uint32 key_len2;
962 uint8 key[8];
964 uint32 buf_size3;
965 SEC_DESC *sec_desc2;
966 } SAM_DELTA_SECRET;
968 /* SAM_DELTA_MOD_COUNT (0x16) */
969 typedef struct {
970 uint32 seqnum;
971 uint32 dom_mod_count_ptr;
972 uint64 dom_mod_count; /* domain mod count at last sync */
973 } SAM_DELTA_MOD_COUNT;
975 typedef union sam_delta_ctr_info {
976 SAM_DOMAIN_INFO domain_info ;
977 SAM_GROUP_INFO group_info ;
978 SAM_ACCOUNT_INFO account_info;
979 SAM_GROUP_MEM_INFO grp_mem_info;
980 SAM_ALIAS_INFO alias_info ;
981 SAM_ALIAS_MEM_INFO als_mem_info;
982 SAM_DELTA_POLICY policy_info;
983 SAM_DELTA_PRIVS privs_info;
984 SAM_DELTA_MOD_COUNT mod_count;
985 SAM_DELTA_TRUSTDOMS trustdoms_info;
986 SAM_DELTA_SECRET secret_info;
987 } SAM_DELTA_CTR;
989 /* NET_R_SAM_SYNC */
990 typedef struct net_r_sam_sync_info {
991 DOM_CRED srv_creds;
993 uint32 sync_context;
995 uint32 ptr_deltas;
996 uint32 num_deltas;
997 uint32 ptr_deltas2;
998 uint32 num_deltas2;
1000 SAM_DELTA_HDR *hdr_deltas;
1001 SAM_DELTA_CTR *deltas;
1003 NTSTATUS status;
1004 } NET_R_SAM_SYNC;
1006 /* NET_Q_SAM_DELTAS */
1007 typedef struct net_q_sam_deltas_info {
1008 UNISTR2 uni_srv_name;
1009 UNISTR2 uni_cli_name;
1010 DOM_CRED cli_creds;
1011 DOM_CRED ret_creds;
1013 uint32 database_id;
1014 uint64 dom_mod_count; /* domain mod count at last sync */
1016 uint32 max_size; /* preferred maximum length */
1017 } NET_Q_SAM_DELTAS;
1019 /* NET_R_SAM_DELTAS */
1020 typedef struct net_r_sam_deltas_info {
1021 DOM_CRED srv_creds;
1023 uint64 dom_mod_count; /* new domain mod count */
1025 uint32 ptr_deltas;
1026 uint32 num_deltas;
1027 uint32 num_deltas2;
1029 SAM_DELTA_HDR *hdr_deltas;
1030 SAM_DELTA_CTR *deltas;
1032 NTSTATUS status;
1033 } NET_R_SAM_DELTAS;
1035 #define DSGETDC_VALID_FLAGS ( \
1036 DS_FORCE_REDISCOVERY | \
1037 DS_DIRECTORY_SERVICE_REQUIRED | \
1038 DS_DIRECTORY_SERVICE_PREFERRED | \
1039 DS_GC_SERVER_REQUIRED | \
1040 DS_PDC_REQUIRED | \
1041 DS_BACKGROUND_ONLY | \
1042 DS_IP_REQUIRED | \
1043 DS_KDC_REQUIRED | \
1044 DS_TIMESERV_REQUIRED | \
1045 DS_WRITABLE_REQUIRED | \
1046 DS_GOOD_TIMESERV_PREFERRED | \
1047 DS_AVOID_SELF | \
1048 DS_ONLY_LDAP_NEEDED | \
1049 DS_IS_FLAT_NAME | \
1050 DS_IS_DNS_NAME | \
1051 DS_RETURN_FLAT_NAME | \
1052 DS_RETURN_DNS_NAME )
1054 struct DS_DOMAIN_CONTROLLER_INFO {
1055 const char *domain_controller_name;
1056 const char *domain_controller_address;
1057 int32 domain_controller_address_type;
1058 struct GUID *domain_guid;
1059 const char *domain_name;
1060 const char *dns_forest_name;
1061 uint32 flags;
1062 const char *dc_site_name;
1063 const char *client_site_name;
1066 /* NET_Q_DSR_GETDCNAME */
1067 typedef struct net_q_dsr_getdcname {
1068 uint32 ptr_server_unc;
1069 UNISTR2 uni_server_unc;
1070 uint32 ptr_domain_name;
1071 UNISTR2 uni_domain_name;
1072 uint32 ptr_domain_guid;
1073 struct GUID *domain_guid;
1074 uint32 ptr_site_guid;
1075 struct GUID *site_guid;
1076 uint32 flags;
1077 } NET_Q_DSR_GETDCNAME;
1079 /* NET_R_DSR_GETDCNAME */
1080 typedef struct net_r_dsr_getdcname {
1081 uint32 ptr_dc_unc;
1082 UNISTR2 uni_dc_unc;
1083 uint32 ptr_dc_address;
1084 UNISTR2 uni_dc_address;
1085 int32 dc_address_type;
1086 struct GUID domain_guid;
1087 uint32 ptr_domain_name;
1088 UNISTR2 uni_domain_name;
1089 uint32 ptr_forest_name;
1090 UNISTR2 uni_forest_name;
1091 uint32 dc_flags;
1092 uint32 ptr_dc_site_name;
1093 UNISTR2 uni_dc_site_name;
1094 uint32 ptr_client_site_name;
1095 UNISTR2 uni_client_site_name;
1096 WERROR result;
1097 } NET_R_DSR_GETDCNAME;
1099 /* NET_Q_DSR_GESITENAME */
1100 typedef struct net_q_dsr_getsitename {
1101 uint32 ptr_computer_name;
1102 UNISTR2 uni_computer_name;
1103 } NET_Q_DSR_GETSITENAME;
1105 /* NET_R_DSR_GETSITENAME */
1106 typedef struct net_r_dsr_getsitename {
1107 uint32 ptr_site_name;
1108 UNISTR2 uni_site_name;
1109 WERROR result;
1110 } NET_R_DSR_GETSITENAME;
1113 #endif /* _RPC_NETLOGON_H */