xref: /titanic_41/usr/src/uts/common/smbsrv/ndl/lsarpc.ndl (revision 16dd44c265271a75647fb0bb41109bb7c585a526)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _MLSVC_LSA_NDL_
27#define _MLSVC_LSA_NDL_
28
29/*
30 ***********************************************************************
31 * Local Security Authority RPC (LSARPC) interface definition.
32 ***********************************************************************
33 */
34
35#include "ndrtypes.ndl"
36
37
38#define	LSARPC_OPNUM_CloseHandle			0x00
39#define	LSARPC_OPNUM_Delete				0x01
40#define	LSARPC_OPNUM_EnumPrivileges			0x02
41#define	LSARPC_OPNUM_QuerySecurityObject		0x03
42#define	LSARPC_OPNUM_SetSecurityObject			0x04
43#define	LSARPC_OPNUM_ChangePassword			0x05
44#define	LSARPC_OPNUM_OpenPolicy				0x06
45#define	LSARPC_OPNUM_QueryInfoPolicy			0x07
46#define	LSARPC_OPNUM_SetInfoPolicy			0x08
47#define	LSARPC_OPNUM_ClearAuditLog			0x09
48#define	LSARPC_OPNUM_CreateAccount			0x0a
49#define	LSARPC_OPNUM_EnumerateAccounts			0x0b
50#define	LSARPC_OPNUM_CreateTrustedDomain		0x0c
51#define	LSARPC_OPNUM_EnumTrustedDomain			0x0d
52#define	LSARPC_OPNUM_LookupNames			0x0e
53#define	LSARPC_OPNUM_LookupSids				0x0f
54#define	LSARPC_OPNUM_CreateSecret			0x10
55#define	LSARPC_OPNUM_OpenAccount			0x11
56#define	LSARPC_OPNUM_EnumPrivsAccount			0x12
57#define	LSARPC_OPNUM_AddAccountPrivs			0x13
58#define	LSARPC_OPNUM_RemoveAccountPrivs			0x14
59#define	LSARPC_OPNUM_GetAccountQuota			0x15
60#define	LSARPC_OPNUM_SetAccountQuota			0x16
61#define	LSARPC_OPNUM_GetSystemAccessAccount		0x17
62#define	LSARPC_OPNUM_SetSystemAccessAccount		0x18
63#define	LSARPC_OPNUM_OpenTrustedDomain			0x19
64#define	LSARPC_OPNUM_QueryInfoTrustedDomain		0x1a
65#define	LSARPC_OPNUM_SetinfoTrustedDomain		0x1b
66#define	LSARPC_OPNUM_OpenSecret				0x1c
67#define	LSARPC_OPNUM_SetSecret				0x1d
68#define	LSARPC_OPNUM_QuerySecret			0x1e
69#define	LSARPC_OPNUM_LookupPrivValue			0x1f
70#define	LSARPC_OPNUM_LookupPrivName			0x20
71#define	LSARPC_OPNUM_LookupPrivDisplayName		0x21
72#define	LSARPC_OPNUM_DeleteObject			0x22
73#define	LSARPC_OPNUM_EnumAccountsWithUserRight		0x23
74#define	LSARPC_OPNUM_EnumAccountRights			0x24
75#define	LSARPC_OPNUM_AddAccountRights			0x25
76#define	LSARPC_OPNUM_RemoveAccountRights		0x26
77#define	LSARPC_OPNUM_QueryTrustedDomainInfo		0x27
78#define	LSARPC_OPNUM_SetTrustedDomainInfo		0x28
79
80/* Windows 2000 */
81#define	LSARPC_OPNUM_DeleteTrustedDomain		0x29
82#define	LSARPC_OPNUM_StorePrivateData			0x2a
83#define	LSARPC_OPNUM_RetrievePrivateData		0x2b
84#define	LSARPC_OPNUM_OpenPolicy2			0x2c
85#define	LSARPC_OPNUM_GetConnectedUser			0x2d
86#define	LSARPC_OPNUM_QueryInfoPolicy2			0x2e
87#define	LSARPC_OPNUM_SetInfoPolicy2			0x2f
88#define	LSARPC_OPNUM_QueryTrustedDomainInfoByName	0x30
89#define	LSARPC_OPNUM_SetTrustedDomainInfoByName		0x31
90#define	LSARPC_OPNUM_EnumTrustedDomainsEx		0x32
91#define	LSARPC_OPNUM_CreateTrustedDomainEx		0x33
92#define	LSARPC_OPNUM_CloseTrustedDomainEx		0x34
93#define	LSARPC_OPNUM_QueryDomainInfoPolicy		0x35
94#define	LSARPC_OPNUM_SetDomainInfoPolicy		0x36
95#define	LSARPC_OPNUM_OpenTrustedDomainByName		0x37
96#define	LSARPC_OPNUM_TestCall				0x38
97#define	LSARPC_OPNUM_LookupSids2			0x39
98#define	LSARPC_OPNUM_LookupNames2			0x3a
99#define	LSARPC_OPNUM_CreateTrustedDomainEx2		0x3b
100
101/* Windows 2000 SP3 */
102#define	LSARPC_OPNUM_CredWrite				0x3c
103#define	LSARPC_OPNUM_CredRead				0x3d
104#define	LSARPC_OPNUM_CredEnumerate			0x3e
105#define	LSARPC_OPNUM_CredWriteDomainCreds		0x3f
106#define	LSARPC_OPNUM_CredReadDomainCreds		0x40
107#define	LSARPC_OPNUM_CredDelete				0x41
108#define	LSARPC_OPNUM_CredGetTargetInfo			0x42
109#define	LSARPC_OPNUM_CredProfileLoaded			0x43
110#define	LSARPC_OPNUM_LookupNames3			0x44
111#define	LSARPC_OPNUM_CredGetSessionTypes		0x45
112#define	LSARPC_OPNUM_RegisterAuditEvent			0x46
113#define	LSARPC_OPNUM_GenAuditEvent			0x47
114#define	LSARPC_OPNUM_UnregisterAuditEvent		0x48
115#define	LSARPC_OPNUM_QueryForestTrustInfo		0x49
116#define	LSARPC_OPNUM_SetForestTrustInfo			0x4a
117#define	LSARPC_OPNUM_CredRename				0x4b
118#define	LSARPC_OPNUM_LookupSids3			0x4c
119#define	LSARPC_OPNUM_LookupNames4			0x4d
120#define	LSARPC_OPNUM_OpenPolicySce			0x4e
121
122/* Windows Server 2003 */
123#define	LSARPC_OPNUM_AdtRegisterSecurityEventSource	0x4f
124#define	LSARPC_OPNUM_AdtUnregisterSecurityEventSource	0x50
125#define	LSARPC_OPNUM_AdtReportSecurityEvent		0x51
126
127/* Windows Vista */
128#define	LSARPC_OPNUM_CredFindBestCredential		0x52
129#define	LSARPC_OPNUM_SetAuditPolicy			0x53
130#define	LSARPC_OPNUM_QueryAuditPolicy			0x54
131#define	LSARPC_OPNUM_EnumerateAuditPolicy		0x55
132#define	LSARPC_OPNUM_EnumerateAuditCategories		0x56
133#define	LSARPC_OPNUM_EnumerateAuditSubCategories	0x57
134#define	LSARPC_OPNUM_LookupAuditCategoryName		0x58
135#define	LSARPC_OPNUM_LookupAuditSubCategoryName		0x59
136#define	LSARPC_OPNUM_SetAuditSecurity			0x5a
137#define	LSARPC_OPNUM_QueryAuditSecurity			0x5b
138#define	LSARPC_OPNUM_CredReadByTokenHandle		0x5c
139#define	LSARPC_OPNUM_CredRestoreCredentials		0x5d
140#define	LSARPC_OPNUM_CredBackupCredentials		0x5e
141
142/*
143 * There are at least two lookup level settings. Level 1 appears to mean
144 * only look on the local host and level 2 means forward the request to
145 * the PDC. On the PDC it probably doesn't matter which level you use but
146 * on a BDC a level 1 lookup will fail if the BDC doesn't have the info
147 * whereas a level 2 lookup will also check with the PDC.
148 */
149#define MSLSA_LOOKUP_LEVEL_1		1
150#define MSLSA_LOOKUP_LEVEL_2		2
151
152
153/*
154 * Definition for a SID. The ndl compiler won't allow a typedef of
155 * a structure containing variable size members.
156 */
157struct mslsa_sid {
158	BYTE		Revision;
159	BYTE		SubAuthCount;
160	BYTE		Authority[6];
161  SIZE_IS(SubAuthCount)
162	DWORD		SubAuthority[ANY_SIZE_ARRAY];
163};
164
165struct mslsa_string_desc {
166	WORD		length;
167	WORD		allosize;
168	LPTSTR		str;
169};
170typedef struct mslsa_string_desc mslsa_string_t;
171
172CONTEXT_HANDLE(mslsa_handle) mslsa_handle_t;
173
174struct mslsa_luid {
175	DWORD low_part;
176	DWORD high_part;
177};
178typedef struct mslsa_luid mslsa_luid_t;
179
180struct mslsa_guid {
181	DWORD	data1;
182	WORD	data2;
183	WORD	data3;
184	BYTE	data4[8];
185};
186typedef struct mslsa_guid mslsa_guid_t;
187
188/*
189 ***********************************************************************
190 * OpenPolicy2 obtains a handle for a remote LSA. This handle is
191 * required for all subsequent LSA requests.
192 *
193 * The server name should be the name of the target PDC or BDC, with
194 * the double backslash prefix.
195 *
196 * As far as I can tell, the mslsa_object_attributes structure can be
197 * all zero except for the length, which should be set to sizeof(struct
198 * mslsa_object_attributes).
199 *
200 * For read access, the desired access mask should contain the
201 * READ_CONTROL standard right and whatever policy rights are required.
202 * I haven't tried any update operations but if you get the access mask
203 * wrong you can crash the domain controller.
204 ***********************************************************************
205 */
206
207
208/*
209 * From netmon:
210 *	length = 12
211 *	impersonation_level = 2
212 *	context_tracking_mode = 1
213 *	effective_only = 0
214 */
215struct mslsa_quality_of_service {
216	DWORD length;
217	WORD impersonation_level;
218	BYTE context_tracking_mode;
219	BYTE effective_only;
220};
221
222
223struct mslsa_object_attributes {
224	DWORD length;
225	DWORD rootDirectory;
226	DWORD objectName;
227	DWORD attributes;
228	DWORD securityDescriptor;
229	struct mslsa_quality_of_service *qualityOfService;
230};
231
232
233OPERATION(LSARPC_OPNUM_OpenPolicy)
234struct mslsa_OpenPolicy {
235	IN	DWORD	*servername;
236	IN	struct mslsa_object_attributes attributes;
237	IN	DWORD desiredAccess;
238	OUT	mslsa_handle_t domain_handle;
239	OUT	DWORD status;
240};
241
242OPERATION(LSARPC_OPNUM_OpenPolicy2)
243struct mslsa_OpenPolicy2 {
244	IN	LPTSTR servername;
245	IN	struct mslsa_object_attributes attributes;
246	IN	DWORD desiredAccess;
247	OUT	mslsa_handle_t domain_handle;
248	OUT	DWORD status;
249};
250
251
252/*
253 ***********************************************************************
254 * CloseHandle closes an association with the LSA. The returned handle
255 * will be all zero.
256 ***********************************************************************
257 */
258OPERATION(LSARPC_OPNUM_CloseHandle)
259struct mslsa_CloseHandle {
260	IN	mslsa_handle_t handle;
261	OUT	mslsa_handle_t result_handle;
262	OUT	DWORD status;
263};
264
265
266/*
267 ***********************************************************************
268 * EnumPrivileges
269 *
270 * Obtain a list of privilege names. This interface is not implemented
271 * yet The definition below has not been tested. This is a guess based
272 * on data available from netmon.
273 ***********************************************************************
274 */
275struct mslsa_PrivDef {
276	mslsa_string_t name;
277	mslsa_luid_t luid;
278};
279
280
281struct mslsa_PrivEnumBuf {
282	DWORD entries_read;
283  SIZE_IS(entries_read)
284	struct mslsa_PrivDef *def;
285};
286
287
288OPERATION(LSARPC_OPNUM_EnumPrivileges)
289struct mslsa_EnumPrivileges {
290	IN	mslsa_handle_t handle;
291	INOUT	DWORD enum_context;
292	IN	DWORD max_length;
293	OUT	REFERENCE struct mslsa_PrivEnumBuf *enum_buf;
294	OUT	DWORD status;
295};
296
297
298/*
299 ***********************************************************************
300 * QuerySecurityObject. I'm not entirely sure how to set this up yet.
301 * I used the discovery RPC to scope it out. The structures are set up
302 * according to netmon and the assumption that a security descriptor
303 * on the wire looks like the regular user level security descriptor.
304 ***********************************************************************
305 */
306struct mslsa_SecurityDescriptor {
307	BYTE revision;
308	BYTE sbz1;
309	WORD control;
310	DWORD owner;
311	DWORD group;
312	DWORD sacl;
313	DWORD dacl;
314};
315
316
317struct mslsa_SecurityDescInfo {
318	DWORD length;
319  SIZE_IS(length)
320  	BYTE *desc; /* temporary */
321	/* struct mslsa_SecurityDescriptor *desc; */
322};
323
324
325OPERATION(LSARPC_OPNUM_QuerySecurityObject)
326struct mslsa_QuerySecurityObject {
327	IN	mslsa_handle_t handle;
328	IN	DWORD security_info;
329	OUT	struct mslsa_SecurityDescInfo *desc_info;
330	OUT	DWORD status;
331};
332
333
334/*
335 ***********************************************************************
336 * EnumerateAccounts and EnumerateTrustedDomain.
337 ***********************************************************************
338 */
339struct mslsa_AccountInfo {
340	struct mslsa_sid *sid;
341};
342
343
344struct mslsa_EnumAccountBuf {
345	DWORD entries_read;
346  SIZE_IS(entries_read)
347	struct mslsa_AccountInfo *info;
348};
349
350
351OPERATION(LSARPC_OPNUM_EnumerateAccounts)
352struct mslsa_EnumerateAccounts {
353	IN	mslsa_handle_t handle;
354	INOUT	DWORD enum_context;
355	IN	DWORD max_length;
356	OUT	REFERENCE struct mslsa_EnumAccountBuf *enum_buf;
357	OUT	DWORD status;
358};
359
360
361struct mslsa_TrustedDomainInfo {
362	mslsa_string_t name;
363	struct mslsa_sid *sid;
364};
365
366
367struct mslsa_EnumTrustedDomainBuf {
368	DWORD entries_read;
369  SIZE_IS(entries_read)
370	struct mslsa_TrustedDomainInfo *info;
371};
372
373
374OPERATION(LSARPC_OPNUM_EnumTrustedDomain)
375struct mslsa_EnumTrustedDomain {
376	IN	mslsa_handle_t handle;
377	INOUT	DWORD enum_context;
378	IN	DWORD max_length;
379	OUT REFERENCE	struct mslsa_EnumTrustedDomainBuf *enum_buf;
380	OUT	DWORD status;
381};
382
383
384/*
385 ***********************************************************************
386 * Definitions common to both LookupSids and LookupNames. Both return
387 * an mslsa_domain_table[]. Each interface also returns a specific
388 * table with entries which index the mslsa_domain_table[].
389 ***********************************************************************
390 */
391struct mslsa_domain_entry {
392	mslsa_string_t domain_name;
393	struct mslsa_sid *domain_sid;
394};
395typedef struct mslsa_domain_entry mslsa_domain_entry_t;
396
397
398struct mslsa_domain_table {
399	DWORD		n_entry;
400  SIZE_IS(n_entry)
401  	mslsa_domain_entry_t *entries;
402	DWORD		max_n_entry;
403};
404
405
406/*
407 ***********************************************************************
408 * Definitions for LookupSids.
409 *
410 * The input parameters are:
411 *
412 *	A valid LSA handle obtained from an LsarOpenPolicy.
413 *	The table of SIDs to be looked up.
414 *	A table of names (probably empty).
415 *	The lookup level (local=1 or PDC=2).
416 *	An enumeration counter (used for continuation operations).
417 *
418 * The output results are:
419 *
420 *	A table of referenced domains.
421 *	A table of usernames.
422 *	The updated value of the enumeration counter.
423 *	The result status.
424 ***********************************************************************
425 */
426
427struct mslsa_lup_sid_entry {
428	struct mslsa_sid *psid;
429};
430
431struct mslsa_lup_sid_table {
432	DWORD		n_entry;
433    SIZE_IS(n_entry)
434	struct mslsa_lup_sid_entry *entries;
435};
436
437struct mslsa_name_entry {
438	WORD		sid_name_use;
439	WORD		unknown_flags;
440	mslsa_string_t	name;
441	DWORD		domain_ix;		/* -1 means none */
442};
443
444struct mslsa_name_table {
445	DWORD		n_entry;
446    SIZE_IS(n_entry)
447	struct mslsa_name_entry *entries;
448};
449
450OPERATION(LSARPC_OPNUM_LookupSids)
451struct mslsa_LookupSids {
452	IN	mslsa_handle_t	handle;
453	IN	struct mslsa_lup_sid_table lup_sid_table;
454
455	OUT	struct mslsa_domain_table *domain_table;
456	INOUT	struct mslsa_name_table name_table;
457
458	IN	DWORD lookup_level;
459	INOUT	DWORD mapped_count;
460 	OUT	DWORD status;
461};
462
463OPERATION(LSARPC_OPNUM_CreateSecret)
464struct mslsa_CreateSecret {
465	IN	mslsa_handle_t handle;
466	IN	mslsa_string_t name;
467	IN	DWORD access_mask;
468	OUT	mslsa_handle_t secret_handle;
469	OUT	DWORD status;
470};
471
472/*
473 ***********************************************************************
474 * Definitions for LookupNames.
475 *
476 * LookupNames requires the following input parameters.
477 *
478 *	A valid LSA handle obtained from an LsarOpenPolicy.
479 *	The table of names to be looked up.
480 *	A table of translated sids (probably empty).
481 *	The lookup level (local=1 or PDC=2).
482 *	An enumeration counter (used for continuation operations).
483 *
484 * The outputs are as follows.
485 *
486 *	A table of referenced domains.
487 *	A table of translated sids (actually rids).
488 *	The updated value of the enumeration counter.
489 *	The result status.
490 ***********************************************************************
491 */
492struct mslsa_lup_name_table {
493	DWORD n_entry;
494  SIZE_IS(n_entry)
495	mslsa_string_t names[ANY_SIZE_ARRAY];
496};
497
498
499struct mslsa_rid_entry {
500	WORD sid_name_use;
501	WORD pad;	 /* alignment - probably not required */
502	DWORD rid;
503	DWORD domain_index;
504};
505
506
507struct mslsa_rid_table {
508	DWORD n_entry;
509  SIZE_IS(n_entry)
510	struct mslsa_rid_entry *rids;
511};
512
513
514OPERATION(LSARPC_OPNUM_LookupNames)
515struct mslsa_LookupNames {
516	IN		mslsa_handle_t handle;
517	IN	REFERENCE	struct mslsa_lup_name_table *name_table;
518
519	OUT		struct mslsa_domain_table *domain_table;
520	INOUT	struct mslsa_rid_table translated_sids;
521
522	IN		DWORD lookup_level;
523	INOUT	DWORD mapped_count;
524	OUT		DWORD status;
525};
526
527
528/*
529 ***********************************************************************
530 * QueryInfoPolicy returns various pieces of policy information. The
531 * desired information is specified using a class value, as defined
532 * below.
533 ***********************************************************************
534 */
535#define MSLSA_POLICY_AUDIT_LOG_INFO		1
536#define MSLSA_POLICY_AUDIT_EVENTS_INFO		2
537#define MSLSA_POLICY_PRIMARY_DOMAIN_INFO	3
538#define MSLSA_POLICY_UNKNOWN_4_INFO		4
539#define MSLSA_POLICY_ACCOUNT_DOMAIN_INFO	5
540#define MSLSA_POLICY_SERVER_ROLE_INFO		6
541#define MSLSA_POLICY_REPLICA_SOURCE_INFO	7
542#define MSLSA_POLICY_DEFAULT_QUOTA_INFO		8
543#define MSLSA_POLICY_DB_INFO			9
544#define MSLSA_POLICY_AUDIT_SET_INFO		10
545#define MSLSA_POLICY_AUDIT_QUERY_INFO		11
546#define MSLSA_POLICY_DNS_DOMAIN_INFO		12
547
548#define	LSA_ROLE_STANDALONE_WORKSTATION		0
549#define	LSA_ROLE_MEMBER_WORKSTATION		1
550#define	LSA_ROLE_STANDALONE_SERVER		2
551#define	LSA_ROLE_MEMBER_SERVER			3
552#define	LSA_ROLE_BACKUP_DC			4
553#define	LSA_ROLE_PRIMARY_DC			5
554
555/*
556 * MSLSA_POLICY_AUDIT_EVENTS_INFO
557 */
558struct mslsa_AuditEventsInfo {
559	DWORD enabled;
560    SIZE_IS (count)
561	DWORD *settings;
562	DWORD count;
563};
564
565/*
566 * MSLSA_POLICY_PRIMARY_DOMAIN_INFO
567 */
568struct mslsa_PrimaryDomainInfo {
569	struct mslsa_string_desc name;
570	struct mslsa_sid *sid;
571};
572
573/*
574 * MSLSA_POLICY_ACCOUNT_DOMAIN_INFO
575 */
576struct mslsa_AccountDomainInfo {
577	struct mslsa_string_desc name;
578	struct mslsa_sid *sid;
579};
580
581/*
582 * MSLSA_POLICY_SERVER_ROLE_INFO
583 */
584struct mslsa_ServerRoleInfo {
585	DWORD role;
586	DWORD pad;
587};
588
589struct mslsa_DnsDomainInfo {
590	struct mslsa_string_desc nb_domain;
591	struct mslsa_string_desc dns_domain;
592	struct mslsa_string_desc forest;
593	struct mslsa_guid guid;
594	struct mslsa_sid *sid;
595};
596
597union mslsa_PolicyInfoResUnion {
598	CASE(2) struct mslsa_AuditEventsInfo audit_events;
599	CASE(3) struct mslsa_PrimaryDomainInfo pd_info;
600	CASE(5) struct mslsa_AccountDomainInfo ad_info;
601	CASE(6) struct mslsa_ServerRoleInfo server_role;
602	CASE(12) struct mslsa_DnsDomainInfo dns_info;
603	DEFAULT	char *nullptr;
604};
605
606/*
607 * This structure needs to be declared, even though it can't be used in
608 * mslsa_QueryInfoPolicy, in order to get the appropriate size to calculate
609 * the correct fixup offsets.  If ndrgen did the right thing,
610 * mslsa_PolicyInfoRes would be one of the out parameters.  However, if
611 * we do it that way, the switch_value isn't known early enough to do
612 * the fixup calculation.  So it all has to go in mslsa_QueryInfoPolicy.
613 */
614struct mslsa_PolicyInfoRes {
615	DWORD address;
616	WORD switch_value;
617    SWITCH(switch_value)
618	union mslsa_PolicyInfoResUnion ru;
619};
620
621OPERATION(LSARPC_OPNUM_QueryInfoPolicy)
622struct mslsa_QueryInfoPolicy {
623	IN	mslsa_handle_t handle;
624	IN	WORD info_class;
625	/*
626	 * Can't use this form because we need to include members explicitly.
627	 * OUT	struct mslsa_PolicyInfoRes result;
628	 */
629	OUT	DWORD address;
630	OUT	WORD switch_value;
631    SWITCH(switch_value)
632	OUT	union mslsa_PolicyInfoResUnion ru;
633	OUT	DWORD status;
634};
635
636
637
638/*
639 ***********************************************************************
640 * OpenAccount.
641 *
642 * Returns a handle that can be used to access the account specified
643 * by a SID. This handle can be used to enumerate account privileges.
644 ***********************************************************************
645 */
646OPERATION(LSARPC_OPNUM_OpenAccount)
647struct mslsa_OpenAccount {
648	IN  mslsa_handle_t handle;
649	IN REFERENCE	struct mslsa_sid *sid;
650	IN	DWORD access_mask;
651	OUT mslsa_handle_t account_handle;
652	OUT DWORD status;
653};
654
655
656
657 /*
658 ***********************************************************************
659 * EnumPrivilegesAccount.
660 *
661 * Enumerate the list of privileges held by the specified account. The
662 * handle must be a valid account handle obtained via OpenAccount. The
663 * luid values returned will be probably only be relevant on the domain
664 * controller so we'll need to find a way to convert them to the
665 * actual privilege names.
666 ***********************************************************************
667 */
668struct mslsa_LuidAndAttributes {
669	struct mslsa_luid luid;
670	DWORD attributes;
671};
672
673
674struct mslsa_PrivilegeSet {
675	DWORD privilege_count;
676	DWORD control;
677  SIZE_IS(privilege_count)
678	struct mslsa_LuidAndAttributes privilege[ANY_SIZE_ARRAY];
679};
680
681
682OPERATION(LSARPC_OPNUM_EnumPrivsAccount)
683	struct mslsa_EnumPrivsAccount {
684	IN	mslsa_handle_t account_handle;
685	OUT	struct mslsa_PrivilegeSet *privileges;
686	OUT	DWORD status;
687};
688
689OPERATION(LSARPC_OPNUM_OpenSecret)
690struct mslsa_OpenSecret {
691	IN	mslsa_handle_t handle;
692	IN	mslsa_string_t name;
693	IN	DWORD access_mask;
694	OUT	mslsa_handle_t secret_handle;
695	OUT	DWORD status;
696};
697
698
699/*
700 ***********************************************************************
701 * LookupPrivValue
702 *
703 * Map a privilege name to a local unique id (LUID). Privilege names
704 * are consistent across the network. LUIDs are machine specific.
705 * The privilege list is provided as a set of LUIDs so the privilege
706 * lookup functions must be used to identify which the privilege to
707 * which each LUID refers. The handle here is a policy handle.
708 ***********************************************************************
709 */
710OPERATION(LSARPC_OPNUM_LookupPrivValue)
711struct mslsa_LookupPrivValue {
712	IN	mslsa_handle_t handle;
713	IN	mslsa_string_t name;
714	OUT	struct mslsa_luid luid;
715	OUT	DWORD status;
716};
717
718
719/*
720 ***********************************************************************
721 * LookupPrivName
722 *
723 * Map a privilege value (LUID) to a privilege name. Privilege names
724 * are consistent across the network. LUIDs are machine specific.
725 * The privilege list is provided as a set of LUIDs so the privilege
726 * lookup functions must be used to identify which the privilege to
727 * which each LUID refers. The handle here is a policy handle.
728 ***********************************************************************
729 */
730OPERATION(LSARPC_OPNUM_LookupPrivName)
731struct mslsa_LookupPrivName {
732	IN	mslsa_handle_t handle;
733	IN	struct mslsa_luid luid;
734	OUT	mslsa_string_t *name;
735	OUT	DWORD status;
736};
737
738
739/*
740 ***********************************************************************
741 * LookupPrivDisplayName
742 *
743 * Map a privilege name to a local unique id (LUID). Privilege names
744 * are consistent across the network. LUIDs are machine specific.
745 * The privilege list is provided as a set of LUIDs so the privilege
746 * lookup functions must be used to identify which the privilege to
747 * which each LUID refers. The handle here is a policy handle.
748 ***********************************************************************
749 */
750OPERATION(LSARPC_OPNUM_LookupPrivDisplayName)
751struct mslsa_LookupPrivDisplayName {
752	IN	mslsa_handle_t handle;
753	IN	mslsa_string_t name;
754	IN	WORD client_language;
755	IN	WORD default_language;
756	OUT	mslsa_string_t *display_name;
757	OUT	WORD language_ret;
758	OUT	DWORD status;
759};
760
761
762/*
763 ***********************************************************************
764 * GetConnectedUser
765 *
766 * This is still guesswork. Netmon doesn't know about this
767 * call and I'm not really sure what it is intended to achieve.
768 * Another packet capture application, Ethereal, calls this RPC as
769 * GetConnectedUser.
770 * We will receive our own hostname in the request and it appears
771 * we should respond with an account name and the domain name of connected
772 * user from the client that makes this call.
773 ***********************************************************************
774 */
775
776struct mslsa_DomainName {
777	struct mslsa_string_desc *name;
778};
779
780
781OPERATION(LSARPC_OPNUM_GetConnectedUser)
782struct mslsa_GetConnectedUser {
783	IN	LPTSTR hostname;
784	IN  BYTE *unknown1;
785	IN  BYTE *unknown2;
786	OUT	struct mslsa_string_desc *owner;
787	OUT	struct mslsa_DomainName *domain;
788	OUT	DWORD status;
789};
790
791
792/*
793 ***********************************************************************
794 * LSARPC_OPNUM_LookupSids2
795 *
796 * SID lookup function that appeared in Windows 2000. It appears to be
797 * very similar to the original SID lookup RPC. There are two extra IN
798 * parameters, which we don't care about. The OUT name structure has
799 * an extra field, in which zero seems to be okay.
800 ***********************************************************************
801 */
802struct lsar_name_entry2 {
803	WORD sid_name_use;
804	WORD unknown_flags;	/* maybe alignment */
805	mslsa_string_t name;
806	DWORD domain_ix;	/* -1 means none */
807	DWORD unknown;		/* added */
808};
809
810
811struct lsar_name_table2 {
812	DWORD n_entry;
813  SIZE_IS(n_entry)
814	struct lsar_name_entry2 *entries;
815};
816
817
818OPERATION(LSARPC_OPNUM_LookupSids2)
819struct lsar_lookup_sids2 {
820	IN		mslsa_handle_t policy_handle;
821	IN		struct mslsa_lup_sid_table lup_sid_table;
822	OUT		struct mslsa_domain_table *domain_table;
823	INOUT	struct lsar_name_table2 name_table;
824	IN		DWORD lookup_level;
825	INOUT	DWORD mapped_count;
826	IN		DWORD zero;
827	IN		DWORD requested_count;
828 	OUT		DWORD status;
829};
830
831
832/*
833 ***********************************************************************
834 * LSARPC_OPNUM_LookupNames2
835 *
836 * Name lookup function that appeared in Windows 2000. It appears to be
837 * very similar to the original name lookup RPC. There are two extra IN
838 * parameters, which we don't care about. The lsar_rid_entry2 structure
839 * has an extra field, in which zero seems to be okay.
840 ***********************************************************************
841 */
842struct lsar_rid_entry2 {
843	WORD sid_name_use;
844	WORD pad;		/* alignment - probably not required */
845	DWORD rid;
846	DWORD domain_index;	/* -1 means none */
847	DWORD unknown;		/* new */
848};
849
850
851struct lsar_rid_table2 {
852	DWORD n_entry;
853  SIZE_IS(n_entry)
854	struct lsar_rid_entry2 *rids;
855};
856
857
858OPERATION(LSARPC_OPNUM_LookupNames2)
859struct lsar_LookupNames2 {
860	IN		mslsa_handle_t policy_handle;
861	IN	REFERENCE	struct mslsa_lup_name_table *name_table;
862	OUT		struct mslsa_domain_table *domain_table;
863	INOUT	struct lsar_rid_table2 translated_sids;
864	IN		DWORD lookup_level;
865	INOUT	DWORD mapped_count;
866	IN		DWORD unknown_sbz;
867	IN		DWORD unknown_sb2;
868	OUT		DWORD status;
869};
870
871/*
872 ***********************************************************************
873 * The LSARPC interface definition.
874 ***********************************************************************
875 */
876INTERFACE(0)
877union lsarpc_interface {
878	CASE(LSARPC_OPNUM_CloseHandle)
879		struct mslsa_CloseHandle		CloseHandle;
880	CASE(LSARPC_OPNUM_QuerySecurityObject)
881		struct mslsa_QuerySecurityObject	QuerySecurityObj;
882	CASE(LSARPC_OPNUM_EnumerateAccounts)
883		struct mslsa_EnumerateAccounts		EnumAccounts;
884	CASE(LSARPC_OPNUM_EnumTrustedDomain)
885		struct mslsa_EnumTrustedDomain		EnumTrustedDomain;
886	CASE(LSARPC_OPNUM_OpenAccount)
887		struct mslsa_OpenAccount		OpenAccount;
888	CASE(LSARPC_OPNUM_EnumPrivsAccount)
889		struct mslsa_EnumPrivsAccount		EnumPrivsAccount;
890	CASE(LSARPC_OPNUM_LookupPrivValue)
891		struct mslsa_LookupPrivValue		LookupPrivValue;
892	CASE(LSARPC_OPNUM_LookupPrivName)
893		struct mslsa_LookupPrivName		LookupPrivName;
894	CASE(LSARPC_OPNUM_LookupPrivDisplayName)
895		struct mslsa_LookupPrivDisplayName	LookupPrivDisplayName;
896	CASE(LSARPC_OPNUM_CreateSecret)
897		struct mslsa_CreateSecret		CreateSecret;
898	CASE(LSARPC_OPNUM_OpenSecret)
899		struct mslsa_OpenSecret			OpenSecret;
900	CASE(LSARPC_OPNUM_QueryInfoPolicy)
901		struct mslsa_QueryInfoPolicy		QueryInfoPolicy;
902	CASE(LSARPC_OPNUM_OpenPolicy)
903		struct mslsa_OpenPolicy			OpenPolicy;
904	CASE(LSARPC_OPNUM_OpenPolicy2)
905		struct mslsa_OpenPolicy2		OpenPolicy2;
906	CASE(LSARPC_OPNUM_LookupSids)
907		struct mslsa_LookupSids			LookupSids;
908	CASE(LSARPC_OPNUM_LookupNames)
909		struct mslsa_LookupNames		LookupNames;
910	CASE(LSARPC_OPNUM_GetConnectedUser)
911		struct mslsa_GetConnectedUser		GetConnectedUser;
912	CASE(LSARPC_OPNUM_LookupSids2)
913		struct lsar_lookup_sids2		LookupSids2;
914	CASE(LSARPC_OPNUM_LookupNames2)
915		struct lsar_LookupNames2		LookupNames2;
916};
917typedef union lsarpc_interface	lsarpc_interface_t;
918EXTERNTYPEINFO(lsarpc_interface)
919
920#endif /* _MLSVC_LSA_NDL_ */
921