xref: /titanic_51/usr/src/uts/common/smbsrv/ndl/samrpc.ndl (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25#ifndef _MLSVC_SAM_NDL_
26#define _MLSVC_SAM_NDL_
27
28/*
29 * Security Accounts Manager RPC (SAMR) interface definition.
30 */
31
32#include "ndrtypes.ndl"
33
34/* Windows NT */
35#define SAMR_OPNUM_Connect			0x00	/* SamrConnect */
36#define SAMR_OPNUM_CloseHandle			0x01
37#define SAMR_OPNUM_SetSecObject			0x02
38#define SAMR_OPNUM_QuerySecObject		0x03
39#define SAMR_OPNUM_ShutdownSamServer		0x04	/* NotUsedOnWire */
40#define SAMR_OPNUM_LookupDomain			0x05
41#define SAMR_OPNUM_EnumLocalDomains		0x06
42#define SAMR_OPNUM_OpenDomain			0x07
43#define SAMR_OPNUM_QueryDomainInfo		0x08
44#define SAMR_OPNUM_SetDomainInfo		0x09
45#define SAMR_OPNUM_CreateDomainGroup		0x0a
46#define SAMR_OPNUM_QueryDomainGroups		0x0b
47#define SAMR_OPNUM_CreateDomainUser		0x0c
48#define SAMR_OPNUM_EnumDomainUsers		0x0d
49#define SAMR_OPNUM_CreateDomainAlias		0x0e
50#define SAMR_OPNUM_EnumDomainAliases		0x0f
51#define SAMR_OPNUM_LookupIds			0x10	/* GetAliasMembership */
52#define SAMR_OPNUM_LookupNames			0x11
53#define SAMR_OPNUM_LookupDomainIds		0x12
54#define SAMR_OPNUM_OpenGroup			0x13
55#define SAMR_OPNUM_QueryGroupInfo		0x14
56#define SAMR_OPNUM_StoreGroupInfo		0x15
57#define SAMR_OPNUM_AddGroupMember		0x16
58#define SAMR_OPNUM_DeleteDomainGroup		0x17
59#define SAMR_OPNUM_DeleteGroupMember		0x18
60#define SAMR_OPNUM_ListGroupMembers		0x19
61#define SAMR_OPNUM_SetGroupMemberAttributes	0x1a
62#define SAMR_OPNUM_OpenAlias			0x1b
63#define SAMR_OPNUM_QueryAliasInfo		0x1c
64#define SAMR_OPNUM_SetAliasInfo			0x1d
65#define SAMR_OPNUM_DeleteDomainAlias		0x1e
66#define SAMR_OPNUM_AddAliasMember		0x1f
67#define SAMR_OPNUM_DeleteAliasMember		0x20
68#define SAMR_OPNUM_ListAliasMembers		0x21
69#define SAMR_OPNUM_OpenUser			0x22
70#define SAMR_OPNUM_DeleteUser			0x23
71#define SAMR_OPNUM_QueryUserInfo		0x24
72#define SAMR_OPNUM_SetUserInfo0			0x25	/* SetUserInfo */
73#define SAMR_OPNUM_ChangeUserPassword0		0x26	/* ChangeUserPassword */
74#define SAMR_OPNUM_QueryUserGroups		0x27
75#define SAMR_OPNUM_QueryDispInfo		0x28	/* QueryDispInfo1 */
76#define	SAMR_OPNUM_GetDisplayEnumIndex		0x29
77#define	SAMR_OPNUM_TestPrivateDomainFunctions	0x2a	/* NotUsedOnWire */
78#define	SAMR_OPNUM_TestPrivateUserFunctions	0x2b	/* NotUsedOnWire */
79#define SAMR_OPNUM_GetUserPwInfo		0x2c
80
81/* Windows 2000 */
82#define	SAMR_OPNUM_RemoveMemberFromForeignDomain        0x2d
83#define	SAMR_OPNUM_QueryInfoDomain2		0x2e
84#define	SAMR_OPNUM_QueryInfoUser2		0x2f
85#define	SAMR_OPNUM_EnumDomainGroups		0x30    /* QueryDispInfo2 */
86#define	SAMR_OPNUM_GetDisplayEnumIndex2		0x31
87#define	SAMR_OPNUM_CreateUser			0x32
88#define	SAMR_OPNUM_QueryDispInfo4		0x33
89#define	SAMR_OPNUM_AddMultipleAliasMembers	0x34
90#define	SAMR_OPNUM_RemoveMultipleAliasMembers	0x35
91#define	SAMR_OPNUM_ChangeUserOemPassword	0x36
92#define SAMR_OPNUM_ChangeUserPasswd		0x37	/* UnicodePasswd */
93#define SAMR_OPNUM_GetDomainPwInfo		0x38
94#define SAMR_OPNUM_Connect2                     0x39    /* SamrConnect2 */
95#define SAMR_OPNUM_SetUserInfo			0x3a
96#define	SAMR_OPNUM_SetBootKeyInformation	0x3b
97#define	SAMR_OPNUM_GetBootKeyInformation	0x3c
98#define	SAMR_OPNUM_Connect3			0x3d	/* NotUsedOnWire */
99#define	SAMR_OPNUM_Connect4			0x3e	/* SamrConnect4 */
100#define	SAMR_OPNUM_ChangeUserUnicodePassword3	0x3f
101
102/* Windows XP and Windows Server 2003 */
103#define	SAMR_OPNUM_Connect5			0x40	/* SamrConnect5 */
104#define	SAMR_OPNUM_RidToSid                     0x41
105#define	SAMR_OPNUM_SetDSRMPassword              0x42
106#define	SAMR_OPNUM_ValidatePassword             0x43
107
108/* Windows Vista */
109#define SAMR_OPNUM_QueryLocalizableAccountsInDomain     0x44
110#define SAMR_OPNUM_PerformGenericOperation              0x45
111
112
113/*
114 * UNION_INFO_ENT is intended to simplify adding new entries to a union.
115 * If the entry structures are named using the form samr_QueryUserInfoX,
116 * where X is the sitch_value, you can just add a single line. Note
117 * that you must also update the fixup function in mlsvc_sam.c.
118 */
119#define UNION_INFO_ENT(N,NAME) CASE(N) struct NAME##N info##N
120
121
122/*
123 * Sam account flags used when creating an account. These flags seem
124 * to be very similar to the USER_INFO_X flags (UF_XXX) in lmaccess.h
125 * but the values are different.
126 */
127#define SAMR_AF_ACCOUNTDISABLE			0x0001
128#define SAMR_AF_HOMEDIR_REQUIRED		0x0002
129#define SAMR_AF_PASSWD_NOTREQD			0x0004
130#define SAMR_AF_TEMP_DUPLICATE_ACCOUNT		0x0008
131#define SAMR_AF_NORMAL_ACCOUNT			0x0010
132#define SAMR_AF_MNS_LOGON_ACCOUNT		0x0020
133#define SAMR_AF_INTERDOMAIN_TRUST_ACCOUNT	0x0040
134#define SAMR_AF_WORKSTATION_TRUST_ACCOUNT	0x0080
135#define SAMR_AF_SERVER_TRUST_ACCOUNT		0x0100
136#define SAMR_AF_DONT_EXPIRE_PASSWD		0x0200
137#define SAMR_AF_ACCOUNT_AUTOLOCK		0x0400
138
139
140#define SAMR_AF_MACHINE_ACCOUNT_MASK	( \
141				SAMR_AF_INTERDOMAIN_TRUST_ACCOUNT \
142				| SAMR_AF_WORKSTATION_TRUST_ACCOUNT \
143				| SAMR_AF_SERVER_TRUST_ACCOUNT)
144
145#define SAMR_AF_ACCOUNT_TYPE_MASK	( \
146				SAMR_AF_TEMP_DUPLICATE_ACCOUNT \
147				| SAMR_AF_NORMAL_ACCOUNT \
148				| SAMR_AF_INTERDOMAIN_TRUST_ACCOUNT \
149				| SAMR_AF_WORKSTATION_TRUST_ACCOUNT \
150				| SAMR_AF_SERVER_TRUST_ACCOUNT)
151
152/*
153 * QueryUserInfo UserAllInformation WhichFields
154 */
155#define	SAMR_USER_ALL_USERNAME			0x00000001
156#define	SAMR_USER_ALL_FULLNAME			0x00000002
157#define	SAMR_USER_ALL_USERID			0x00000004
158#define	SAMR_USER_ALL_PRIMARYGROUPID		0x00000008
159#define	SAMR_USER_ALL_ADMINCOMMENT		0x00000010
160#define	SAMR_USER_ALL_USERCOMMENT		0x00000020
161#define	SAMR_USER_ALL_HOMEDIRECTORY		0x00000040
162#define	SAMR_USER_ALL_HOMEDIRECTORYDRIVE	0x00000080
163#define	SAMR_USER_ALL_SCRIPTPATH		0x00000100
164#define	SAMR_USER_ALL_PROFILEPATH		0x00000200
165#define	SAMR_USER_ALL_WORKSTATIONS		0x00000400
166#define	SAMR_USER_ALL_LASTLOGON			0x00000800
167#define	SAMR_USER_ALL_LASTLOGOFF		0x00001000
168#define	SAMR_USER_ALL_LOGONHOURS		0x00002000
169#define	SAMR_USER_ALL_BADPASSWORDCOUNT		0x00004000
170#define	SAMR_USER_ALL_LOGONCOUNT		0x00008000
171#define	SAMR_USER_ALL_PASSWORDCANCHANGE		0x00010000
172#define	SAMR_USER_ALL_PASSWORDMUSTCHANGE	0x00020000
173#define	SAMR_USER_ALL_PASSWORDLASTSET		0x00040000
174#define	SAMR_USER_ALL_ACCOUNTEXPIRES		0x00080000
175#define	SAMR_USER_ALL_USERACCOUNTCONTROL	0x00100000
176#define	SAMR_USER_ALL_PARAMETERS		0x00200000
177#define	SAMR_USER_ALL_COUNTRYCODE		0x00400000
178#define	SAMR_USER_ALL_CODEPAGE			0x00800000
179#define	SAMR_USER_ALL_NTPASSWORDPRESENT		0x01000000
180#define	SAMR_USER_ALL_LMPASSWORDPRESENT		0x02000000
181#define	SAMR_USER_ALL_PRIVATEDATA		0x04000000
182#define	SAMR_USER_ALL_PASSWORDEXPIRED		0x08000000
183#define	SAMR_USER_ALL_SECURITYDESCRIPTOR	0x10000000
184#define	SAMR_USER_ALL_UNDEFINED_MASK		0xC0000000
185
186/*
187 * Alias Access Mask values for SAMR
188 * Section 2.2.1.6 of MS-SAMR
189 */
190#define SAMR_ALIAS_ACCESS_EXECUTE		0x00020008
191#define SAMR_ALIAS_ACCESS_WRITE			0x00020013
192#define SAMR_ALIAS_ACCESS_READ			0x00020004
193#define SAMR_ALIAS_ACCESS_ALL_ACCESS		0x000F001F
194#define SAMR_ALIAS_ACCESS_WRITE_ACCOUNT		0x00000010
195#define SAMR_ALIAS_ACCESS_READ_INFO		0x00000008
196#define SAMR_ALIAS_ACCESS_LIST_MEMBERS		0x00000004
197#define SAMR_ALIAS_ACCESS_REMOVE_MEMBER		0x00000002
198#define SAMR_ALIAS_ACCESS_ADD_MEMBER		0x00000001
199
200#define	SAMR_REVISION_1			1	/* Pre Windows 2000 */
201#define	SAMR_REVISION_2			2	/* Windows 2000 */
202#define	SAMR_REVISION_3			3	/* Post Windows 2000 */
203
204/*
205 * Definition for a SID. The ndl compiler does not allow a typedef of
206 * a structure containing variable size members.
207 */
208struct samr_sid {
209	BYTE		Revision;
210	BYTE		SubAuthCount;
211	BYTE		Authority[6];
212  SIZE_IS(SubAuthCount)
213	DWORD		SubAuthority[ANY_SIZE_ARRAY];
214};
215
216
217/*
218 * SAMR definition of a security_descriptor.
219 */
220struct samr_sec_desc {
221	BYTE Revision;
222	BYTE Sbz1;
223	WORD Control;
224	struct samr_sid *owner;
225	struct samr_sid *group;
226	struct samr_sid *sacl;
227	struct samr_sid *dacl;
228};
229
230struct samr_sd {
231	DWORD length;
232  SIZE_IS(length)
233	BYTE *data;
234};
235typedef struct samr_sd samr_sd_t;
236
237/*
238 * Definition for a string. The length and allosize should be set to
239 * twice the string length (i.e. strlen(str) * 2). The runtime code
240 * will perform the appropriate string to a wide-char conversions,
241 * so str should point to a regular char * string.
242 */
243struct samr_string {
244	WORD		length;
245	WORD		allosize;
246	LPTSTR		str;
247};
248typedef struct samr_string samr_string_t;
249
250
251/*
252 * Alternative varying/conformant string definition - for
253 * non-null terminated strings. This definition must match
254 * ndr_vcbuf_t.
255 */
256struct samr_vcb {
257	/*
258	 * size_is (actually a copy of length_is) will
259	 * be inserted here by the marshalling library.
260	 */
261	DWORD vc_first_is;
262	DWORD vc_length_is;
263  SIZE_IS(vc_length_is)
264	WORD buffer[ANY_SIZE_ARRAY];
265};
266
267struct samr_vcbuf {
268	WORD wclen;
269	WORD wcsize;
270	struct samr_vcb *vcb;
271};
272typedef struct samr_vcbuf samr_vcbuf_t;
273
274CONTEXT_HANDLE(samr_handle) samr_handle_t;
275
276/*
277 * OLD_LARGE_INTEGER: a 64-bit value.
278 */
279struct samr_quad {
280	DWORD low;
281	DWORD high;
282};
283typedef struct samr_quad samr_quad_t;
284
285/*
286 * Blob used for the NT and LM OWF passwords.
287 * The length and maxlen should be 16.
288 */
289struct samr_short_blob {
290	WORD	length;
291	WORD	maxlen;
292  SIZE_IS(length / 2)
293	WORD	*buf;
294};
295
296#define	DOMAIN_PASSWORD_COMPLEX			0x00000001
297#define	DOMAIN_PASSWORD_NO_ANON_CHANGE		0x00000002
298#define	DOMAIN_PASSWORD_NO_CLEAR_CHANGE		0x00000004
299#define	DOMAIN_LOCKOUT_ADMINS			0x00000008
300#define	DOMAIN_PASSWORD_STORE_CLEARTEXT		0x00000010
301#define	DOMAIN_REFUSE_PASSWORD_CHANGE		0x00000020
302
303struct samr_password_info {
304	WORD	min_length;
305	DWORD	properties;
306};
307typedef struct samr_password_info samr_password_info_t;
308
309/*
310 * There is some sort of logon bitmap structure in here, which I
311 * think is a varying and conformant array, i.e.
312 *
313 *	struct samr_logon_hours {
314 *      DWORD size_is;		(1260)
315 *      DWORD first_is;		(zero)
316 *      DWORD length_is;	(168)
317 *      BYTE bitmap[21];
318 *  };
319 *
320 *	struct samr_logon_info {
321 *		DWORD length;
322 *	SIZE_IS(length / 8)
323 *		struct samr_logon_hours *hours;
324 *	};
325 *
326 * There are 10080 minutes/week => 10080/8 = 1260 (0x04EC).
327 * So size_is is set as some sort of maximum.
328 *
329 * There are 168 hours/week => 168/8 = 21 (0xA8). Since there are 21
330 * bytes (all set to 0xFF), this is is probably the default setting.
331 */
332
333#define SAMR_MINS_PER_WEEK		10080
334#define SAMR_HOURS_PER_WEEK		168
335
336#define SAMR_HOURS_MAX_SIZE		(SAMR_MINS_PER_WEEK / 8)
337#define SAMR_HOURS_SET_LEN(LEN)		((LEN) / 8)
338#define SAMR_SET_USER_HOURS_SZ		21
339
340struct samr_logon_hours {
341	DWORD size;
342	DWORD first;
343	DWORD length;
344	BYTE bitmap[SAMR_SET_USER_HOURS_SZ];
345};
346
347struct samr_logon_info {
348	DWORD units;
349	DWORD hours;
350};
351
352struct samr_logon_hours_all {
353	WORD	units_per_week;
354  SIZE_IS(units_per_week / 8)
355	BYTE	*hours;
356};
357
358struct samr_oem_password {
359	BYTE password[512];
360	DWORD length;
361};
362
363/*
364 ***********************************************************************
365 * SamrConnect.
366 ***********************************************************************
367 */
368OPERATION(SAMR_OPNUM_Connect)
369struct samr_Connect {
370	IN	DWORD *servername;
371	IN	DWORD access_mask;
372	OUT	samr_handle_t handle;
373	OUT	DWORD status;
374};
375
376
377/*
378 ***********************************************************************
379 * SamrConnect2.
380 ***********************************************************************
381 */
382OPERATION(SAMR_OPNUM_Connect2)
383struct samr_Connect2 {
384	IN	LPTSTR servername;
385	IN	DWORD access_mask;
386	OUT	samr_handle_t handle;
387	OUT	DWORD status;
388};
389
390
391/*
392 ***********************************************************************
393 * SamrConnect4. A new form of connect first seen with Windows 2000.
394 * A new field has been added to the input request. Value: 0x00000002.
395 ***********************************************************************
396 */
397OPERATION(SAMR_OPNUM_Connect4)
398struct samr_Connect4 {
399	IN	LPTSTR servername;
400	IN	DWORD revision;
401	IN	DWORD access_mask;
402	OUT	samr_handle_t handle;
403	OUT	DWORD status;
404};
405
406
407/*
408 ***********************************************************************
409 * SamrConnect5. A new form of connect first seen with Windows XP.
410 * The server name is the fully qualified domain name, i.e.
411 *	\\server.sun.com.
412 *
413 * [in]  DWORD	 InVersion,
414 * [in]  [switch_is(InVersion)]    samr_revision_info *InRevisionInfo
415 * [out] DWORD	 *OutVersion
416 * [out] [switch_is(*OutVersion)] *samr_revision_info *OutRevisionInfo
417 *
418 * SupportedFeatures (see notes in [MS-SAMR]
419 *	0x00000001	RID values returned from the server must not be
420 *			concatenated with the domain SID.
421 *	0x00000002	Reserved
422 *	0x00000004	Reserved
423 ***********************************************************************
424 */
425struct samr_revision_info1 {
426	DWORD revision;
427	DWORD supported_features;
428};
429typedef struct samr_revision_info1 samr_revision_info1_t;
430
431union samr_revision_info {
432	UNION_INFO_ENT(1,samr_revision_info);
433	DEFAULT	char *nullptr;
434};
435
436OPERATION(SAMR_OPNUM_Connect5)
437struct samr_Connect5 {
438	IN		LPTSTR servername;
439	IN		DWORD access_mask;
440	INOUT	DWORD unknown2_00000001;
441	INOUT	DWORD unknown3_00000001;
442	INOUT	DWORD unknown4_00000003;
443	INOUT	DWORD unknown5_00000000;
444	OUT		samr_handle_t handle;
445	OUT		DWORD status;
446};
447
448
449/*
450 ***********************************************************************
451 * CloseHandle closes an association with the SAM. Using the same
452 * structure as the LSA seems to work.
453 ***********************************************************************
454 */
455OPERATION(SAMR_OPNUM_CloseHandle)
456struct samr_CloseHandle {
457	IN	samr_handle_t handle;
458	OUT	samr_handle_t result_handle;
459	OUT	DWORD status;
460};
461
462
463/*
464 ***********************************************************************
465 * LookupDomain: lookup up the domain SID.
466 ***********************************************************************
467 */
468OPERATION(SAMR_OPNUM_LookupDomain)
469struct samr_LookupDomain {
470	IN	samr_handle_t handle;
471	IN	samr_string_t domain_name;
472	OUT struct samr_sid *sid;
473	OUT	DWORD status;
474};
475
476
477/*
478 ***********************************************************************
479 * EnumLocalDomain
480 *
481 * This looks like a request to get the local domains supported by a
482 * remote server. NT always seems to return 2 domains: the local
483 * domain (hostname) and the Builtin domain.
484 *
485 * The max_length field is set to 0x2000.
486 * Enum_context is set to 0 in the request and set to entries_read in
487 * the reply. Like most of these enums, total_entries is the same as
488 * entries_read.
489 ***********************************************************************
490 */
491struct samr_LocalDomainEntry {
492	DWORD unknown;
493	samr_string_t name;
494};
495
496struct samr_LocalDomainInfo {
497	DWORD entries_read;
498  SIZE_IS(entries_read)
499	struct samr_LocalDomainEntry *entry;
500};
501
502
503OPERATION(SAMR_OPNUM_EnumLocalDomains)
504struct samr_EnumLocalDomain {
505	IN		samr_handle_t handle;
506	INOUT	DWORD enum_context;
507	IN		DWORD max_length;
508	OUT		struct samr_LocalDomainInfo *info;
509	OUT		DWORD total_entries;
510	OUT		DWORD status;
511};
512
513
514/*
515 ***********************************************************************
516 * OpenDomain
517 *
518 * Open a specific domain within the SAM. From this I assume that each
519 * SAM can handle multiple domains so you need to identify the one with
520 * which you want to work. Working with a domain handle does appear to
521 * offer the benefit that you can then use RIDs instead of full SIDs,
522 * which simplifies things a bit. The domain handle can be used to get
523 * user and group handles.
524 ***********************************************************************
525 */
526OPERATION(SAMR_OPNUM_OpenDomain)
527struct samr_OpenDomain {
528	IN	samr_handle_t handle;
529	IN	DWORD access_mask;
530	IN REFERENCE struct samr_sid *sid;
531	OUT	samr_handle_t domain_handle;
532	OUT	DWORD status;
533};
534
535
536/*
537 ***********************************************************************
538 * QueryDomainInfo
539 *
540 * Windows 95 Server Manager sends requests for levels 6 and 7 when
541 * the services menu item is selected.
542 ***********************************************************************
543 */
544#define SAMR_QUERY_DOMAIN_INFO_2		2
545#define SAMR_QUERY_DOMAIN_INFO_6		6
546#define SAMR_QUERY_DOMAIN_INFO_7		7
547
548
549struct samr_QueryDomainInfo2 {
550	DWORD unknown1;			/* 00 00 00 00 */
551	DWORD unknown2;			/* 00 00 00 80 */
552	samr_string_t s1;
553	samr_string_t domain;
554	samr_string_t s2;
555	DWORD sequence_num;		/* 2B 00 00 00 */
556	DWORD unknown3;			/* 00 00 00 00 */
557	DWORD unknown4;			/* 01 00 00 00 */
558	DWORD unknown5;			/* 03 00 00 00 */
559	DWORD unknown6;			/* 01 */
560	DWORD num_users;
561	DWORD num_groups;
562	DWORD num_aliases;
563};
564
565
566struct samr_QueryDomainInfo6 {
567	DWORD unknown1;			/* 00 00 00 00 */
568	DWORD unknown2;			/* B0 7F 14 00 */
569	DWORD unknown3;			/* 00 00 00 00 */
570	DWORD unknown4;			/* 00 00 00 00 */
571	DWORD unknown5;			/* 00 00 00 00 */
572};
573
574
575struct samr_QueryDomainInfo7 {
576	DWORD unknown1;			/* 03 00 00 00 */
577};
578
579
580union samr_QueryDomainInfo_ru {
581	UNION_INFO_ENT(2,samr_QueryDomainInfo);
582	UNION_INFO_ENT(6,samr_QueryDomainInfo);
583	UNION_INFO_ENT(7,samr_QueryDomainInfo);
584	DEFAULT	char *nullptr;
585};
586
587struct samr_QueryDomainInfoRes {
588	WORD switch_value;
589	SWITCH(switch_value)
590		union samr_QueryDomainInfo_ru ru;
591};
592
593OPERATION(SAMR_OPNUM_QueryDomainInfo)
594struct samr_QueryDomainInfo {
595	IN	samr_handle_t domain_handle;
596	IN	WORD info_level;
597	OUT	struct samr_QueryDomainInfoRes *info;
598	OUT	DWORD status;
599};
600
601/*
602 * Identical to SAMR_OPNUM_QueryDomainInfo.
603 */
604OPERATION(SAMR_OPNUM_QueryInfoDomain2)
605struct samr_QueryInfoDomain2 {
606	IN	samr_handle_t	domain_handle;
607	IN	WORD		info_level;
608	OUT	struct samr_QueryDomainInfoRes *info;
609	OUT	DWORD		status;
610};
611
612#define SAMR_QUERY_ALIAS_INFO_1			1
613#define SAMR_QUERY_ALIAS_INFO_3			3
614
615
616struct samr_QueryAliasInfo1 {
617	WORD level;
618	samr_string_t name;
619	DWORD unknown;
620	samr_string_t desc;
621};
622
623struct samr_QueryAliasInfo3 {
624	WORD level;
625	samr_string_t desc;
626};
627
628union samr_QueryAliasInfo_ru {
629	UNION_INFO_ENT(1,samr_QueryAliasInfo);
630	UNION_INFO_ENT(3,samr_QueryAliasInfo);
631	DEFAULT	char *nullptr;
632};
633
634struct samr_QueryAliasInfoRes {
635	DWORD address;
636	WORD switch_value;
637	SWITCH(switch_value)
638		union samr_QueryAliasInfo_ru ru;
639};
640
641OPERATION(SAMR_OPNUM_QueryAliasInfo)
642struct samr_QueryAliasInfo {
643	IN	samr_handle_t alias_handle;
644	IN	WORD level;
645	OUT DWORD address;
646  SWITCH (level)
647	OUT	union samr_QueryAliasInfo_ru ru;
648	OUT	DWORD status;
649};
650
651OPERATION(SAMR_OPNUM_CreateDomainAlias)
652struct samr_CreateDomainAlias {
653	IN	samr_handle_t domain_handle;
654	IN	samr_string_t alias_name;
655	IN	DWORD access_mask;
656	OUT samr_handle_t alias_handle;
657	OUT	DWORD rid;
658	OUT	DWORD status;
659};
660
661OPERATION(SAMR_OPNUM_SetAliasInfo)
662struct samr_SetAliasInfo {
663	IN	samr_handle_t alias_handle;
664	IN	WORD level;
665	/* TBD */
666	OUT	DWORD status;
667};
668
669OPERATION(SAMR_OPNUM_DeleteDomainAlias)
670struct samr_DeleteDomainAlias {
671	INOUT	samr_handle_t alias_handle;
672	OUT	DWORD status;
673};
674
675OPERATION(SAMR_OPNUM_OpenAlias)
676struct samr_OpenAlias {
677	IN	samr_handle_t domain_handle;
678	IN	DWORD access_mask;
679	IN	DWORD rid;
680	OUT samr_handle_t alias_handle;
681	OUT	DWORD status;
682};
683
684struct name_rid {
685	DWORD rid;
686	samr_string_t name;
687};
688
689struct aliases_info {
690	DWORD count;
691	DWORD address;
692	SIZE_IS(count)
693	struct name_rid info[ANY_SIZE_ARRAY];
694};
695
696OPERATION(SAMR_OPNUM_EnumDomainAliases)
697struct samr_EnumDomainAliases {
698	IN	samr_handle_t domain_handle;
699	IN	DWORD resume_handle;
700	IN	DWORD mask;
701	OUT	DWORD out_resume;
702	OUT struct aliases_info *aliases;
703	OUT DWORD entries;
704	OUT	DWORD status;
705};
706
707struct user_acct_info {
708	DWORD index;
709	DWORD rid;
710	DWORD ctrl;
711	samr_string_t name;
712	samr_string_t fullname;
713	samr_string_t desc;
714};
715
716struct user_disp_info {
717	OUT DWORD total_size;
718	OUT DWORD returned_size;
719	OUT WORD switch_value;
720	DWORD count;
721	SIZE_IS(count)
722	struct user_acct_info *acct;
723};
724
725OPERATION(SAMR_OPNUM_QueryDispInfo)
726struct samr_QueryDispInfo {
727	IN	samr_handle_t domain_handle;
728	IN	WORD level;
729	IN	DWORD start_idx;
730	IN	DWORD max_entries;
731	IN	DWORD pref_maxsize;
732	OUT struct user_disp_info users;
733	OUT	DWORD status;
734};
735
736struct group_acct_info {
737	DWORD index;
738	DWORD rid;
739	DWORD ctrl;
740	samr_string_t name;
741	samr_string_t desc;
742};
743
744struct group_disp_info {
745	DWORD count;
746	/* right now we just need one entry */
747	struct group_acct_info acct[1];
748};
749
750OPERATION(SAMR_OPNUM_EnumDomainGroups)
751struct samr_EnumDomainGroups {
752	IN	samr_handle_t domain_handle;
753	IN	WORD level;
754	IN	DWORD start_idx;
755	IN	DWORD max_entries;
756	IN	DWORD pref_maxsize;
757	OUT DWORD total_size;
758	OUT DWORD returned_size;
759	OUT WORD switch_value;
760	OUT DWORD count;
761	OUT struct group_disp_info *groups;
762	OUT	DWORD status;
763};
764
765/*
766 ***********************************************************************
767 * OpenUser
768 *
769 * Input must be a domain handle obtained via SAMR_OPNUM_OpenDomain,
770 * an access mask and the appropriate user rid. The output will be a
771 * handle for use with the specified user.
772 ***********************************************************************
773 */
774OPERATION(SAMR_OPNUM_OpenUser)
775struct samr_OpenUser {
776	IN	samr_handle_t handle;
777	IN	DWORD access_mask;
778	IN	DWORD rid;
779	OUT	samr_handle_t user_handle;
780	OUT	DWORD status;
781};
782
783
784/*
785 ***********************************************************************
786 * DeleteUser
787 ***********************************************************************
788 */
789OPERATION(SAMR_OPNUM_DeleteUser)
790struct samr_DeleteUser {
791	INOUT	samr_handle_t user_handle;
792	OUT	DWORD status;
793};
794
795
796/*
797 ***********************************************************************
798 * QueryUserInfo
799 *
800 * Provides various pieces of information on a specific user (see
801 * SAM_Q_QUERY_USERINFO and SAM_R_QUERY_USERINFO). The handle must
802 * be a valid SAM user handle.
803 *
804 * QueryUserInfo (
805 *	IN samr_handle_t user_handle,
806 *	IN WORD switch_value,
807 *	OUT union switch(switch_value) {
808 *		case 1: struct QueryUserInfo1 *info1;
809 *	} bufptr,
810 *	OUT DWORD status
811 * )
812 *
813 * typedef enum _USER_INFORMATION_CLASS {
814 *	UserGeneralInformation		= 1,
815 *	UserPreferencesInformation	= 2,
816 *	UserLogonInformation		= 3,
817 *	UserLogonHoursInformation	= 4,
818 *	UserAccountInformation		= 5,
819 *	UserNameInformation		= 6,
820 *	UserAccountNameInformation	= 7,
821 *	UserFullNameInformation		= 8,
822 *	UserPrimaryGroupInformation	= 9,
823 *	UserHomeInformation		= 10,
824 *	UserScriptInformation		= 11,
825 *	UserProfileInformation		= 12,
826 *	UserAdminCommentInformation	= 13,
827 *	UserWorkStationsInformation	= 14,
828 *	UserControlInformation		= 16,
829 *	UserExpiresInformation		= 17,
830 *	UserInternal1Information	= 18,
831 *	UserParametersInformation	= 20,
832 *	UserAllInformation		= 21,
833 *	UserInternal4Information	= 23,
834 *	UserInternal5Information	= 24,
835 *	UserInternal4InformationNew	= 25,
836 *	UserInternal5InformationNew	= 26,
837 * } USER_INFORMATION_CLASS;
838 *
839 * 1 = username, fullname, description and some other stuff.
840 * 3 = large structure containing user rid, group rid, username
841 *     and fullname.
842 * 5 = large structure (like 3) containing user rid, group rid,
843 *     username, fullname and description.
844 * 6 = username and fullname
845 * 7 = username
846 * 8 = fullname
847 * 9 = group rid
848 * 16 = used after creating a new account
849 *
850 * Due to an ndrgen bug, a function must be provided to to patch the
851 * offsets used by the unmarshalling code at runtime.  In order to
852 * simplify things it is useful to use a naming convention that
853 * indicates the switch value for each structure.
854 *
855 ***********************************************************************
856 */
857
858
859#define SAMR_QUERY_USER_INFO_1			1
860#define SAMR_QUERY_USER_UNAME_AND_FNAME		6
861#define SAMR_QUERY_USER_USERNAME		7
862#define SAMR_QUERY_USER_FULLNAME		8
863#define SAMR_QUERY_USER_GROUPRID		9
864#define SAMR_QUERY_USER_CONTROL_INFO		16
865#define SAMR_QUERY_USER_ALL_INFO		21
866
867
868struct samr_QueryUserInfo1 {
869	samr_string_t username;
870	samr_string_t fullname;
871	DWORD group_rid;
872	samr_string_t description;
873	samr_string_t unknown;
874};
875
876
877struct samr_QueryUserInfo6 {
878	samr_string_t username;
879	samr_string_t fullname;
880};
881
882struct samr_QueryUserInfo7 {
883	samr_string_t username;
884};
885
886
887struct samr_QueryUserInfo8 {
888	samr_string_t fullname;
889};
890
891
892struct samr_QueryUserInfo9 {
893	DWORD group_rid;
894};
895
896
897struct samr_QueryUserInfo16 {
898	DWORD unknown;
899};
900
901/*
902 * SAMR_USER_ALL_INFORMATION
903 */
904struct samr_QueryUserInfo21 {
905	samr_quad_t		LastLogon;
906	samr_quad_t		LastLogoff;
907	samr_quad_t		PasswordLastSet;
908	samr_quad_t		AccountExpires;
909	samr_quad_t		PasswordCanChange;
910	samr_quad_t		PasswordMustChange;
911	samr_string_t		UserName;
912	samr_string_t		FullName;
913	samr_string_t		HomeDirectory;
914	samr_string_t		HomeDirectoryDrive;
915	samr_string_t		ScriptPath;
916	samr_string_t		ProfilePath;
917	samr_string_t		AdminComment;
918	samr_string_t		WorkStations;
919	samr_string_t		UserComment;
920	samr_string_t		Parameters;
921	struct samr_short_blob	LmOwfPassword;
922	struct samr_short_blob	NtOwfPassword;
923	samr_string_t		PrivateData;
924	samr_sd_t		SecurityDescriptor;
925	DWORD			UserId;
926	DWORD			PrimaryGroupId;
927	DWORD			UserAccountControl;
928	DWORD			WhichFields;
929	struct samr_logon_hours_all	LogonHours;
930	WORD			BadPasswordCount;
931	WORD			LogonCount;
932	WORD			CountryCode;
933	WORD			CodePage;
934	BYTE			LmPasswordPresent;
935	BYTE			NtPasswordPresent;
936	BYTE			PasswordExpired;
937	BYTE			PrivateDataSensitive;
938};
939
940union QueryUserInfo_result_u {
941	UNION_INFO_ENT(1,samr_QueryUserInfo);
942	UNION_INFO_ENT(6,samr_QueryUserInfo);
943	UNION_INFO_ENT(7,samr_QueryUserInfo);
944	UNION_INFO_ENT(8,samr_QueryUserInfo);
945	UNION_INFO_ENT(9,samr_QueryUserInfo);
946	UNION_INFO_ENT(16,samr_QueryUserInfo);
947	UNION_INFO_ENT(21,samr_QueryUserInfo);
948	DEFAULT	char *nullptr;
949};
950
951
952/*
953 * This structure needs to be declared, even though it can't be used in
954 * samr_QueryUserInfo, in order to get the appropriate size to calculate
955 * the correct fixup offsets.  If ndrgen did the right thing,
956 * QueryUserInfo_result would be one of the out parameters.  However, if
957 * we do it that way, the switch_value isn't known early enough to do
958 * the fixup calculation.  So it all has to go in samr_QueryUserInfo.
959 */
960struct QueryUserInfo_result {
961	DWORD address;
962	WORD switch_value;
963	SWITCH(switch_value)
964		union QueryUserInfo_result_u ru;
965};
966
967
968OPERATION(SAMR_OPNUM_QueryUserInfo)
969struct samr_QueryUserInfo {
970	IN	samr_handle_t user_handle;
971	IN	WORD switch_value;
972	/*
973	 * Can't use this form because we need to include members explicitly.
974	 * OUT	struct QueryUserInfo_result result;
975	 */
976	OUT	DWORD address;
977	OUT	WORD switch_index;
978  SWITCH(switch_value)
979	OUT	union QueryUserInfo_result_u ru;
980	OUT	DWORD status;
981};
982
983
984/*
985 ***********************************************************************
986 * QueryUserGroups
987 ***********************************************************************
988 */
989struct samr_UserGroups {
990	DWORD rid;
991	DWORD attr;
992};
993
994
995struct samr_UserGroupInfo {
996	DWORD n_entry;
997  SIZE_IS(n_entry)
998	struct samr_UserGroups *groups;
999};
1000
1001
1002OPERATION(SAMR_OPNUM_QueryUserGroups)
1003struct samr_QueryUserGroups {
1004	IN	samr_handle_t user_handle;
1005	OUT struct samr_UserGroupInfo *info;
1006	OUT	DWORD status;
1007};
1008
1009
1010/*
1011 ***********************************************************************
1012 * LookupName
1013 ***********************************************************************
1014 */
1015struct samr_LookupNameTable {
1016	DWORD n_entry;
1017  SIZE_IS(n_entry)
1018	samr_string_t names[ANY_SIZE_ARRAY];
1019};
1020
1021
1022struct samr_LookupRidTable {
1023	DWORD n_entry;
1024  SIZE_IS(n_entry)
1025	DWORD *rid;
1026};
1027
1028struct samr_RidType {
1029	DWORD n_entry;
1030  SIZE_IS(n_entry)
1031	DWORD *rid_type;
1032};
1033
1034
1035OPERATION(SAMR_OPNUM_LookupNames)
1036struct samr_LookupNames {
1037	IN	samr_handle_t handle;
1038	IN	DWORD n_entry;
1039	IN	DWORD max_n_entry;
1040	IN	DWORD index;
1041	IN	DWORD total;
1042	IN	samr_string_t name;
1043	OUT	struct samr_LookupRidTable rids;
1044	OUT	struct samr_RidType rid_types;
1045	OUT	DWORD status;
1046};
1047
1048
1049/*
1050 ***********************************************************************
1051 * OpenGroup
1052 *
1053 * Input must be a domain handle obtained via SAMR_OPNUM_OpenDomain,
1054 * an access mask and the appropriate group rid. The output will be a
1055 * handle for use with the specified group.
1056 ***********************************************************************
1057 */
1058OPERATION(SAMR_OPNUM_OpenGroup)
1059struct samr_OpenGroup {
1060	IN	samr_handle_t handle;
1061	IN	DWORD access_mask;
1062	IN	DWORD rid;
1063	OUT	samr_handle_t group_handle;
1064	OUT	DWORD status;
1065};
1066
1067
1068/*
1069 ***********************************************************************
1070 * QueryGroupInfo
1071 *
1072 * Input must be a group handle obtained via SAMR_OPNUM_OpenGroup,
1073 * an access mask and the appropriate group rid. The output will
1074 * be a handle for use with the specified group.
1075 ***********************************************************************
1076 */
1077struct samr_QueryGroupInfo1 {
1078	samr_string_t groupname;
1079};
1080
1081
1082union samr_QueryGroupInfo_result_u {
1083	UNION_INFO_ENT(1,samr_QueryGroupInfo);
1084	DEFAULT	char *nullptr;
1085};
1086
1087
1088struct samr_QueryGroupInfo_result {
1089	DWORD address;
1090	WORD switch_index;
1091  SWITCH(switch_index)
1092	union samr_QueryGroupInfo_result_u ru;
1093};
1094
1095
1096OPERATION(SAMR_OPNUM_QueryGroupInfo)
1097struct samr_QueryGroupInfo {
1098	IN	samr_handle_t group_handle;
1099	IN	DWORD switch_value;
1100	OUT	DWORD address;
1101	OUT	WORD switch_index;
1102  SWITCH(switch_index)
1103	OUT	union samr_QueryGroupInfo_result_u ru;
1104	OUT	DWORD status;
1105};
1106
1107
1108/*
1109 ***********************************************************************
1110 * StoreGroupInfo
1111 *
1112 * This definition is mostly just a place holder in case this is useful
1113 * in the future. Note that it may not be correct. The information is
1114 * from a netmon trace captured when I added a group description. I
1115 * haven't implemented it because we don't have to update anything on
1116 * the PDC. The description should almost certainly be in a separate
1117 * structure.
1118 ***********************************************************************
1119 */
1120OPERATION(SAMR_OPNUM_StoreGroupInfo)
1121struct samr_StoreGroupInfo {
1122	IN	samr_handle_t group_handle;
1123	IN	DWORD switch_value;
1124	IN	samr_string_t group_description;
1125	OUT	DWORD status;
1126};
1127
1128/*
1129 * AddAliasMember
1130 */
1131OPERATION(SAMR_OPNUM_AddAliasMember)
1132struct samr_AddAliasMember {
1133	IN		samr_handle_t alias_handle;
1134	IN REFERENCE	struct samr_sid *sid;
1135	OUT DWORD	status;
1136};
1137
1138/*
1139 * DeleteAliasMember
1140 */
1141OPERATION(SAMR_OPNUM_DeleteAliasMember)
1142struct samr_DeleteAliasMember {
1143	IN		samr_handle_t alias_handle;
1144	IN REFERENCE	struct samr_sid *sid;
1145	OUT DWORD	status;
1146};
1147
1148struct samr_SidList {
1149	struct samr_sid		*sid;
1150};
1151
1152struct samr_SidInfo {
1153	DWORD n_entry;
1154  SIZE_IS(n_entry)
1155	struct samr_SidList	*sidlist;
1156};
1157
1158/*
1159 * ListAliasMembers
1160 */
1161OPERATION(SAMR_OPNUM_ListAliasMembers)
1162struct samr_ListAliasMembers {
1163	IN		samr_handle_t alias_handle;
1164	OUT		struct samr_SidInfo info;
1165	OUT DWORD	status;
1166};
1167
1168/*
1169 ***********************************************************************
1170 * GetUserDomainPasswordInformation
1171 ***********************************************************************
1172 */
1173OPERATION(SAMR_OPNUM_GetUserPwInfo)
1174struct samr_GetUserPwInfo {
1175	IN		samr_handle_t		user_handle;
1176	OUT REFERENCE	samr_password_info_t	*pwinfo;
1177	OUT		DWORD			status;
1178};
1179
1180
1181/*
1182 ***********************************************************************
1183 * CreateUser
1184 *
1185 * Create a user in the domain specified by the domain handle. The
1186 * domain handle is obtained obtained via SAMR_OPNUM_OpenDomain.
1187 * DesiredAccess: 0xe00500b0.
1188 * The output will be a handle for use with the specified user and the
1189 * user's RID. I think the RID may be a unique pointer (it can be null).
1190 ***********************************************************************
1191 */
1192OPERATION(SAMR_OPNUM_CreateUser)
1193struct samr_CreateUser {
1194	IN	samr_handle_t handle;
1195	IN	samr_vcbuf_t username;
1196	IN	DWORD account_flags;
1197	IN	DWORD desired_access;
1198	OUT	samr_handle_t user_handle;
1199	OUT	DWORD maybe_ptr;
1200	OUT	DWORD rid;
1201	OUT	DWORD status;
1202};
1203
1204
1205/*
1206 ***********************************************************************
1207 * ChangeUserPasswd
1208 ***********************************************************************
1209 */
1210struct samr_newpasswd {
1211	BYTE data[516];
1212};
1213
1214
1215struct samr_oldpasswd {
1216	BYTE data[16];
1217};
1218
1219
1220OPERATION(SAMR_OPNUM_ChangeUserPasswd)
1221struct samr_ChangeUserPasswd {
1222	IN	LPTSTR servername;
1223	IN	LPTSTR username;
1224	IN	struct samr_newpasswd *nt_newpasswd;
1225	IN	struct samr_oldpasswd *nt_oldpasswd;
1226	IN	struct samr_newpasswd *lm_newpasswd;
1227	IN	struct samr_oldpasswd *lm_oldpasswd;
1228	OUT	DWORD status;
1229};
1230
1231
1232/*
1233 ***********************************************************************
1234 * GetDomainPwInfo
1235 ***********************************************************************
1236 */
1237OPERATION(SAMR_OPNUM_GetDomainPwInfo)
1238struct samr_GetDomainPwInfo {
1239	IN		DWORD			unused;
1240	OUT REFERENCE	samr_password_info_t	*pwinfo;
1241	OUT		DWORD			status;
1242};
1243
1244
1245/*
1246 ***********************************************************************
1247 * SetUserInfo
1248 *
1249 *	+++ 20 byte user handle and the union switch_value +++
1250 *	00 00 00 00 77 F2 DD D5 66 48 D4 11 AD 5F D1 CD
1251 *	18 43 7A DF 17 00 17 00
1252 *
1253 *	+++ 14 dwords (56 bytes) of zeros +++
1254 *	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1255 *	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1256 *	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1257 *	00 00 00 00 00 00 00 00
1258 *
1259 *	+++ 9 sets of something - 72 bytes +++
1260 *	00 00 02 00 D0 04 8A 77
1261 *	00 00 02 00 D0 04 8A 77
1262 *	00 00 02 00 D0 04 8A 77
1263 *	00 00 02 00 D0 04 8A 77
1264 *	00 00 02 00 D0 04 8A 77
1265 *	00 00 02 00 D0 04 8A 77
1266 *	00 00 02 00 D0 04 8A 77
1267 *	00 00 02 00 D0 04 8A 77
1268 *	00 00 02 00 D0 04 8A 77
1269 *
1270 *	+++ 9 DWORD zeros +++
1271 *	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1272 *	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1273 *	00 00 00 00
1274 *
1275 *	+++ miscellaneous +++
1276 *	01 02 00 00
1277 *	80 00 00 00
1278 *	FA 27 F8 09
1279 *	A8 00 00 00 70 F1 14 00
1280 *	00 00 00 00 00 00 00 00 00 00 00 00
1281 *
1282 *	+++ encrypted password buffer - 512 bytes +++
1283 *	76 68 E8 AA 23 4F 62 C4 81 4E 30 B8 92 29 66 B9
1284 *	12 FF 3A 84 82 3A 55 0F C7 18 EA 56 86 50 D7 C5
1285 *	43 BA 9C F8 32 D4 E0 15 74 A1 6F E1 59 C2 F2 95
1286 *	53 A9 F2 68 9F 7F 29 B9 88 4C 65 A5 C1 DC 0B 44
1287 *	B8 3C ED 74 D1 6A F7 09 66 97 94 6B 2C 3A A5 88
1288 *	39 34 C6 FE 24 59 30 2D CF 6D 7F D5 EC B1 9A 84
1289 *	E6 57 96 29 40 32 FB 62 9D 93 E2 BE D8 A3 74 88
1290 *	8B 85 BC A0 76 D6 C9 DB 8C AF 81 BD 8A F0 08 8D
1291 *	23 B0 52 FD 69 DE EF A1 36 E5 30 19 BD DA 67 A3
1292 *	81 BD 3F D0 2A A2 8F 60 62 B0 8D 34 9E A4 4F 20
1293 *	4E 79 93 82 58 A8 E5 6F 7A DC 12 13 33 E6 74 02
1294 *	4C 32 F9 FC 1A E1 C5 0D E2 CC 36 8D FC 72 87 DD
1295 *	6C 44 E3 6F 4B FD 46 10 08 89 E5 64 B8 27 14 83
1296 *	E7 08 DE CF 69 C7 E1 40 63 DF CB 67 95 73 03 1B
1297 *	CA 99 E1 1B 53 2A 89 6B 30 39 CD 5C DF A0 8A 1C
1298 *	4E 50 74 7C 6D 3D E7 EA E9 B2 97 DD 38 7B DA EC
1299 *	1A AD DA CE C4 58 9B 29 F3 6D 30 70 4E 63 6D 84
1300 *	DB DC 5B CD 9A 4E 57 9C E4 65 5D 4F 76 E3 C7 52
1301 *	8B 3B 20 0A 3B 4C 4B B1 2E 5B 4D AB BA 2F 45 6A
1302 *	CA 17 AD 9F C0 B2 07 FB 56 7F E4 3F 9F D4 C6 8C
1303 *	A1 05 BF 53 42 1E 67 F4 57 54 E3 2C 38 CF E1 94
1304 *	75 69 F7 4E 5C 74 CC B3 FD EF 73 3F D5 28 22 EC
1305 *	9B 40 E1 1D 65 44 7C BB 69 88 57 10 05 3A C5 48
1306 *	8E 4F 77 DB 1A 5C 49 9C D5 06 00 AC 79 BC 7E 89
1307 *	B0 01 66 70 88 A2 E5 DF 96 DC 75 98 10 12 45 02
1308 *	33 35 6C DF 74 8B 14 2F 26 C6 FD 7A B4 D0 A6 7D
1309 *	DE 2B 13 44 EF 34 46 4D 9D 3E C3 75 BC 11 B4 41
1310 *	27 58 25 1E AF AA F0 BB DA 27 7A 1E AE 81 1A 78
1311 *	44 19 DE FC C4 7C 4E 32 44 F7 57 2A 41 A2 85 DC
1312 *	C0 AD 5D 6B 58 FD 2E 75 25 B9 F2 B6 19 82 E5 0E
1313 *	B6 69 0D C1 27 A9 B6 40 A6 50 49 E5 CB 17 98 65
1314 *	88 18 CA E4 1D 2E 20 F7 DE 8E 7D F2 9D A5 6B CD
1315 *
1316 *	D6 79 45 71
1317 *
1318 *	+++ table of 9 things +++
1319 *	01 00 00 00 00 00 00 00 00 00 00 00
1320 *	01 00 00 00 00 00 00 00 00 00 00 00
1321 *	01 00 00 00 00 00 00 00 00 00 00 00
1322 *	01 00 00 00 00 00 00 00 00 00 00 00
1323 *	01 00 00 00 00 00 00 00 00 00 00 00
1324 *	01 00 00 00 00 00 00 00 00 00 00 00
1325 *	01 00 00 00 00 00 00 00 00 00 00 00
1326 *	01 00 00 00 00 00 00 00 00 00 00 00
1327 *	01 00 00 00 00 00 00 00 00 00 00 00
1328 *
1329 *	+++ miscellaneous +++
1330 *	EC 04 00 00 00 00 00 00 15 00 00 00
1331 *	FF FF FF FF FF FF FF FF FF FF FF FF
1332 *	FF FF FF FF FF FF FF FF FF
1333 *
1334 ***********************************************************************
1335 */
1336
1337#define SAMR_SET_USER_INFO_23		23
1338#define SAMR_SET_USER_DATA_SZ		516
1339
1340struct samr_SetUserInfo23 {
1341	samr_quad_t logon_time;			/* 00 00 00 00 00 00 00 00 */
1342	samr_quad_t logoff_time;		/* 00 00 00 00 00 00 00 00 */
1343	samr_quad_t kickoff_time;		/* 00 00 00 00 00 00 00 00 */
1344	samr_quad_t passwd_last_set_time;	/* 00 00 00 00 00 00 00 00 */
1345	samr_quad_t passwd_can_change_time;	/* 00 00 00 00 00 00 00 00 */
1346	samr_quad_t passwd_must_change_time;	/* 00 00 00 00 00 00 00 00 */
1347
1348	samr_vcbuf_t user_name;			/* 00 00 00 00 00 00 00 00 */
1349	samr_vcbuf_t full_name;			/* 00 00 02 00 D0 04 8A 77 */
1350	samr_vcbuf_t home_dir;			/* 00 00 02 00 D0 04 8A 77 */
1351	samr_vcbuf_t home_drive;		/* 00 00 02 00 D0 04 8A 77 */
1352	samr_vcbuf_t logon_script;		/* 00 00 02 00 D0 04 8A 77 */
1353	samr_vcbuf_t profile_path;		/* 00 00 02 00 D0 04 8A 77 */
1354	samr_vcbuf_t acct_desc;			/* 00 00 02 00 D0 04 8A 77 */
1355	samr_vcbuf_t workstations;		/* 00 00 02 00 D0 04 8A 77 */
1356	samr_vcbuf_t unknown1;			/* 00 00 02 00 D0 04 8A 77 */
1357	samr_vcbuf_t unknown2;			/* 00 00 02 00 D0 04 8A 77 */
1358	samr_vcbuf_t lm_password;		/* 00 00 00 00 00 00 00 00 */
1359	samr_vcbuf_t nt_password;		/* 00 00 00 00 00 00 00 00 */
1360	samr_vcbuf_t unknown3;			/* 00 00 00 00 00 00 00 00 */
1361
1362	struct samr_sd sd;			/* 00 00 00 00 00 00 00 00 */
1363	DWORD user_rid;				/* 00 00 00 00 */
1364	DWORD group_rid;			/* 01 02 00 00 */
1365	DWORD acct_info;			/* 80 00 00 00 */
1366	DWORD flags;				/* FA 27 F8 09 */
1367	struct samr_logon_info logon_info;  /* A8 00 00 00 70 F1 14 00->0xFF */
1368	/*
1369	 * The following 12 bytes are encoded in Ethereal as:
1370	 *
1371	 *	WORD bad_pwd_count;
1372	 *	WORD logon_count;
1373	 *
1374	 *	WORD country;			(default 0)
1375	 *	WORD codepage;
1376	 *
1377	 *	BYTE nt_pwd_set;
1378	 *	BYTE lm_pwd_set;
1379	 *	BYTE expired_flag;
1380	 *	BYTE unknown_char;
1381	 */
1382	DWORD unknown4_zero;			/* 00 00 00 00 */
1383	DWORD unknown5_zero;			/* 00 00 00 00 */
1384	DWORD unknown6_zero;			/* 00 00 00 00 */
1385	BYTE password[SAMR_SET_USER_DATA_SZ];
1386};
1387
1388
1389union samr_SetUserInfo_u {
1390	UNION_INFO_ENT(23,samr_SetUserInfo);
1391	DEFAULT	char *nullptr;
1392};
1393
1394
1395struct samr_SetUserInfo_s {
1396	WORD index;
1397	WORD switch_value;
1398  SWITCH(switch_value)
1399	union samr_SetUserInfo_u ru;
1400};
1401
1402
1403/*
1404	IN	DWORD unknown_04EC;
1405	IN	DWORD unknown_zero;
1406	IN	DWORD logon_bitmap_size;
1407	IN	BYTE logon_bitmap[SAMR_SET_USER_HOURS_SZ];
1408*/
1409OPERATION(SAMR_OPNUM_SetUserInfo)
1410struct samr_SetUserInfo {
1411	IN	samr_handle_t user_handle;
1412	IN	struct samr_SetUserInfo_s info;
1413	IN	struct samr_logon_hours logon_hours;
1414	OUT	DWORD status;
1415};
1416
1417
1418/*
1419 ***********************************************************************
1420 * The SAMR interface definition.
1421 ***********************************************************************
1422 */
1423INTERFACE(0)
1424union samr_interface {
1425	CASE(SAMR_OPNUM_Connect)
1426		struct samr_Connect		Connect;
1427	CASE(SAMR_OPNUM_CloseHandle)
1428		struct samr_CloseHandle		CloseHandle;
1429	CASE(SAMR_OPNUM_LookupDomain)
1430		struct samr_LookupDomain	LookupDomain;
1431	CASE(SAMR_OPNUM_EnumLocalDomains)
1432		struct samr_EnumLocalDomain	EnumLocalDomain;
1433	CASE(SAMR_OPNUM_OpenDomain)
1434		struct samr_OpenDomain		OpenDomain;
1435	CASE(SAMR_OPNUM_QueryDomainInfo)
1436		struct samr_QueryDomainInfo	QueryDomainInfo;
1437	CASE(SAMR_OPNUM_QueryInfoDomain2)
1438		struct samr_QueryInfoDomain2	QueryInfoDomain2;
1439	CASE(SAMR_OPNUM_LookupNames)
1440		struct samr_LookupNames		LookupNames;
1441	CASE(SAMR_OPNUM_OpenUser)
1442		struct samr_OpenUser		OpenUser;
1443	CASE(SAMR_OPNUM_DeleteUser)
1444		struct samr_DeleteUser		DeleteUser;
1445	CASE(SAMR_OPNUM_QueryUserInfo)
1446		struct samr_QueryUserInfo	QueryUserInfo;
1447	CASE(SAMR_OPNUM_QueryUserGroups)
1448		struct samr_QueryUserGroups	QueryUserGroups;
1449	CASE(SAMR_OPNUM_OpenGroup)
1450		struct samr_OpenGroup		OpenGroup;
1451	CASE(SAMR_OPNUM_AddAliasMember)
1452		struct samr_AddAliasMember	AddAliasMember;
1453	CASE(SAMR_OPNUM_DeleteAliasMember)
1454		struct samr_DeleteAliasMember	DeleteAliasMember;
1455	CASE(SAMR_OPNUM_ListAliasMembers)
1456		struct samr_ListAliasMembers	ListAliasMembers;
1457	CASE(SAMR_OPNUM_GetUserPwInfo)
1458		struct samr_GetUserPwInfo	GetUserPwInfo;
1459	CASE(SAMR_OPNUM_CreateUser)
1460		struct samr_CreateUser		CreateUser;
1461	CASE(SAMR_OPNUM_ChangeUserPasswd)
1462		struct samr_ChangeUserPasswd	ChangeUserPasswd;
1463	CASE(SAMR_OPNUM_GetDomainPwInfo)
1464		struct samr_GetDomainPwInfo	GetDomainPwInfo;
1465	CASE(SAMR_OPNUM_Connect2)
1466		struct samr_Connect2		Connect2;
1467	CASE(SAMR_OPNUM_SetUserInfo)
1468		struct samr_SetUserInfo		SetUserInfo;
1469	CASE(SAMR_OPNUM_Connect4)
1470		struct samr_Connect4		Connect4;
1471	CASE(SAMR_OPNUM_Connect5)
1472		struct samr_Connect5		Connect5;
1473	CASE(SAMR_OPNUM_QueryDispInfo)
1474		struct samr_QueryDispInfo	QueryDispInfo;
1475	CASE(SAMR_OPNUM_OpenAlias)
1476		struct samr_OpenAlias		OpenAlias;
1477	CASE(SAMR_OPNUM_CreateDomainAlias)
1478		struct samr_CreateDomainAlias	CreateDomainAlias;
1479	CASE(SAMR_OPNUM_SetAliasInfo)
1480		struct samr_SetAliasInfo	SetAliasInfo;
1481	CASE(SAMR_OPNUM_QueryAliasInfo)
1482		struct samr_QueryAliasInfo	QueryAliasInfo;
1483	CASE(SAMR_OPNUM_DeleteDomainAlias)
1484		struct samr_DeleteDomainAlias	DeleteDomainAlias;
1485	CASE(SAMR_OPNUM_EnumDomainAliases)
1486		struct samr_EnumDomainAliases	EnumDomainAliases;
1487	CASE(SAMR_OPNUM_EnumDomainGroups)
1488		struct samr_EnumDomainGroups	EnumDomainGroups;
1489};
1490typedef union samr_interface	samr_interface_t;
1491EXTERNTYPEINFO(samr_interface)
1492
1493#endif /* _MLSVC_SAM_NDL_ */
1494