[GLUE] Rsync SAMBA_3_0 SVN r25598 in order to create the v3-0-test branch.
[Samba.git] / source / include / rpc_netlogon.h
blob324755a26598e5ba724d37332cb2df3d2a44d1ed
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 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
28 /* NETLOGON pipe */
29 #define NET_SAMLOGON 0x02
30 #define NET_SAMLOGOFF 0x03
31 #define NET_REQCHAL 0x04
32 #define NET_AUTH 0x05
33 #define NET_SRVPWSET 0x06
34 #define NET_SAM_DELTAS 0x07
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 /* Secure Channel types. used in NetrServerAuthenticate negotiation */
49 #define SEC_CHAN_WKSTA 2
50 #define SEC_CHAN_DOMAIN 4
51 #define SEC_CHAN_BDC 6
53 /* Returned delta types */
54 #define SAM_DELTA_DOMAIN_INFO 0x01
55 #define SAM_DELTA_GROUP_INFO 0x02
56 #define SAM_DELTA_RENAME_GROUP 0x04
57 #define SAM_DELTA_ACCOUNT_INFO 0x05
58 #define SAM_DELTA_RENAME_USER 0x07
59 #define SAM_DELTA_GROUP_MEM 0x08
60 #define SAM_DELTA_ALIAS_INFO 0x09
61 #define SAM_DELTA_RENAME_ALIAS 0x0b
62 #define SAM_DELTA_ALIAS_MEM 0x0c
63 #define SAM_DELTA_POLICY_INFO 0x0d
64 #define SAM_DELTA_TRUST_DOMS 0x0e
65 #define SAM_DELTA_PRIVS_INFO 0x10 /* DT_DELTA_ACCOUNTS */
66 #define SAM_DELTA_SECRET_INFO 0x12
67 #define SAM_DELTA_DELETE_GROUP 0x14
68 #define SAM_DELTA_DELETE_USER 0x15
69 #define SAM_DELTA_MODIFIED_COUNT 0x16
71 /* SAM database types */
72 #define SAM_DATABASE_DOMAIN 0x00 /* Domain users and groups */
73 #define SAM_DATABASE_BUILTIN 0x01 /* BUILTIN users and groups */
74 #define SAM_DATABASE_PRIVS 0x02 /* Privileges */
76 /* flags use when sending a NETLOGON_CONTROL request */
78 #define NETLOGON_CONTROL_SYNC 0x2
79 #define NETLOGON_CONTROL_REDISCOVER 0x5
80 #define NETLOGON_CONTROL_TC_QUERY 0x6
81 #define NETLOGON_CONTROL_TRANSPORT_NOTIFY 0x7
82 #define NETLOGON_CONTROL_SET_DBFLAG 0xfffe
84 /* Some flag values reverse engineered from NLTEST.EXE */
85 /* used in the NETLOGON_CONTROL[2] reply */
87 #define NL_CTRL_IN_SYNC 0x0000
88 #define NL_CTRL_REPL_NEEDED 0x0001
89 #define NL_CTRL_REPL_IN_PROGRESS 0x0002
90 #define NL_CTRL_FULL_SYNC 0x0004
92 #define LOGON_GUEST 0x00000001
93 #define LOGON_NOENCRYPTION 0x00000002
94 #define LOGON_CACHED_ACCOUNT 0x00000004
95 #define LOGON_USED_LM_PASSWORD 0x00000008
96 #define LOGON_EXTRA_SIDS 0x00000020
97 #define LOGON_SUBAUTH_SESSION_KEY 0x00000040
98 #define LOGON_SERVER_TRUST_ACCOUNT 0x00000080
99 #define LOGON_NTLMV2_ENABLED 0x00000100
100 #define LOGON_RESOURCE_GROUPS 0x00000200
101 #define LOGON_PROFILE_PATH_RETURNED 0x00000400
102 #define LOGON_GRACE_LOGON 0x01000000
104 #define SE_GROUP_MANDATORY 0x00000001
105 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
106 #define SE_GROUP_ENABLED 0x00000004
107 #define SE_GROUP_OWNER 0x00000008
108 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
109 #define SE_GROUP_LOGON_ID 0xC0000000
110 #define SE_GROUP_RESOURCE 0x20000000
112 /* Flags for controlling the behaviour of a particular logon */
114 /* sets LOGON_SERVER_TRUST_ACCOUNT user_flag */
115 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020
116 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800
118 /* updates the "logon time" on network logon */
119 #define MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004
121 /* returns the user parameters in the driveletter */
122 #define MSV1_0_RETURN_USER_PARAMETERS 0x00000008
124 /* returns the profilepath in the driveletter and
125 * sets LOGON_PROFILE_PATH_RETURNED user_flag */
126 #define MSV1_0_RETURN_PROFILE_PATH 0x00000200
128 #if 0
129 /* I think this is correct - it's what gets parsed on the wire. JRA. */
130 /* NET_USER_INFO_2 */
131 typedef struct net_user_info_2 {
132 uint32 ptr_user_info;
134 NTTIME logon_time; /* logon time */
135 NTTIME logoff_time; /* logoff time */
136 NTTIME kickoff_time; /* kickoff time */
137 NTTIME pass_last_set_time; /* password last set time */
138 NTTIME pass_can_change_time; /* password can change time */
139 NTTIME pass_must_change_time; /* password must change time */
141 UNIHDR hdr_user_name; /* username unicode string header */
142 UNIHDR hdr_full_name; /* user's full name unicode string header */
143 UNIHDR hdr_logon_script; /* logon script unicode string header */
144 UNIHDR hdr_profile_path; /* profile path unicode string header */
145 UNIHDR hdr_home_dir; /* home directory unicode string header */
146 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
148 uint16 logon_count; /* logon count */
149 uint16 bad_pw_count; /* bad password count */
151 uint32 user_id; /* User ID */
152 uint32 group_id; /* Group ID */
153 uint32 num_groups; /* num groups */
154 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
155 uint32 user_flgs; /* user flags */
157 uint8 user_sess_key[16]; /* unused user session key */
159 UNIHDR hdr_logon_srv; /* logon server unicode string header */
160 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
162 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
163 uint8 padding[40]; /* unused padding bytes. expansion room */
165 UNISTR2 uni_user_name; /* username unicode string */
166 UNISTR2 uni_full_name; /* user's full name unicode string */
167 UNISTR2 uni_logon_script; /* logon script unicode string */
168 UNISTR2 uni_profile_path; /* profile path unicode string */
169 UNISTR2 uni_home_dir; /* home directory unicode string */
170 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
172 uint32 num_groups2; /* num groups */
173 DOM_GID *gids; /* group info */
175 UNISTR2 uni_logon_srv; /* logon server unicode string */
176 UNISTR2 uni_logon_dom; /* logon domain unicode string */
178 DOM_SID2 dom_sid; /* domain SID */
180 uint32 num_other_groups; /* other groups */
181 DOM_GID *other_gids; /* group info */
182 DOM_SID2 *other_sids; /* undocumented - domain SIDs */
184 } NET_USER_INFO_2;
185 #endif
187 /* NET_USER_INFO_2 */
188 typedef struct net_user_info_2 {
189 uint32 ptr_user_info;
191 NTTIME logon_time; /* logon time */
192 NTTIME logoff_time; /* logoff time */
193 NTTIME kickoff_time; /* kickoff time */
194 NTTIME pass_last_set_time; /* password last set time */
195 NTTIME pass_can_change_time; /* password can change time */
196 NTTIME pass_must_change_time; /* password must change time */
198 UNIHDR hdr_user_name; /* username unicode string header */
199 UNIHDR hdr_full_name; /* user's full name unicode string header */
200 UNIHDR hdr_logon_script; /* logon script unicode string header */
201 UNIHDR hdr_profile_path; /* profile path unicode string header */
202 UNIHDR hdr_home_dir; /* home directory unicode string header */
203 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
205 uint16 logon_count; /* logon count */
206 uint16 bad_pw_count; /* bad password count */
208 uint32 user_rid; /* User RID */
209 uint32 group_rid; /* Group RID */
211 uint32 num_groups; /* num groups */
212 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
213 uint32 user_flgs; /* user flags */
215 uint8 user_sess_key[16]; /* user session key */
217 UNIHDR hdr_logon_srv; /* logon server unicode string header */
218 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
220 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
221 uint8 lm_sess_key[8]; /* lm session key */
222 uint32 acct_flags; /* account flags */
223 uint32 unknown[7]; /* unknown */
225 UNISTR2 uni_user_name; /* username unicode string */
226 UNISTR2 uni_full_name; /* user's full name unicode string */
227 UNISTR2 uni_logon_script; /* logon script unicode string */
228 UNISTR2 uni_profile_path; /* profile path unicode string */
229 UNISTR2 uni_home_dir; /* home directory unicode string */
230 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
232 UNISTR2 uni_logon_srv; /* logon server unicode string */
233 UNISTR2 uni_logon_dom; /* logon domain unicode string */
235 DOM_SID2 dom_sid; /* domain SID */
236 } NET_USER_INFO_2;
238 /* NET_USER_INFO_3 */
239 typedef struct net_user_info_3 {
240 uint32 ptr_user_info;
242 NTTIME logon_time; /* logon time */
243 NTTIME logoff_time; /* logoff time */
244 NTTIME kickoff_time; /* kickoff time */
245 NTTIME pass_last_set_time; /* password last set time */
246 NTTIME pass_can_change_time; /* password can change time */
247 NTTIME pass_must_change_time; /* password must change time */
249 UNIHDR hdr_user_name; /* username unicode string header */
250 UNIHDR hdr_full_name; /* user's full name unicode string header */
251 UNIHDR hdr_logon_script; /* logon script unicode string header */
252 UNIHDR hdr_profile_path; /* profile path unicode string header */
253 UNIHDR hdr_home_dir; /* home directory unicode string header */
254 UNIHDR hdr_dir_drive; /* home directory drive unicode string header */
256 uint16 logon_count; /* logon count */
257 uint16 bad_pw_count; /* bad password count */
259 uint32 user_rid; /* User RID */
260 uint32 group_rid; /* Group RID */
262 uint32 num_groups; /* num groups */
263 uint32 buffer_groups; /* undocumented buffer pointer to groups. */
264 uint32 user_flgs; /* user flags */
266 uint8 user_sess_key[16]; /* user session key */
268 UNIHDR hdr_logon_srv; /* logon server unicode string header */
269 UNIHDR hdr_logon_dom; /* logon domain unicode string header */
271 uint32 buffer_dom_id; /* undocumented logon domain id pointer */
272 uint8 lm_sess_key[8]; /* lm session key */
273 uint32 acct_flags; /* account flags */
274 uint32 unknown[7]; /* unknown */
276 uint32 num_other_sids; /* number of foreign/trusted domain sids */
277 uint32 buffer_other_sids;
279 /* The next three uint32 are not really part of user_info_3 but here
280 * for parsing convenience. They are only valid in Kerberos PAC
281 * parsing - Guenther */
282 uint32 ptr_res_group_dom_sid;
283 uint32 res_group_count;
284 uint32 ptr_res_groups;
286 UNISTR2 uni_user_name; /* username unicode string */
287 UNISTR2 uni_full_name; /* user's full name unicode string */
288 UNISTR2 uni_logon_script; /* logon script unicode string */
289 UNISTR2 uni_profile_path; /* profile path unicode string */
290 UNISTR2 uni_home_dir; /* home directory unicode string */
291 UNISTR2 uni_dir_drive; /* home directory drive unicode string */
293 uint32 num_groups2; /* num groups */
294 DOM_GID *gids; /* group info */
296 UNISTR2 uni_logon_srv; /* logon server unicode string */
297 UNISTR2 uni_logon_dom; /* logon domain unicode string */
299 DOM_SID2 dom_sid; /* domain SID */
301 DOM_SID2 *other_sids; /* foreign/trusted domain SIDs */
302 uint32 *other_sids_attrib;
303 } NET_USER_INFO_3;
306 /* NETLOGON_INFO_1 - pdc status info, i presume */
307 typedef struct netlogon_1_info {
308 uint32 flags; /* 0x0 - undocumented */
309 uint32 pdc_status; /* 0x0 - undocumented */
310 } NETLOGON_INFO_1;
312 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
313 typedef struct netlogon_2_info {
314 uint32 flags; /* 0x0 - undocumented */
315 uint32 pdc_status; /* 0x0 - undocumented */
316 uint32 ptr_trusted_dc_name; /* pointer to trusted domain controller name */
317 uint32 tc_status;
318 UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
319 } NETLOGON_INFO_2;
321 /* NETLOGON_INFO_3 - logon status info, i presume */
322 typedef struct netlogon_3_info {
323 uint32 flags; /* 0x0 - undocumented */
324 uint32 logon_attempts; /* number of logon attempts */
325 uint32 reserved_1; /* 0x0 - undocumented */
326 uint32 reserved_2; /* 0x0 - undocumented */
327 uint32 reserved_3; /* 0x0 - undocumented */
328 uint32 reserved_4; /* 0x0 - undocumented */
329 uint32 reserved_5; /* 0x0 - undocumented */
330 } NETLOGON_INFO_3;
332 /********************************************************
333 Logon Control Query
335 This is generated by a nltest /bdc_query:DOMAIN
337 query_level 0x1, function_code 0x1
339 ********************************************************/
341 /* NET_Q_LOGON_CTRL - LSA Netr Logon Control */
343 typedef struct net_q_logon_ctrl_info {
344 uint32 ptr;
345 UNISTR2 uni_server_name;
346 uint32 function_code;
347 uint32 query_level;
348 } NET_Q_LOGON_CTRL;
350 /* NET_R_LOGON_CTRL - LSA Netr Logon Control */
352 typedef struct net_r_logon_ctrl_info {
353 uint32 switch_value;
354 uint32 ptr;
356 union {
357 NETLOGON_INFO_1 info1;
358 } logon;
360 NTSTATUS status;
361 } NET_R_LOGON_CTRL;
364 typedef struct ctrl_data_info_5 {
365 uint32 function_code;
367 uint32 ptr_domain;
368 UNISTR2 domain;
369 } CTRL_DATA_INFO_5;
371 typedef struct ctrl_data_info_6 {
372 uint32 function_code;
374 uint32 ptr_domain;
375 UNISTR2 domain;
376 } CTRL_DATA_INFO_6;
379 /********************************************************
380 Logon Control2 Query
382 query_level 0x1 - pdc status
383 query_level 0x3 - number of logon attempts.
385 ********************************************************/
387 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2 */
388 typedef struct net_q_logon_ctrl2_info {
389 uint32 ptr; /* undocumented buffer pointer */
390 UNISTR2 uni_server_name; /* server name, starting with two '\'s */
392 uint32 function_code;
393 uint32 query_level;
394 union {
395 CTRL_DATA_INFO_5 info5;
396 CTRL_DATA_INFO_6 info6;
397 } info;
398 } NET_Q_LOGON_CTRL2;
400 /*******************************************************
401 Logon Control Response
403 switch_value is same as query_level in request
404 *******************************************************/
406 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
407 typedef struct net_r_logon_ctrl2_info {
408 uint32 switch_value; /* 0x1, 0x3 */
409 uint32 ptr;
411 union
413 NETLOGON_INFO_1 info1;
414 NETLOGON_INFO_2 info2;
415 NETLOGON_INFO_3 info3;
417 } logon;
419 NTSTATUS status; /* return code */
420 } NET_R_LOGON_CTRL2;
422 /* NET_Q_GETANYDCNAME - Ask a DC for a trusted DC name */
424 typedef struct net_q_getanydcname {
425 uint32 ptr_logon_server;
426 UNISTR2 uni_logon_server;
427 uint32 ptr_domainname;
428 UNISTR2 uni_domainname;
429 } NET_Q_GETANYDCNAME;
431 /* NET_R_GETANYDCNAME - Ask a DC for a trusted DC name */
433 typedef struct net_r_getanydcname {
434 uint32 ptr_dcname;
435 UNISTR2 uni_dcname;
436 WERROR status;
437 } NET_R_GETANYDCNAME;
439 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
440 typedef struct net_q_trust_dom_info {
441 uint32 ptr; /* undocumented buffer pointer */
442 UNISTR2 uni_server_name; /* server name, starting with two '\'s */
443 } NET_Q_TRUST_DOM_LIST;
445 #define MAX_TRUST_DOMS 1
447 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
448 typedef struct net_r_trust_dom_info {
449 UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
451 NTSTATUS status; /* return code */
452 } NET_R_TRUST_DOM_LIST;
455 /* NEG_FLAGS */
456 typedef struct neg_flags_info {
457 uint32 neg_flags; /* negotiated flags */
458 } NEG_FLAGS;
461 /* NET_Q_REQ_CHAL */
462 typedef struct net_q_req_chal_info {
463 uint32 undoc_buffer; /* undocumented buffer pointer */
464 UNISTR2 uni_logon_srv; /* logon server unicode string */
465 UNISTR2 uni_logon_clnt; /* logon client unicode string */
466 DOM_CHAL clnt_chal; /* client challenge */
467 } NET_Q_REQ_CHAL;
470 /* NET_R_REQ_CHAL */
471 typedef struct net_r_req_chal_info {
472 DOM_CHAL srv_chal; /* server challenge */
473 NTSTATUS status; /* return code */
474 } NET_R_REQ_CHAL;
476 /* NET_Q_AUTH */
477 typedef struct net_q_auth_info {
478 DOM_LOG_INFO clnt_id; /* client identification info */
479 DOM_CHAL clnt_chal; /* client-calculated credentials */
480 } NET_Q_AUTH;
482 /* NET_R_AUTH */
483 typedef struct net_r_auth_info {
484 DOM_CHAL srv_chal; /* server-calculated credentials */
485 NTSTATUS status; /* return code */
486 } NET_R_AUTH;
488 /* NET_Q_AUTH_2 */
489 typedef struct net_q_auth2_info {
490 DOM_LOG_INFO clnt_id; /* client identification info */
491 DOM_CHAL clnt_chal; /* client-calculated credentials */
493 NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
494 } NET_Q_AUTH_2;
497 /* NET_R_AUTH_2 */
498 typedef struct net_r_auth2_info {
499 DOM_CHAL srv_chal; /* server-calculated credentials */
500 NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
501 NTSTATUS status; /* return code */
502 } NET_R_AUTH_2;
504 /* NET_Q_AUTH_3 */
505 typedef struct net_q_auth3_info {
506 DOM_LOG_INFO clnt_id; /* client identification info */
507 DOM_CHAL clnt_chal; /* client-calculated credentials */
508 NEG_FLAGS clnt_flgs; /* usually 0x6007 ffff */
509 } NET_Q_AUTH_3;
511 /* NET_R_AUTH_3 */
512 typedef struct net_r_auth3_info {
513 DOM_CHAL srv_chal; /* server-calculated credentials */
514 NEG_FLAGS srv_flgs; /* usually 0x6007 ffff */
515 uint32 unknown; /* 0x0000045b */
516 NTSTATUS status; /* return code */
517 } NET_R_AUTH_3;
520 /* NET_Q_SRV_PWSET */
521 typedef struct net_q_srv_pwset_info {
522 DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
523 uint8 pwd[16]; /* new password - undocumented. */
524 } NET_Q_SRV_PWSET;
526 /* NET_R_SRV_PWSET */
527 typedef struct net_r_srv_pwset_info {
528 DOM_CRED srv_cred; /* server-calculated credentials */
530 NTSTATUS status; /* return code */
531 } NET_R_SRV_PWSET;
533 /* NET_ID_INFO_2 */
534 typedef struct net_network_info_2 {
535 uint32 ptr_id_info2; /* pointer to id_info_2 */
536 UNIHDR hdr_domain_name; /* domain name unicode header */
537 uint32 param_ctrl; /* param control (0x2) */
538 DOM_LOGON_ID logon_id; /* logon ID */
539 UNIHDR hdr_user_name; /* user name unicode header */
540 UNIHDR hdr_wksta_name; /* workstation name unicode header */
541 uint8 lm_chal[8]; /* lan manager 8 byte challenge */
542 STRHDR hdr_nt_chal_resp; /* nt challenge response */
543 STRHDR hdr_lm_chal_resp; /* lm challenge response */
545 UNISTR2 uni_domain_name; /* domain name unicode string */
546 UNISTR2 uni_user_name; /* user name unicode string */
547 UNISTR2 uni_wksta_name; /* workgroup name unicode string */
548 STRING2 nt_chal_resp; /* nt challenge response */
549 STRING2 lm_chal_resp; /* lm challenge response */
550 } NET_ID_INFO_2;
552 /* NET_ID_INFO_1 */
553 typedef struct id_info_1 {
554 uint32 ptr_id_info1; /* pointer to id_info_1 */
555 UNIHDR hdr_domain_name; /* domain name unicode header */
556 uint32 param_ctrl; /* param control */
557 DOM_LOGON_ID logon_id; /* logon ID */
558 UNIHDR hdr_user_name; /* user name unicode header */
559 UNIHDR hdr_wksta_name; /* workstation name unicode header */
560 OWF_INFO lm_owf; /* LM OWF Password */
561 OWF_INFO nt_owf; /* NT OWF Password */
562 UNISTR2 uni_domain_name; /* domain name unicode string */
563 UNISTR2 uni_user_name; /* user name unicode string */
564 UNISTR2 uni_wksta_name; /* workgroup name unicode string */
565 } NET_ID_INFO_1;
567 #define INTERACTIVE_LOGON_TYPE 1
568 #define NET_LOGON_TYPE 2
570 /* NET_ID_INFO_CTR */
571 typedef struct net_id_info_ctr_info {
572 uint16 switch_value;
574 union {
575 NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
576 NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
577 } auth;
578 } NET_ID_INFO_CTR;
580 /* SAM_INFO - sam logon/off id structure */
581 typedef struct sam_info {
582 DOM_CLNT_INFO2 client;
583 uint32 ptr_rtn_cred; /* pointer to return credentials */
584 DOM_CRED rtn_cred; /* return credentials */
585 uint16 logon_level;
586 NET_ID_INFO_CTR *ctr;
587 } DOM_SAM_INFO;
589 /* SAM_INFO - sam logon/off id structure - no creds */
590 typedef struct sam_info_ex {
591 DOM_CLNT_SRV client;
592 uint16 logon_level;
593 NET_ID_INFO_CTR *ctr;
594 } DOM_SAM_INFO_EX;
596 /* NET_Q_SAM_LOGON */
597 typedef struct net_q_sam_logon_info {
598 DOM_SAM_INFO sam_id;
599 uint16 validation_level;
600 } NET_Q_SAM_LOGON;
602 /* NET_Q_SAM_LOGON_EX */
603 typedef struct net_q_sam_logon_info_ex {
604 DOM_SAM_INFO_EX sam_id;
605 uint16 validation_level;
606 uint32 flags;
607 } NET_Q_SAM_LOGON_EX;
609 /* NET_R_SAM_LOGON */
610 typedef struct net_r_sam_logon_info {
611 uint32 buffer_creds; /* undocumented buffer pointer */
612 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
614 uint16 switch_value; /* 3 - indicates type of USER INFO */
615 NET_USER_INFO_3 *user;
617 uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
619 NTSTATUS status; /* return code */
620 } NET_R_SAM_LOGON;
622 /* NET_R_SAM_LOGON_EX */
623 typedef struct net_r_sam_logon_info_ex {
624 uint16 switch_value; /* 3 - indicates type of USER INFO */
625 NET_USER_INFO_3 *user;
627 uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
628 uint32 flags;
630 NTSTATUS status; /* return code */
631 } NET_R_SAM_LOGON_EX;
634 /* NET_Q_SAM_LOGOFF */
635 typedef struct net_q_sam_logoff_info {
636 DOM_SAM_INFO sam_id;
637 } NET_Q_SAM_LOGOFF;
639 /* NET_R_SAM_LOGOFF */
640 typedef struct net_r_sam_logoff_info {
641 uint32 buffer_creds; /* undocumented buffer pointer */
642 DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */
643 NTSTATUS status; /* return code */
644 } NET_R_SAM_LOGOFF;
646 /* NET_Q_SAM_SYNC */
647 typedef struct net_q_sam_sync_info {
648 UNISTR2 uni_srv_name; /* \\PDC */
649 UNISTR2 uni_cli_name; /* BDC */
650 DOM_CRED cli_creds;
651 DOM_CRED ret_creds;
653 uint32 database_id;
654 uint32 restart_state;
655 uint32 sync_context;
657 uint32 max_size; /* preferred maximum length */
658 } NET_Q_SAM_SYNC;
660 /* SAM_DELTA_HDR */
661 typedef struct sam_delta_hdr_info {
662 uint16 type; /* type of structure attached */
663 uint16 type2;
664 uint32 target_rid;
666 uint32 type3;
667 uint32 ptr_delta;
668 } SAM_DELTA_HDR;
670 /* LOCKOUT_STRING */
671 typedef struct account_lockout_string {
672 uint32 array_size;
673 uint32 offset;
674 uint32 length;
675 /* uint16 *bindata; */
676 uint64 lockout_duration;
677 uint64 reset_count;
678 uint32 bad_attempt_lockout;
679 uint32 dummy;
680 } LOCKOUT_STRING;
682 /* HDR_LOCKOUT_STRING */
683 typedef struct hdr_account_lockout_string {
684 uint16 size;
685 uint16 length;
686 uint32 buffer;
687 } HDR_LOCKOUT_STRING;
689 /* SAM_DOMAIN_INFO (0x1) */
690 typedef struct sam_domain_info_info {
691 UNIHDR hdr_dom_name;
692 UNIHDR hdr_oem_info;
694 uint64 force_logoff;
695 uint16 min_pwd_len;
696 uint16 pwd_history_len;
697 uint64 max_pwd_age;
698 uint64 min_pwd_age;
699 uint64 dom_mod_count;
700 NTTIME creation_time;
701 uint32 security_information;
703 BUFHDR4 hdr_sec_desc; /* security descriptor */
705 HDR_LOCKOUT_STRING hdr_account_lockout;
707 UNIHDR hdr_unknown2;
708 UNIHDR hdr_unknown3;
709 UNIHDR hdr_unknown4;
711 UNISTR2 uni_dom_name;
712 UNISTR2 buf_oem_info;
714 RPC_DATA_BLOB buf_sec_desc;
716 LOCKOUT_STRING account_lockout;
718 UNISTR2 buf_unknown2;
719 UNISTR2 buf_unknown3;
720 UNISTR2 buf_unknown4;
722 uint32 logon_chgpass;
723 uint32 unknown6;
724 uint32 unknown7;
725 uint32 unknown8;
726 } SAM_DOMAIN_INFO;
728 /* SAM_GROUP_INFO (0x2) */
729 typedef struct sam_group_info_info {
730 UNIHDR hdr_grp_name;
731 DOM_GID gid;
732 UNIHDR hdr_grp_desc;
733 BUFHDR2 hdr_sec_desc; /* security descriptor */
734 uint8 reserved[48];
736 UNISTR2 uni_grp_name;
737 UNISTR2 uni_grp_desc;
738 RPC_DATA_BLOB buf_sec_desc;
739 } SAM_GROUP_INFO;
741 /* SAM_PWD */
742 typedef struct sam_passwd_info {
743 /* this structure probably contains password history */
744 /* this is probably a count of lm/nt pairs */
745 uint32 unk_0; /* 0x0000 0002 */
747 UNIHDR hdr_lm_pwd;
748 uint8 buf_lm_pwd[16];
750 UNIHDR hdr_nt_pwd;
751 uint8 buf_nt_pwd[16];
753 UNIHDR hdr_empty_lm;
754 UNIHDR hdr_empty_nt;
755 } SAM_PWD;
757 /* SAM_ACCOUNT_INFO (0x5) */
758 typedef struct sam_account_info_info {
759 UNIHDR hdr_acct_name;
760 UNIHDR hdr_full_name;
762 uint32 user_rid;
763 uint32 group_rid;
765 UNIHDR hdr_home_dir;
766 UNIHDR hdr_dir_drive;
767 UNIHDR hdr_logon_script;
768 UNIHDR hdr_acct_desc;
769 UNIHDR hdr_workstations;
771 NTTIME logon_time;
772 NTTIME logoff_time;
774 uint32 logon_divs; /* 0xA8 */
775 uint32 ptr_logon_hrs;
777 uint16 bad_pwd_count;
778 uint16 logon_count;
779 NTTIME pwd_last_set_time;
780 NTTIME acct_expiry_time;
782 uint32 acb_info;
783 uint8 nt_pwd[16];
784 uint8 lm_pwd[16];
785 uint8 nt_pwd_present;
786 uint8 lm_pwd_present;
787 uint8 pwd_expired;
789 UNIHDR hdr_comment;
790 UNIHDR hdr_parameters;
791 uint16 country;
792 uint16 codepage;
794 BUFHDR2 hdr_sec_desc; /* security descriptor */
796 UNIHDR hdr_profile;
797 UNIHDR hdr_reserved[3]; /* space for more strings */
798 uint32 dw_reserved[4]; /* space for more data - first two seem to
799 be an NTTIME */
801 UNISTR2 uni_acct_name;
802 UNISTR2 uni_full_name;
803 UNISTR2 uni_home_dir;
804 UNISTR2 uni_dir_drive;
805 UNISTR2 uni_logon_script;
806 UNISTR2 uni_acct_desc;
807 UNISTR2 uni_workstations;
809 uint32 unknown1; /* 0x4EC */
810 uint32 unknown2; /* 0 */
812 RPC_DATA_BLOB buf_logon_hrs;
813 UNISTR2 uni_comment;
814 UNISTR2 uni_parameters;
815 SAM_PWD pass;
816 RPC_DATA_BLOB buf_sec_desc;
817 UNISTR2 uni_profile;
818 } SAM_ACCOUNT_INFO;
820 /* SAM_GROUP_MEM_INFO (0x8) */
821 typedef struct sam_group_mem_info_info {
822 uint32 ptr_rids;
823 uint32 ptr_attribs;
824 uint32 num_members;
825 uint8 unknown[16];
827 uint32 num_members2;
828 uint32 *rids;
830 uint32 num_members3;
831 uint32 *attribs;
833 } SAM_GROUP_MEM_INFO;
835 /* SAM_ALIAS_INFO (0x9) */
836 typedef struct sam_alias_info_info {
837 UNIHDR hdr_als_name;
838 uint32 als_rid;
839 BUFHDR2 hdr_sec_desc; /* security descriptor */
840 UNIHDR hdr_als_desc;
841 uint8 reserved[40];
843 UNISTR2 uni_als_name;
844 RPC_DATA_BLOB buf_sec_desc;
845 UNISTR2 uni_als_desc;
846 } SAM_ALIAS_INFO;
848 /* SAM_ALIAS_MEM_INFO (0xC) */
849 typedef struct sam_alias_mem_info_info {
850 uint32 num_members;
851 uint32 ptr_members;
852 uint8 unknown[16];
854 uint32 num_sids;
855 uint32 *ptr_sids;
856 DOM_SID2 *sids;
857 } SAM_ALIAS_MEM_INFO;
860 /* SAM_DELTA_POLICY (0x0D) */
861 typedef struct {
862 uint32 max_log_size; /* 0x5000 */
863 uint64 audit_retention_period; /* 0 */
864 uint32 auditing_mode; /* 0 */
865 uint32 num_events;
866 uint32 ptr_events;
867 UNIHDR hdr_dom_name;
868 uint32 sid_ptr;
870 uint32 paged_pool_limit; /* 0x02000000 */
871 uint32 non_paged_pool_limit; /* 0x00100000 */
872 uint32 min_workset_size; /* 0x00010000 */
873 uint32 max_workset_size; /* 0x0f000000 */
874 uint32 page_file_limit; /* 0 */
875 uint64 time_limit; /* 0 */
876 NTTIME modify_time; /* 0x3c*/
877 NTTIME create_time; /* a7080110 */
878 BUFHDR2 hdr_sec_desc;
880 uint32 num_event_audit_options;
881 uint32 event_audit_option;
883 UNISTR2 domain_name;
884 DOM_SID2 domain_sid;
886 RPC_DATA_BLOB buf_sec_desc;
887 } SAM_DELTA_POLICY;
889 /* SAM_DELTA_TRUST_DOMS */
890 typedef struct {
891 uint32 buf_size;
892 SEC_DESC *sec_desc;
893 DOM_SID2 sid;
894 UNIHDR hdr_domain;
896 uint32 unknown0;
897 uint32 unknown1;
898 uint32 unknown2;
900 uint32 buf_size2;
901 uint32 ptr;
903 uint32 unknown3;
904 UNISTR2 domain;
905 } SAM_DELTA_TRUSTDOMS;
907 /* SAM_DELTA_PRIVS (0x10) */
908 typedef struct {
909 DOM_SID2 sid;
911 uint32 priv_count;
912 uint32 priv_control;
914 uint32 priv_attr_ptr;
915 uint32 priv_name_ptr;
917 uint32 paged_pool_limit; /* 0x02000000 */
918 uint32 non_paged_pool_limit; /* 0x00100000 */
919 uint32 min_workset_size; /* 0x00010000 */
920 uint32 max_workset_size; /* 0x0f000000 */
921 uint32 page_file_limit; /* 0 */
922 uint64 time_limit; /* 0 */
923 uint32 system_flags; /* 1 */
924 BUFHDR2 hdr_sec_desc;
926 uint32 buf_size2;
928 uint32 attribute_count;
929 uint32 *attributes;
931 uint32 privlist_count;
932 UNIHDR *hdr_privslist;
933 UNISTR2 *uni_privslist;
935 RPC_DATA_BLOB buf_sec_desc;
936 } SAM_DELTA_PRIVS;
938 /* SAM_DELTA_SECRET */
939 typedef struct {
940 uint32 buf_size;
941 SEC_DESC *sec_desc;
942 UNISTR2 secret;
944 uint32 count1;
945 uint32 count2;
946 uint32 ptr;
947 NTTIME time1;
948 uint32 count3;
949 uint32 count4;
950 uint32 ptr2;
951 NTTIME time2;
952 uint32 unknow1;
954 uint32 buf_size2;
955 uint32 ptr3;
956 uint32 unknow2; /* 0x0 12 times */
958 uint32 chal_len;
959 uint32 reserved1; /* 0 */
960 uint32 chal_len2;
961 uint8 chal[16];
963 uint32 key_len;
964 uint32 reserved2; /* 0 */
965 uint32 key_len2;
966 uint8 key[8];
968 uint32 buf_size3;
969 SEC_DESC *sec_desc2;
970 } SAM_DELTA_SECRET;
972 /* SAM_DELTA_MOD_COUNT (0x16) */
973 typedef struct {
974 uint32 seqnum;
975 uint32 dom_mod_count_ptr;
976 uint64 dom_mod_count; /* domain mod count at last sync */
977 } SAM_DELTA_MOD_COUNT;
979 typedef union sam_delta_ctr_info {
980 SAM_DOMAIN_INFO domain_info ;
981 SAM_GROUP_INFO group_info ;
982 SAM_ACCOUNT_INFO account_info;
983 SAM_GROUP_MEM_INFO grp_mem_info;
984 SAM_ALIAS_INFO alias_info ;
985 SAM_ALIAS_MEM_INFO als_mem_info;
986 SAM_DELTA_POLICY policy_info;
987 SAM_DELTA_PRIVS privs_info;
988 SAM_DELTA_MOD_COUNT mod_count;
989 SAM_DELTA_TRUSTDOMS trustdoms_info;
990 SAM_DELTA_SECRET secret_info;
991 } SAM_DELTA_CTR;
993 /* NET_R_SAM_SYNC */
994 typedef struct net_r_sam_sync_info {
995 DOM_CRED srv_creds;
997 uint32 sync_context;
999 uint32 ptr_deltas;
1000 uint32 num_deltas;
1001 uint32 ptr_deltas2;
1002 uint32 num_deltas2;
1004 SAM_DELTA_HDR *hdr_deltas;
1005 SAM_DELTA_CTR *deltas;
1007 NTSTATUS status;
1008 } NET_R_SAM_SYNC;
1010 /* NET_Q_SAM_DELTAS */
1011 typedef struct net_q_sam_deltas_info {
1012 UNISTR2 uni_srv_name;
1013 UNISTR2 uni_cli_name;
1014 DOM_CRED cli_creds;
1015 DOM_CRED ret_creds;
1017 uint32 database_id;
1018 uint64 dom_mod_count; /* domain mod count at last sync */
1020 uint32 max_size; /* preferred maximum length */
1021 } NET_Q_SAM_DELTAS;
1023 /* NET_R_SAM_DELTAS */
1024 typedef struct net_r_sam_deltas_info {
1025 DOM_CRED srv_creds;
1027 uint64 dom_mod_count; /* new domain mod count */
1029 uint32 ptr_deltas;
1030 uint32 num_deltas;
1031 uint32 num_deltas2;
1033 SAM_DELTA_HDR *hdr_deltas;
1034 SAM_DELTA_CTR *deltas;
1036 NTSTATUS status;
1037 } NET_R_SAM_DELTAS;
1039 #define DS_FORCE_REDISCOVERY 0x00000001
1040 #define DS_DIRECTORY_SERVICE_REQUIRED 0x00000010
1041 #define DS_DIRECTORY_SERVICE_PREFERRED 0x00000020
1042 #define DS_GC_SERVER_REQUIRED 0x00000040
1043 #define DS_PDC_REQUIRED 0x00000080
1044 #define DS_BACKGROUND_ONLY 0x00000100
1045 #define DS_IP_REQUIRED 0x00000200
1046 #define DS_KDC_REQUIRED 0x00000400
1047 #define DS_TIMESERV_REQUIRED 0x00000800
1048 #define DS_WRITABLE_REQUIRED 0x00001000
1049 #define DS_GOOD_TIMESERV_PREFERRED 0x00002000
1050 #define DS_AVOID_SELF 0x00004000
1051 #define DS_ONLY_LDAP_NEEDED 0x00008000
1053 #define DS_IS_FLAT_NAME 0x00010000
1054 #define DS_IS_DNS_NAME 0x00020000
1056 #define DS_RETURN_DNS_NAME 0x40000000
1057 #define DS_RETURN_FLAT_NAME 0x80000000
1059 #if 0 /* unknown yet */
1060 #define DS_IP_VERSION_AGNOSTIC
1061 #define DS_TRY_NEXTCLOSEST_SITE
1062 #endif
1064 #define DSGETDC_VALID_FLAGS ( \
1065 DS_FORCE_REDISCOVERY | \
1066 DS_DIRECTORY_SERVICE_REQUIRED | \
1067 DS_DIRECTORY_SERVICE_PREFERRED | \
1068 DS_GC_SERVER_REQUIRED | \
1069 DS_PDC_REQUIRED | \
1070 DS_BACKGROUND_ONLY | \
1071 DS_IP_REQUIRED | \
1072 DS_KDC_REQUIRED | \
1073 DS_TIMESERV_REQUIRED | \
1074 DS_WRITABLE_REQUIRED | \
1075 DS_GOOD_TIMESERV_PREFERRED | \
1076 DS_AVOID_SELF | \
1077 DS_ONLY_LDAP_NEEDED | \
1078 DS_IS_FLAT_NAME | \
1079 DS_IS_DNS_NAME | \
1080 DS_RETURN_FLAT_NAME | \
1081 DS_RETURN_DNS_NAME )
1083 struct DS_DOMAIN_CONTROLLER_INFO {
1084 const char *domain_controller_name;
1085 const char *domain_controller_address;
1086 int32 domain_controller_address_type;
1087 struct GUID *domain_guid;
1088 const char *domain_name;
1089 const char *dns_forest_name;
1090 uint32 flags;
1091 const char *dc_site_name;
1092 const char *client_site_name;
1095 /* NET_Q_DSR_GETDCNAME */
1096 typedef struct net_q_dsr_getdcname {
1097 uint32 ptr_server_unc;
1098 UNISTR2 uni_server_unc;
1099 uint32 ptr_domain_name;
1100 UNISTR2 uni_domain_name;
1101 uint32 ptr_domain_guid;
1102 struct GUID *domain_guid;
1103 uint32 ptr_site_guid;
1104 struct GUID *site_guid;
1105 uint32 flags;
1106 } NET_Q_DSR_GETDCNAME;
1108 /* NET_R_DSR_GETDCNAME */
1109 typedef struct net_r_dsr_getdcname {
1110 uint32 ptr_dc_unc;
1111 UNISTR2 uni_dc_unc;
1112 uint32 ptr_dc_address;
1113 UNISTR2 uni_dc_address;
1114 int32 dc_address_type;
1115 struct GUID domain_guid;
1116 uint32 ptr_domain_name;
1117 UNISTR2 uni_domain_name;
1118 uint32 ptr_forest_name;
1119 UNISTR2 uni_forest_name;
1120 uint32 dc_flags;
1121 uint32 ptr_dc_site_name;
1122 UNISTR2 uni_dc_site_name;
1123 uint32 ptr_client_site_name;
1124 UNISTR2 uni_client_site_name;
1125 WERROR result;
1126 } NET_R_DSR_GETDCNAME;
1128 /* NET_Q_DSR_GETDCNAMEEX */
1129 typedef struct net_q_dsr_getdcnameex {
1130 uint32 ptr_server_unc;
1131 UNISTR2 uni_server_unc;
1132 uint32 ptr_domain_name;
1133 UNISTR2 uni_domain_name;
1134 uint32 ptr_domain_guid;
1135 struct GUID *domain_guid;
1136 uint32 ptr_site_name;
1137 UNISTR2 uni_site_name;
1138 uint32 flags;
1139 } NET_Q_DSR_GETDCNAMEEX;
1141 /* NET_R_DSR_GETDCNAMEEX */
1142 typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX;
1144 /* NET_Q_DSR_GETDCNAMEEX2 */
1145 typedef struct net_q_dsr_getdcnameex2 {
1146 uint32 ptr_server_unc;
1147 UNISTR2 uni_server_unc;
1148 uint32 ptr_client_account;
1149 UNISTR2 uni_client_account;
1150 uint32 mask;
1151 uint32 ptr_domain_name;
1152 UNISTR2 uni_domain_name;
1153 uint32 ptr_domain_guid;
1154 struct GUID *domain_guid;
1155 uint32 ptr_site_name;
1156 UNISTR2 uni_site_name;
1157 uint32 flags;
1158 } NET_Q_DSR_GETDCNAMEEX2;
1160 /* NET_R_DSR_GETDCNAMEEX */
1161 typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX2;
1163 /* NET_Q_DSR_GESITENAME */
1164 typedef struct net_q_dsr_getsitename {
1165 uint32 ptr_computer_name;
1166 UNISTR2 uni_computer_name;
1167 } NET_Q_DSR_GETSITENAME;
1169 /* NET_R_DSR_GETSITENAME */
1170 typedef struct net_r_dsr_getsitename {
1171 uint32 ptr_site_name;
1172 UNISTR2 uni_site_name;
1173 WERROR result;
1174 } NET_R_DSR_GETSITENAME;
1177 #endif /* _RPC_NETLOGON_H */