2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-2000
5 Copyright (C) Luke Kenneth Casson Leighton 1996-2000
6 Copyright (C) Paul Ashton 1997-2000
7 Copyright (C) Jean François Micouleau 1998-2001
8 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */
28 /*******************************************************************
29 the following information comes from a QuickView on samsrv.dll,
30 and gives an idea of exactly what is needed:
32 x SamrAddMemberToAlias
33 x SamrAddMemberToGroup
34 SamrAddMultipleMembersToAlias
35 x SamrChangePasswordUser
38 x SamrCreateAliasInDomain
39 x SamrCreateGroupInDomain
40 x SamrCreateUserInDomain
44 x SamrEnumerateAliasesInDomain
45 SamrEnumerateDomainsInSamServer
46 x SamrEnumerateGroupsInDomain
47 x SamrEnumerateUsersInDomain
48 SamrGetUserDomainPasswordInformation
49 SamrLookupDomainInSamServer
50 ? SamrLookupIdsInDomain
51 x SamrLookupNamesInDomain
56 x SamrQueryDisplayInformation
57 x SamrQueryInformationAlias
58 SamrQueryInformationDomain
59 ? SamrQueryInformationUser
60 x SamrQuerySecurityObject
61 SamrRemoveMemberFromAlias
62 SamrRemoveMemberFromForiegnDomain
63 SamrRemoveMemberFromGroup
64 SamrRemoveMultipleMembersFromAlias
65 x SamrSetInformationAlias
66 SamrSetInformationDomain
67 x SamrSetInformationGroup
68 x SamrSetInformationUser
69 SamrSetMemberAttributesOfGroup
72 SamrTestPrivateFunctionsDomain
73 SamrTestPrivateFunctionsUser
75 ********************************************************************/
77 #define SAMR_CONNECT_ANON 0x00
78 #define SAMR_CLOSE_HND 0x01
79 #define SAMR_SET_SEC_OBJECT 0x02
80 #define SAMR_QUERY_SEC_OBJECT 0x03
82 #define SAMR_UNKNOWN_4 0x04 /* profile info? */
83 #define SAMR_LOOKUP_DOMAIN 0x05
84 #define SAMR_ENUM_DOMAINS 0x06
85 #define SAMR_OPEN_DOMAIN 0x07
86 #define SAMR_QUERY_DOMAIN_INFO 0x08
87 #define SAMR_SET_DOMAIN_INFO 0x09
89 #define SAMR_CREATE_DOM_GROUP 0x0a
90 #define SAMR_ENUM_DOM_GROUPS 0x0b
91 #define SAMR_ENUM_DOM_USERS 0x0d
92 #define SAMR_CREATE_DOM_ALIAS 0x0e
93 #define SAMR_ENUM_DOM_ALIASES 0x0f
94 #define SAMR_QUERY_USERALIASES 0x10
96 #define SAMR_LOOKUP_NAMES 0x11
97 #define SAMR_LOOKUP_RIDS 0x12
99 #define SAMR_OPEN_GROUP 0x13
100 #define SAMR_QUERY_GROUPINFO 0x14
101 #define SAMR_SET_GROUPINFO 0x15
102 #define SAMR_ADD_GROUPMEM 0x16
103 #define SAMR_DELETE_DOM_GROUP 0x17
104 #define SAMR_DEL_GROUPMEM 0x18
105 #define SAMR_QUERY_GROUPMEM 0x19
106 #define SAMR_UNKNOWN_1A 0x1a
108 #define SAMR_OPEN_ALIAS 0x1b
109 #define SAMR_QUERY_ALIASINFO 0x1c
110 #define SAMR_SET_ALIASINFO 0x1d
111 #define SAMR_DELETE_DOM_ALIAS 0x1e
112 #define SAMR_ADD_ALIASMEM 0x1f
113 #define SAMR_DEL_ALIASMEM 0x20
114 #define SAMR_QUERY_ALIASMEM 0x21
116 #define SAMR_OPEN_USER 0x22
117 #define SAMR_DELETE_DOM_USER 0x23
118 #define SAMR_QUERY_USERINFO 0x24
119 #define SAMR_SET_USERINFO2 0x25
120 #define SAMR_QUERY_USERGROUPS 0x27
122 #define SAMR_QUERY_DISPINFO 0x28
123 #define SAMR_GET_DISPENUM_INDEX 0x29
124 #define SAMR_UNKNOWN_2a 0x2a
125 #define SAMR_UNKNOWN_2b 0x2b
126 #define SAMR_GET_USRDOM_PWINFO 0x2c
127 #define SAMR_REMOVE_SID_FOREIGN_DOMAIN 0x2d
128 #define SAMR_QUERY_DOMAIN_INFO2 0x2e /* looks like an alias for SAMR_QUERY_DOMAIN_INFO */
129 #define SAMR_UNKNOWN_2f 0x2f
130 #define SAMR_QUERY_DISPINFO3 0x30 /* Alias for SAMR_QUERY_DISPINFO
132 #define SAMR_UNKNOWN_31 0x31
133 #define SAMR_CREATE_USER 0x32
134 #define SAMR_QUERY_DISPINFO4 0x33 /* Alias for SAMR_QUERY_DISPINFO
136 #define SAMR_ADDMULTI_ALIASMEM 0x34
138 #define SAMR_UNKNOWN_35 0x35
139 #define SAMR_UNKNOWN_36 0x36
140 #define SAMR_CHGPASSWD_USER 0x37
141 #define SAMR_GET_DOM_PWINFO 0x38
142 #define SAMR_CONNECT 0x39
143 #define SAMR_SET_USERINFO 0x3A
144 #define SAMR_CONNECT4 0x3E
145 #define SAMR_CHGPASSWD_USER3 0x3F
146 #define SAMR_CONNECT5 0x40
148 typedef struct logon_hours_info
150 uint32 max_len
; /* normally 1260 bytes */
152 uint32 len
; /* normally 21 bytes */
157 /* SAM_USER_INFO_23 */
158 typedef struct sam_user_info_23
160 /* TIMES MAY NOT IN RIGHT ORDER!!!! */
161 NTTIME logon_time
; /* logon time */
162 NTTIME logoff_time
; /* logoff time */
163 NTTIME kickoff_time
; /* kickoff time */
164 NTTIME pass_last_set_time
; /* password last set time */
165 NTTIME pass_can_change_time
; /* password can change time */
166 NTTIME pass_must_change_time
; /* password must change time */
168 UNIHDR hdr_user_name
; /* NULL - user name unicode string header */
169 UNIHDR hdr_full_name
; /* user's full name unicode string header */
170 UNIHDR hdr_home_dir
; /* home directory unicode string header */
171 UNIHDR hdr_dir_drive
; /* home drive unicode string header */
172 UNIHDR hdr_logon_script
; /* logon script unicode string header */
173 UNIHDR hdr_profile_path
; /* profile path unicode string header */
174 UNIHDR hdr_acct_desc
; /* user description */
175 UNIHDR hdr_workstations
; /* comma-separated workstations user can log in from */
177 UNIHDR hdr_munged_dial
; /* munged path name and dial-back tel number */
179 uint8 lm_pwd
[16]; /* lm user passwords */
180 uint8 nt_pwd
[16]; /* nt user passwords */
182 uint32 user_rid
; /* Primary User ID */
183 uint32 group_rid
; /* Primary Group ID */
185 uint32 acb_info
; /* account info (ACB_xxxx bit-mask) */
187 uint32 fields_present
; /* 0x09f8 27fa */
189 uint16 logon_divs
; /* 0x0000 00a8 which is 168 which is num hrs in a week */
191 uint32 ptr_logon_hrs
; /* pointer to logon hours */
194 uint16 bad_password_count
;
199 uint8 passmustchange
; /* 0x00 must change = 0x01 */
205 UNISTR2 uni_user_name
; /* NULL - username unicode string */
206 UNISTR2 uni_full_name
; /* user's full name unicode string */
207 UNISTR2 uni_home_dir
; /* home directory unicode string */
208 UNISTR2 uni_dir_drive
; /* home directory drive unicode string */
209 UNISTR2 uni_logon_script
; /* logon script unicode string */
210 UNISTR2 uni_profile_path
; /* profile path unicode string */
211 UNISTR2 uni_acct_desc
; /* user description unicode string */
212 UNISTR2 uni_workstations
; /* login from workstations unicode string */
214 UNISTR2 uni_munged_dial
; /* munged path name and dial-back tel no */
220 /* SAM_USER_INFO_24 */
221 typedef struct sam_user_info_24
228 * NB. This structure is *definately* incorrect. It's my best guess
229 * currently for W2K SP2. The password field is encrypted in a different
230 * way than normal... And there are definately other problems. JRA.
233 /* SAM_USER_INFO_25 */
234 typedef struct sam_user_info_25
236 /* TIMES MAY NOT IN RIGHT ORDER!!!! */
237 NTTIME logon_time
; /* logon time */
238 NTTIME logoff_time
; /* logoff time */
239 NTTIME kickoff_time
; /* kickoff time */
240 NTTIME pass_last_set_time
; /* password last set time */
241 NTTIME pass_can_change_time
; /* password can change time */
242 NTTIME pass_must_change_time
; /* password must change time */
244 UNIHDR hdr_user_name
; /* NULL - user name unicode string header */
245 UNIHDR hdr_full_name
; /* user's full name unicode string header */
246 UNIHDR hdr_home_dir
; /* home directory unicode string header */
247 UNIHDR hdr_dir_drive
; /* home drive unicode string header */
248 UNIHDR hdr_logon_script
; /* logon script unicode string header */
249 UNIHDR hdr_profile_path
; /* profile path unicode string header */
250 UNIHDR hdr_acct_desc
; /* user description */
251 UNIHDR hdr_workstations
; /* comma-separated workstations user can log in from */
253 UNIHDR hdr_munged_dial
; /* munged path name and dial-back tel number */
255 uint8 lm_pwd
[16]; /* lm user passwords */
256 uint8 nt_pwd
[16]; /* nt user passwords */
258 uint32 user_rid
; /* Primary User ID */
259 uint32 group_rid
; /* Primary Group ID */
261 uint32 acb_info
; /* account info (ACB_xxxx bit-mask) */
262 uint32 fields_present
;
264 uint16 logon_divs
; /* 0x0000 00a8 which is 168 which is num hrs in a week */
266 uint32 ptr_logon_hrs
; /* pointer to logon hours */
269 uint16 bad_password_count
;
274 uint8 passmustchange
; /* 0x00 must change = 0x01 */
280 UNISTR2 uni_user_name
; /* NULL - username unicode string */
281 UNISTR2 uni_full_name
; /* user's full name unicode string */
282 UNISTR2 uni_home_dir
; /* home directory unicode string */
283 UNISTR2 uni_dir_drive
; /* home directory drive unicode string */
284 UNISTR2 uni_logon_script
; /* logon script unicode string */
285 UNISTR2 uni_profile_path
; /* profile path unicode string */
286 UNISTR2 uni_acct_desc
; /* user description unicode string */
287 UNISTR2 uni_workstations
; /* login from workstations unicode string */
289 UNISTR2 uni_munged_dial
; /* munged path name and dial-back tel no */
293 /* SAM_USER_INFO_26 */
294 typedef struct sam_user_info_26
301 /* SAM_USER_INFO_21 */
302 typedef struct sam_user_info_21
304 NTTIME logon_time
; /* logon time */
305 NTTIME logoff_time
; /* logoff time */
306 NTTIME kickoff_time
; /* kickoff time */
307 NTTIME pass_last_set_time
; /* password last set time */
308 NTTIME pass_can_change_time
; /* password can change time */
309 NTTIME pass_must_change_time
; /* password must change time */
311 UNIHDR hdr_user_name
; /* username unicode string header */
312 UNIHDR hdr_full_name
; /* user's full name unicode string header */
313 UNIHDR hdr_home_dir
; /* home directory unicode string header */
314 UNIHDR hdr_dir_drive
; /* home drive unicode string header */
315 UNIHDR hdr_logon_script
; /* logon script unicode string header */
316 UNIHDR hdr_profile_path
; /* profile path unicode string header */
317 UNIHDR hdr_acct_desc
; /* user description */
318 UNIHDR hdr_workstations
; /* comma-separated workstations user can log in from */
320 UNIHDR hdr_munged_dial
; /* munged path name and dial-back tel number */
322 uint8 lm_pwd
[16]; /* lm user passwords */
323 uint8 nt_pwd
[16]; /* nt user passwords */
325 uint32 user_rid
; /* Primary User ID */
326 uint32 group_rid
; /* Primary Group ID */
328 uint32 acb_info
; /* account info (ACB_xxxx bit-mask) */
331 uint32 fields_present
; /* 0x00ff ffff */
333 uint16 logon_divs
; /* 0x0000 00a8 which is 168 which is num hrs in a week */
335 uint32 ptr_logon_hrs
; /* unknown pointer */
338 uint16 bad_password_count
;
343 uint8 passmustchange
; /* 0x00 must change = 0x01 */
347 UNISTR2 uni_user_name
; /* username unicode string */
348 UNISTR2 uni_full_name
; /* user's full name unicode string */
349 UNISTR2 uni_home_dir
; /* home directory unicode string */
350 UNISTR2 uni_dir_drive
; /* home directory drive unicode string */
351 UNISTR2 uni_logon_script
; /* logon script unicode string */
352 UNISTR2 uni_profile_path
; /* profile path unicode string */
353 UNISTR2 uni_acct_desc
; /* user description unicode string */
354 UNISTR2 uni_workstations
; /* login from workstations unicode string */
356 UNISTR2 uni_munged_dial
; /* munged path name and dial-back tel number */
362 #define PASS_MUST_CHANGE_AT_NEXT_LOGON 0x01
363 #define PASS_DONT_CHANGE_AT_NEXT_LOGON 0x00
365 /* SAM_USER_INFO_20 */
366 typedef struct sam_user_info_20
368 UNIHDR hdr_munged_dial
; /* munged path name and dial-back tel number */
370 UNISTR2 uni_munged_dial
; /* munged path name and dial-back tel number */
374 /* SAM_USER_INFO_18 */
375 typedef struct sam_user_info_18
377 uint8 lm_pwd
[16]; /* lm user passwords */
378 uint8 nt_pwd
[16]; /* nt user passwords */
385 /* SAM_USER_INFO_17 */
386 typedef struct sam_user_info_17
388 uint8 padding_0
[16]; /* 0 - padding 16 bytes */
389 NTTIME expiry
; /* expiry time or something? */
390 uint8 padding_1
[24]; /* 0 - padding 24 bytes */
392 UNIHDR hdr_mach_acct
; /* unicode header for machine account */
393 uint32 padding_2
; /* 0 - padding 4 bytes */
395 uint32 ptr_1
; /* pointer */
396 uint8 padding_3
[32]; /* 0 - padding 32 bytes */
397 uint32 padding_4
; /* 0 - padding 4 bytes */
399 uint32 ptr_2
; /* pointer */
400 uint32 padding_5
; /* 0 - padding 4 bytes */
402 uint32 ptr_3
; /* pointer */
403 uint8 padding_6
[32]; /* 0 - padding 32 bytes */
405 uint32 rid_user
; /* user RID */
406 uint32 rid_group
; /* group RID */
408 uint16 acct_ctrl
; /* 0080 - ACB_XXXX */
409 uint16 unknown_3
; /* 16 bit padding */
411 uint16 unknown_4
; /* 0x003f - 16 bit unknown */
412 uint16 unknown_5
; /* 0x003c - 16 bit unknown */
414 uint8 padding_7
[16]; /* 0 - padding 16 bytes */
415 uint32 padding_8
; /* 0 - padding 4 bytes */
417 UNISTR2 uni_mach_acct
; /* unicode string for machine account */
419 uint8 padding_9
[48]; /* 0 - padding 48 bytes */
424 /* SAM_USER_INFO_16 */
425 typedef struct sam_user_info_16
432 /* SAM_USER_INFO_7 */
433 typedef struct sam_user_info_7
435 UNIHDR hdr_name
; /* unicode header for name */
436 UNISTR2 uni_name
; /* unicode string for name */
441 /* SAM_USER_INFO_9 */
442 typedef struct sam_user_info_9
444 uint32 rid_group
; /* Primary Group RID */
448 /****************************************************************************
449 SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this
450 *****************************************************************************/
452 /* SAMR_Q_GET_USRDOM_PWINFO */
453 typedef struct q_samr_usrdom_pwinfo_info
455 POLICY_HND user_pol
; /* policy handle */
457 } SAMR_Q_GET_USRDOM_PWINFO
;
460 /****************************************************************************
461 SAMR_R_GET_USRDOM_PWINFO - a "set user info" occurs just after this
462 *****************************************************************************/
464 /* SAMR_R_GET_USRDOM_PWINFO */
465 typedef struct r_samr_usrdom_pwinfo_info
467 uint16 min_pwd_length
;
468 uint16 unknown_1
; /* 0x0016 or 0x0015 */
469 uint32 password_properties
;
472 } SAMR_R_GET_USRDOM_PWINFO
;
474 /****************************************************************************
475 SAMR_Q_SET_SEC_OBJ - info level 4.
476 *****************************************************************************/
478 /* SAMR_Q_SET_SEC_OBJ - */
479 typedef struct q_samr_set_sec_obj_info
481 POLICY_HND pol
; /* policy handle */
482 uint32 sec_info
; /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
485 } SAMR_Q_SET_SEC_OBJ
;
487 /* SAMR_R_SET_SEC_OBJ - */
488 typedef struct r_samr_set_sec_obj_info
490 NTSTATUS status
; /* return status */
492 } SAMR_R_SET_SEC_OBJ
;
495 /****************************************************************************
496 SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info.
497 *****************************************************************************/
499 /* SAMR_Q_QUERY_DOMAIN_INFO - */
500 typedef struct q_samr_query_domain_info
502 POLICY_HND domain_pol
; /* policy handle */
503 uint16 switch_value
; /* 0x0002, 0x0001 */
505 } SAMR_Q_QUERY_DOMAIN_INFO
;
507 typedef struct sam_unknown_info_1_inf
509 uint16 min_length_password
;
510 uint16 password_history
;
511 uint32 password_properties
;
513 NTTIME min_passwordage
;
517 typedef struct sam_unknown_info_2_inf
519 NTTIME logout
; /* whether users are forcibly disconnected when logon hours expire */
520 UNIHDR hdr_comment
; /* comment according to samba4 idl */
521 UNIHDR hdr_domain
; /* domain name unicode header */
522 UNIHDR hdr_server
; /* server name unicode header */
524 /* put all the data in here, at the moment, including what the above
525 pointer is referring to
530 uint32 unknown_4
; /* 0x0000 0001 */
532 uint32 unknown_6
; /* 0x0000 0001 */
533 uint32 num_domain_usrs
; /* number of users in domain */
534 uint32 num_domain_grps
; /* number of domain groups in domain */
535 uint32 num_local_grps
; /* number of local groups in domain */
537 UNISTR2 uni_comment
; /* comment unicode string */
538 UNISTR2 uni_domain
; /* domain name unicode string */
539 UNISTR2 uni_server
; /* server name unicode string */
543 typedef struct sam_unknown_info_3_info
546 /* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
547 /* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/
551 typedef struct sam_unknown_info_4_inf
553 UNIHDR hdr_comment
; /* comment according to samba4 idl */
554 UNISTR2 uni_comment
; /* comment unicode string */
558 typedef struct sam_unknown_info_5_inf
560 UNIHDR hdr_domain
; /* domain name unicode header */
561 UNISTR2 uni_domain
; /* domain name unicode string */
565 typedef struct sam_unknown_info_6_info
567 UNIHDR hdr_server
; /* server name unicode header */
568 UNISTR2 uni_server
; /* server name unicode string */
572 typedef struct sam_unknown_info_7_info
578 typedef struct sam_unknown_info_8_info
581 NTTIME domain_create_time
;
585 typedef struct sam_unknown_info_9_info
591 typedef struct sam_unknown_info_12_inf
595 uint16 bad_attempt_lockout
;
599 typedef struct sam_unknown_info_13_info
602 NTTIME domain_create_time
;
608 typedef struct sam_unknown_ctr_info
621 SAM_UNK_INFO_12 inf12
;
622 SAM_UNK_INFO_13 inf13
;
629 /* SAMR_R_QUERY_DOMAIN_INFO - */
630 typedef struct r_samr_query_domain_info
633 uint16 switch_value
; /* same as in query */
637 NTSTATUS status
; /* return status */
639 } SAMR_R_QUERY_DOMAIN_INFO
;
642 /* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
643 typedef struct q_samr_lookup_domain_info
645 POLICY_HND connect_pol
;
650 } SAMR_Q_LOOKUP_DOMAIN
;
653 /* SAMR_R_LOOKUP_DOMAIN */
654 typedef struct r_samr_lookup_domain_info
661 } SAMR_R_LOOKUP_DOMAIN
;
664 #define MAX_SAM_ENTRIES_W2K 0x400
665 #define MAX_SAM_ENTRIES_W95 50
666 /* The following should be the greater of the preceeding two. */
667 #define MAX_SAM_ENTRIES MAX_SAM_ENTRIES_W2K
669 typedef struct samr_entry_info
677 /* SAMR_Q_ENUM_DOMAINS - SAM rids and names */
678 typedef struct q_samr_enum_domains_info
680 POLICY_HND pol
; /* policy handle */
682 uint32 start_idx
; /* enumeration handle */
683 uint32 max_size
; /* 0x0000 ffff */
685 } SAMR_Q_ENUM_DOMAINS
;
687 /* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */
688 typedef struct r_samr_enum_domains_info
690 uint32 next_idx
; /* next starting index required for enum */
699 UNISTR2
*uni_dom_name
;
705 } SAMR_R_ENUM_DOMAINS
;
707 /* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
708 typedef struct q_samr_enum_dom_users_info
710 POLICY_HND pol
; /* policy handle */
712 uint32 start_idx
; /* number of values (0 indicates unlimited?) */
713 uint32 acb_mask
; /* 0x0000 indicates all */
715 uint32 max_size
; /* 0x0000 ffff */
717 } SAMR_Q_ENUM_DOM_USERS
;
720 /* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
721 typedef struct r_samr_enum_dom_users_info
723 uint32 next_idx
; /* next starting index required for enum */
732 UNISTR2
*uni_acct_name
;
738 } SAMR_R_ENUM_DOM_USERS
;
741 /* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
742 typedef struct q_samr_enum_dom_groups_info
744 POLICY_HND pol
; /* policy handle */
746 /* this is possibly an enumeration context handle... */
747 uint32 start_idx
; /* 0x0000 0000 */
749 uint32 max_size
; /* 0x0000 ffff */
751 } SAMR_Q_ENUM_DOM_GROUPS
;
754 /* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
755 typedef struct r_samr_enum_dom_groups_info
766 UNISTR2
*uni_grp_name
;
772 } SAMR_R_ENUM_DOM_GROUPS
;
775 /* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
776 typedef struct q_samr_enum_dom_aliases_info
778 POLICY_HND pol
; /* policy handle */
780 /* this is possibly an enumeration context handle... */
781 uint32 start_idx
; /* 0x0000 0000 */
783 uint32 max_size
; /* 0x0000 ffff */
785 } SAMR_Q_ENUM_DOM_ALIASES
;
788 /* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
789 typedef struct r_samr_enum_dom_aliases_info
800 UNISTR2
*uni_grp_name
;
806 } SAMR_R_ENUM_DOM_ALIASES
;
809 /* -- Level 1 Display Info - User Information -- */
811 typedef struct samr_entry_info1
818 UNIHDR hdr_acct_name
;
819 UNIHDR hdr_user_name
;
820 UNIHDR hdr_user_desc
;
824 typedef struct samr_str_entry_info1
826 UNISTR2 uni_acct_name
;
827 UNISTR2 uni_full_name
;
828 UNISTR2 uni_acct_desc
;
832 typedef struct sam_entry_info_1
840 /* -- Level 2 Display Info - Trust Account Information -- */
842 typedef struct samr_entry_info2
854 typedef struct samr_str_entry_info2
856 UNISTR2 uni_srv_name
;
857 UNISTR2 uni_srv_desc
;
861 typedef struct sam_entry_info_2
869 /* -- Level 3 Display Info - Domain Group Information -- */
871 typedef struct samr_entry_info3
876 uint32 attr
; /* SE_GROUP_xxx, usually 7 */
883 typedef struct samr_str_entry_info3
885 UNISTR2 uni_grp_name
;
886 UNISTR2 uni_grp_desc
;
890 typedef struct sam_entry_info_3
898 /* -- Level 4 Display Info - User List (ASCII) -- */
900 typedef struct samr_entry_info4
903 STRHDR hdr_acct_name
;
907 typedef struct samr_str_entry_info4
913 typedef struct sam_entry_info_4
921 /* -- Level 5 Display Info - Group List (ASCII) -- */
923 typedef struct samr_entry_info5
930 typedef struct samr_str_entry_info5
936 typedef struct sam_entry_info_5
944 typedef struct sam_dispinfo_ctr_info
948 SAM_DISPINFO_1
*info1
; /* users/names/descriptions */
949 SAM_DISPINFO_2
*info2
; /* trust accounts */
950 SAM_DISPINFO_3
*info3
; /* domain groups/descriptions */
951 SAM_DISPINFO_4
*info4
; /* user list (ASCII) - used by Win95 */
952 SAM_DISPINFO_5
*info5
; /* group list (ASCII) */
953 void *info
; /* allows assignment without typecasting, */
960 /* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
961 typedef struct q_samr_query_disp_info
963 POLICY_HND domain_pol
;
965 uint16 switch_level
; /* see SAM_DISPINFO_CTR above */
968 uint32 start_idx
; /* start enumeration index */
969 uint32 max_entries
; /* maximum number of entries to return */
970 uint32 max_size
; /* recommended data size; if exceeded server
971 should return STATUS_MORE_ENTRIES */
973 } SAMR_Q_QUERY_DISPINFO
;
976 /* SAMR_R_QUERY_DISPINFO */
977 typedef struct r_samr_query_dispinfo_info
979 uint32 total_size
; /* total data size for all matching entries
980 (0 = uncalculated) */
981 uint32 data_size
; /* actual data size returned = size of SAM_ENTRY
982 structures + total length of strings */
984 uint16 switch_level
; /* see SAM_DISPINFO_CTR above */
987 uint32 num_entries
; /* number of entries returned */
991 SAM_DISPINFO_CTR
*ctr
;
995 } SAMR_R_QUERY_DISPINFO
;
997 /* SAMR_Q_GET_DISPENUM_INDEX */
998 typedef struct q_samr_get_dispenum_index
1000 POLICY_HND domain_pol
;
1001 uint16 switch_level
;
1004 } SAMR_Q_GET_DISPENUM_INDEX
;
1006 /* SAMR_R_GET_DISPENUM_INDEX */
1007 typedef struct r_samr_get_dispenum_index
1012 } SAMR_R_GET_DISPENUM_INDEX
;
1014 /* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
1015 typedef struct q_samr_query_group_info
1017 POLICY_HND pol
; /* policy handle */
1019 uint16 switch_level
; /* 0x0001 seen */
1021 } SAMR_Q_QUERY_GROUPINFO
;
1023 typedef struct samr_group_info1
1025 UNIHDR hdr_acct_name
;
1027 uint32 group_attr
; /* 0x0000 0003 - group attribute */
1028 uint32 num_members
; /* 0x0000 0001 - number of group members? */
1030 UNIHDR hdr_acct_desc
;
1032 UNISTR2 uni_acct_name
;
1033 UNISTR2 uni_acct_desc
;
1037 typedef struct samr_group_info2
1040 UNIHDR hdr_acct_name
;
1041 UNISTR2 uni_acct_name
;
1045 typedef struct samr_group_info3
1047 uint32 group_attr
; /* 0x0000 0003 - group attribute */
1051 typedef struct samr_group_info4
1054 UNIHDR hdr_acct_desc
;
1055 UNISTR2 uni_acct_desc
;
1059 typedef struct samr_group_info5
1061 UNIHDR hdr_acct_name
;
1063 uint32 group_attr
; /* 0x0000 0003 - group attribute */
1064 uint32 num_members
; /* 0x0000 0001 - number of group members? */
1066 UNIHDR hdr_acct_desc
;
1068 UNISTR2 uni_acct_name
;
1069 UNISTR2 uni_acct_desc
;
1074 /* GROUP_INFO_CTR */
1075 typedef struct group_info_ctr
1077 uint16 switch_value1
;
1090 /* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
1091 typedef struct r_samr_query_groupinfo_info
1094 GROUP_INFO_CTR
*ctr
;
1098 } SAMR_R_QUERY_GROUPINFO
;
1101 /* SAMR_Q_SET_GROUPINFO - SAM Group Info */
1102 typedef struct q_samr_set_group_info
1104 POLICY_HND pol
; /* policy handle */
1105 GROUP_INFO_CTR
*ctr
;
1107 } SAMR_Q_SET_GROUPINFO
;
1109 /* SAMR_R_SET_GROUPINFO - SAM Group Info */
1110 typedef struct r_samr_set_group_info
1114 } SAMR_R_SET_GROUPINFO
;
1117 /********************************************************/
1121 UNISTR4 description
;
1130 UNISTR4 description
;
1134 POLICY_HND pol
; /* policy handle */
1135 uint16 level
; /* 0x0003 seen */
1136 } SAMR_Q_QUERY_ALIASINFO
;
1148 ALIAS_INFO_CTR
*ctr
;
1150 } SAMR_R_QUERY_ALIASINFO
;
1153 /********************************************************/
1156 POLICY_HND alias_pol
; /* policy handle */
1158 } SAMR_Q_SET_ALIASINFO
;
1162 } SAMR_R_SET_ALIASINFO
;
1165 /********************************************************/
1167 /* SAMR_Q_QUERY_USERGROUPS - */
1168 typedef struct q_samr_query_usergroup_info
1170 POLICY_HND pol
; /* policy handle associated with unknown id */
1172 } SAMR_Q_QUERY_USERGROUPS
;
1174 /* SAMR_R_QUERY_USERGROUPS - probably a get sam info */
1175 typedef struct r_samr_query_usergroup_info
1177 uint32 ptr_0
; /* pointer */
1178 uint32 num_entries
; /* number of RID groups */
1179 uint32 ptr_1
; /* pointer */
1180 uint32 num_entries2
; /* number of RID groups */
1182 DOM_GID
*gid
; /* group info */
1184 NTSTATUS status
; /* return status */
1186 } SAMR_R_QUERY_USERGROUPS
;
1188 /* SAM_USERINFO_CTR - sam user info */
1189 typedef struct sam_userinfo_ctr_info
1191 uint16 switch_value
;
1195 SAM_USER_INFO_7
*id7
;
1196 SAM_USER_INFO_9
*id9
;
1197 SAM_USER_INFO_16
*id16
;
1198 SAM_USER_INFO_17
*id17
;
1199 SAM_USER_INFO_18
*id18
;
1200 SAM_USER_INFO_20
*id20
;
1201 SAM_USER_INFO_21
*id21
;
1202 SAM_USER_INFO_23
*id23
;
1203 SAM_USER_INFO_24
*id24
;
1204 SAM_USER_INFO_25
*id25
;
1205 SAM_USER_INFO_26
*id26
;
1206 void* id
; /* to make typecasting easy */
1213 /* SAMR_Q_SET_USERINFO2 - set sam info */
1214 typedef struct q_samr_set_user_info2
1216 POLICY_HND pol
; /* policy handle associated with user */
1217 uint16 switch_value
; /* 0x0010 */
1219 SAM_USERINFO_CTR
*ctr
;
1221 } SAMR_Q_SET_USERINFO2
;
1223 /* SAMR_R_SET_USERINFO2 - set sam info */
1224 typedef struct r_samr_set_user_info2
1226 NTSTATUS status
; /* return status */
1228 } SAMR_R_SET_USERINFO2
;
1230 /* SAMR_Q_SET_USERINFO - set sam info */
1231 typedef struct q_samr_set_user_info
1233 POLICY_HND pol
; /* policy handle associated with user */
1234 uint16 switch_value
;
1235 SAM_USERINFO_CTR
*ctr
;
1237 } SAMR_Q_SET_USERINFO
;
1239 /* SAMR_R_SET_USERINFO - set sam info */
1240 typedef struct r_samr_set_user_info
1242 NTSTATUS status
; /* return status */
1244 } SAMR_R_SET_USERINFO
;
1247 /* SAMR_Q_QUERY_USERINFO - probably a get sam info */
1248 typedef struct q_samr_query_user_info
1250 POLICY_HND pol
; /* policy handle associated with unknown id */
1251 uint16 switch_value
; /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */
1253 } SAMR_Q_QUERY_USERINFO
;
1255 /* SAMR_R_QUERY_USERINFO - probably a get sam info */
1256 typedef struct r_samr_query_user_info
1258 uint32 ptr
; /* pointer */
1259 SAM_USERINFO_CTR
*ctr
;
1261 NTSTATUS status
; /* return status */
1263 } SAMR_R_QUERY_USERINFO
;
1266 /****************************************************************************
1267 SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID.
1269 the policy handle allocated by an "samr open secret" call is associated
1270 with a SID. this policy handle is what is queried here, *not* the SID
1271 itself. the response to the lookup rids is relative to this SID.
1272 *****************************************************************************/
1273 /* SAMR_Q_QUERY_USERALIASES */
1274 typedef struct q_samr_query_useraliases_info
1276 POLICY_HND pol
; /* policy handle */
1278 uint32 num_sids1
; /* number of rids being looked up */
1279 uint32 ptr
; /* buffer pointer */
1280 uint32 num_sids2
; /* number of rids being looked up */
1282 uint32
*ptr_sid
; /* pointers to sids to be looked up */
1283 DOM_SID2
*sid
; /* sids to be looked up. */
1285 } SAMR_Q_QUERY_USERALIASES
;
1288 /* SAMR_R_QUERY_USERALIASES */
1289 typedef struct r_samr_query_useraliases_info
1292 uint32 ptr
; /* undocumented buffer pointer */
1294 uint32 num_entries2
;
1295 uint32
*rid
; /* domain RIDs being looked up */
1297 NTSTATUS status
; /* return code */
1299 } SAMR_R_QUERY_USERALIASES
;
1302 /****************************************************************************
1303 SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
1304 *****************************************************************************/
1305 /* SAMR_Q_LOOKUP_NAMES */
1306 typedef struct q_samr_lookup_names_info
1308 POLICY_HND pol
; /* policy handle */
1310 uint32 num_names1
; /* number of names being looked up */
1311 uint32 flags
; /* 0x0000 03e8 - unknown */
1312 uint32 ptr
; /* 0x0000 0000 - 32 bit unknown */
1313 uint32 num_names2
; /* number of names being looked up */
1315 UNIHDR
*hdr_name
; /* unicode account name header */
1316 UNISTR2
*uni_name
; /* unicode account name string */
1318 } SAMR_Q_LOOKUP_NAMES
;
1321 /* SAMR_R_LOOKUP_NAMES */
1322 typedef struct r_samr_lookup_names_info
1324 uint32 num_rids1
; /* number of aliases being looked up */
1325 uint32 ptr_rids
; /* pointer to aliases */
1326 uint32 num_rids2
; /* number of aliases being looked up */
1328 uint32
*rids
; /* rids */
1330 uint32 num_types1
; /* number of users in aliases being looked up */
1331 uint32 ptr_types
; /* pointer to users in aliases */
1332 uint32 num_types2
; /* number of users in aliases being looked up */
1334 uint32
*types
; /* SID_ENUM type */
1336 NTSTATUS status
; /* return code */
1338 } SAMR_R_LOOKUP_NAMES
;
1341 /****************************************************************************
1342 SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.
1344 called to resolve domain RID groups.
1345 *****************************************************************************/
1346 /* SAMR_Q_LOOKUP_RIDS */
1347 typedef struct q_samr_lookup_rids_info
1349 POLICY_HND pol
; /* policy handle */
1351 uint32 num_rids1
; /* number of rids being looked up */
1352 uint32 flags
; /* 0x0000 03e8 - unknown */
1353 uint32 ptr
; /* 0x0000 0000 - 32 bit unknown */
1354 uint32 num_rids2
; /* number of rids being looked up */
1356 uint32
*rid
; /* domain RIDs being looked up */
1358 } SAMR_Q_LOOKUP_RIDS
;
1361 /****************************************************************************
1362 SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names
1364 *****************************************************************************/
1365 /* SAMR_R_LOOKUP_RIDS */
1366 typedef struct r_samr_lookup_rids_info
1368 uint32 num_names1
; /* number of aliases being looked up */
1369 uint32 ptr_names
; /* pointer to aliases */
1370 uint32 num_names2
; /* number of aliases being looked up */
1372 UNIHDR
*hdr_name
; /* unicode account name header */
1373 UNISTR2
*uni_name
; /* unicode account name string */
1375 uint32 num_types1
; /* number of users in aliases being looked up */
1376 uint32 ptr_types
; /* pointer to users in aliases */
1377 uint32 num_types2
; /* number of users in aliases being looked up */
1379 uint32
*type
; /* SID_ENUM type */
1383 } SAMR_R_LOOKUP_RIDS
;
1386 /* SAMR_Q_QUERY_GROUPMEM - query group members */
1387 typedef struct q_samr_query_groupmem_info
1389 POLICY_HND group_pol
; /* policy handle */
1391 } SAMR_Q_QUERY_GROUPMEM
;
1394 /* SAMR_R_QUERY_GROUPMEM - query group members */
1395 typedef struct r_samr_query_groupmem_info
1411 } SAMR_R_QUERY_GROUPMEM
;
1414 /* SAMR_Q_QUERY_ALIASMEM - query alias members */
1415 typedef struct q_samr_query_aliasmem_info
1417 POLICY_HND alias_pol
; /* policy handle */
1419 } SAMR_Q_QUERY_ALIASMEM
;
1422 /* SAMR_R_QUERY_ALIASMEM - query alias members */
1423 typedef struct r_samr_query_aliasmem_info
1433 } SAMR_R_QUERY_ALIASMEM
;
1436 /* SAMR_Q_ADD_ALIASMEM - add alias member */
1437 typedef struct q_samr_add_alias_mem_info
1439 POLICY_HND alias_pol
; /* policy handle */
1441 DOM_SID2 sid
; /* member sid to be added to the alias */
1443 } SAMR_Q_ADD_ALIASMEM
;
1446 /* SAMR_R_ADD_ALIASMEM - add alias member */
1447 typedef struct r_samr_add_alias_mem_info
1449 NTSTATUS status
; /* return status */
1451 } SAMR_R_ADD_ALIASMEM
;
1454 /* SAMR_Q_DEL_ALIASMEM - add an add alias member */
1455 typedef struct q_samr_del_alias_mem_info
1457 POLICY_HND alias_pol
; /* policy handle */
1459 DOM_SID2 sid
; /* member sid to be added to alias */
1461 } SAMR_Q_DEL_ALIASMEM
;
1464 /* SAMR_R_DEL_ALIASMEM - delete alias member */
1465 typedef struct r_samr_del_alias_mem_info
1467 NTSTATUS status
; /* return status */
1469 } SAMR_R_DEL_ALIASMEM
;
1472 /* SAMR_Q_CONNECT - probably an open */
1473 typedef struct q_samr_connect_info
1475 uint32 ptr_srv_name
; /* pointer (to server name?) */
1476 UNISTR2 uni_srv_name
; /* unicode server name starting with '\\' */
1483 /* SAMR_R_CONNECT - probably an open */
1484 typedef struct r_samr_connect_info
1486 POLICY_HND connect_pol
; /* policy handle */
1487 NTSTATUS status
; /* return status */
1491 /* SAMR_ENC_PASSWD */
1492 typedef struct enc_passwd_info
1500 typedef struct enc_hash_info
1507 /* SAMR_Q_CHGPASSWD_USER */
1508 typedef struct q_samr_chgpasswd_user_info
1512 UNIHDR hdr_dest_host
; /* server name unicode header */
1513 UNISTR2 uni_dest_host
; /* server name unicode string */
1515 UNIHDR hdr_user_name
; /* username unicode string header */
1516 UNISTR2 uni_user_name
; /* username unicode string */
1518 SAMR_ENC_PASSWD nt_newpass
;
1519 SAMR_ENC_HASH nt_oldhash
;
1521 uint32 unknown
; /* 0x0000 0001 */
1523 SAMR_ENC_PASSWD lm_newpass
;
1524 SAMR_ENC_HASH lm_oldhash
;
1526 } SAMR_Q_CHGPASSWD_USER
;
1528 /* SAMR_R_CHGPASSWD_USER */
1529 typedef struct r_samr_chgpasswd_user_info
1531 NTSTATUS status
; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1533 } SAMR_R_CHGPASSWD_USER
;
1535 /* SAMR_Q_CHGPASSWD3 */
1536 typedef struct q_samr_chgpasswd_user3
1540 UNIHDR hdr_dest_host
; /* server name unicode header */
1541 UNISTR2 uni_dest_host
; /* server name unicode string */
1543 UNIHDR hdr_user_name
; /* username unicode string header */
1544 UNISTR2 uni_user_name
; /* username unicode string */
1546 SAMR_ENC_PASSWD nt_newpass
;
1547 SAMR_ENC_HASH nt_oldhash
;
1549 uint32 lm_change
; /* 0x0000 0001 */
1551 SAMR_ENC_PASSWD lm_newpass
;
1552 SAMR_ENC_HASH lm_oldhash
;
1554 SAMR_ENC_PASSWD password3
;
1556 } SAMR_Q_CHGPASSWD_USER3
;
1558 /* SAMR_CHANGE_REJECT */
1559 typedef struct samr_change_reject
1561 uint32 reject_reason
;
1565 } SAMR_CHANGE_REJECT
;
1567 /* SAMR_R_CHGPASSWD3 */
1568 typedef struct r_samr_chgpasswd_user3
1572 SAM_UNK_INFO_1
*info
;
1573 SAMR_CHANGE_REJECT
*reject
;
1574 NTSTATUS status
; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1576 } SAMR_R_CHGPASSWD_USER3
;
1580 /* SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN */
1581 typedef struct q_samr_remove_sid_foreign_domain_info
1583 POLICY_HND dom_pol
; /* policy handle */
1584 DOM_SID2 sid
; /* SID */
1586 } SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN
;
1589 /* SAMR_R_REMOVE_SID_FOREIGN_DOMAIN */
1590 typedef struct r_samr_remove_sid_foreign_domain_info
1592 NTSTATUS status
; /* return status */
1594 } SAMR_R_REMOVE_SID_FOREIGN_DOMAIN
;
1598 /* these are from the old rpc_samr.h - they are needed while the merge
1599 is still going on */
1600 #define MAX_SAM_SIDS 15
1602 /* DOM_SID3 - security id */
1603 typedef struct sid_info_3
1605 uint16 len
; /* length, bytes, including length of len :-) */
1612 /* SAMR_Q_QUERY_DOMAIN_INFO2 */
1613 typedef struct q_samr_query_domain_info2
1615 POLICY_HND domain_pol
; /* policy handle */
1616 uint16 switch_value
;
1618 } SAMR_Q_QUERY_DOMAIN_INFO2
;
1620 /* SAMR_R_QUERY_DOMAIN_INFO2 */
1621 typedef struct r_samr_query_domain_info2
1624 uint16 switch_value
;
1626 NTSTATUS status
; /* return status */
1628 } SAMR_R_QUERY_DOMAIN_INFO2
;
1630 /* SAMR_Q_SET_DOMAIN_INFO */
1631 typedef struct q_samr_set_domain_info
1633 POLICY_HND domain_pol
; /* policy handle */
1634 uint16 switch_value0
;
1635 uint16 switch_value
;
1638 } SAMR_Q_SET_DOMAIN_INFO
;
1640 /* SAMR_R_SET_DOMAIN_INFO */
1641 typedef struct r_samr_set_domain_info
1643 NTSTATUS status
; /* return status */
1645 } SAMR_R_SET_DOMAIN_INFO
;
1647 #endif /* _RPC_SAMR_H */