9a6e4a202c42d432e652547f74c4848d436e8a9d
[tprouty/samba.git] / source4 / librpc / idl / lsa.idl
1 #include "idl_types.h"
2
3 /*
4   lsa interface definition
5 */
6
7 import "misc.idl", "security.idl";
8
9 [ uuid("12345778-1234-abcd-ef00-0123456789ab"),
10   version(0.0),
11   endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\netlogon]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
12   pointer_default(unique),
13   helpstring("Local Security Authority")
14 ] interface lsarpc
15 {
16         typedef bitmap security_secinfo security_secinfo;
17         typedef bitmap kerb_EncTypes kerb_EncTypes;
18
19         typedef [public,noejs] struct {
20                 [value(2*strlen_m(string))] uint16 length;
21                 [value(2*strlen_m(string))] uint16 size;
22                 [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
23         } lsa_String;
24
25         typedef [public] struct {
26                 [value(2*strlen_m(string))] uint16 length;
27                 [value(2*strlen_m_term(string))] uint16 size;
28                 [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
29         } lsa_StringLarge;
30
31         typedef [public] struct {
32                 uint32 count;
33                 [size_is(count)] lsa_String *names;
34         } lsa_Strings;
35
36         typedef [public] struct {
37                 [value(strlen_m(string))] uint16 length;
38                 [value(strlen_m(string))] uint16 size;
39                 [charset(DOS),size_is(size),length_is(length)] uint8 *string;
40         } lsa_AsciiString;
41
42         typedef [public] struct {
43                 [value(strlen_m(string))] uint16 length;
44                 [value(strlen_m_term(string))] uint16 size;
45                 [charset(DOS),size_is(size),length_is(length)] uint8 *string;
46         } lsa_AsciiStringLarge;
47
48         /******************/
49         /* Function: 0x00 */
50         NTSTATUS lsa_Close (
51                 [in,out]     policy_handle *handle
52                 );
53         
54
55         /******************/
56         /* Function: 0x01 */
57         [public] NTSTATUS lsa_Delete (
58                 [in]     policy_handle *handle
59                 );
60
61
62         /******************/
63         /* Function: 0x02 */
64         typedef struct {
65                 uint32 low;
66                 uint32 high;
67         } lsa_LUID;
68         
69         typedef struct {
70                 lsa_StringLarge name;
71                 lsa_LUID luid;
72         } lsa_PrivEntry;
73
74         typedef struct {
75                 uint32 count;
76                 [size_is(count)] lsa_PrivEntry *privs;
77         } lsa_PrivArray;
78
79         [public] NTSTATUS lsa_EnumPrivs (
80                 [in]     policy_handle *handle,
81                 [in,out] uint32 *resume_handle,
82                 [in]         uint32 max_count,
83                 [out]    lsa_PrivArray *privs
84                 );
85
86         /******************/
87         /* Function: 0x03 */
88
89         NTSTATUS lsa_QuerySecurity (
90                 [in]     policy_handle *handle,
91                 [in]         security_secinfo sec_info,
92                 [out,unique]        sec_desc_buf *sdbuf
93                 );
94
95
96         /******************/
97         /* Function: 0x04 */
98         NTSTATUS lsa_SetSecObj(
99                 [in]            policy_handle *handle,
100                 [in]            security_secinfo sec_info,
101                 [in,ref]        sec_desc_buf *sdbuf
102                 );
103
104         /******************/
105         /* Function: 0x05 */
106         [todo] NTSTATUS lsa_ChangePassword ();
107
108
109         /******************/
110         /* Function: 0x06 */
111         typedef struct {
112                 uint32  len; /* ignored */
113                 uint16  impersonation_level;
114                 uint8   context_mode;
115                 uint8   effective_only;
116         } lsa_QosInfo;
117         
118         typedef struct {
119                 uint32 len; /* ignored */
120                 uint8 *root_dir;
121                 [string,charset(UTF16)] uint16 *object_name;
122                 uint32 attributes;
123                 security_descriptor *sec_desc;
124                 lsa_QosInfo *sec_qos;
125         } lsa_ObjectAttribute;
126
127         /* notice the screwup with the system_name - thats why MS created
128            OpenPolicy2 */
129         [public] NTSTATUS lsa_OpenPolicy (
130                 [in,unique]       uint16 *system_name,
131                 [in]   lsa_ObjectAttribute *attr,
132                 [in]       uint32 access_mask,
133                 [out]  policy_handle *handle
134                 );
135         
136
137
138         /******************/
139         /* Function: 0x07 */
140
141         typedef struct {
142                 uint32 percent_full;
143                 uint32 log_size;
144                 NTTIME retention_time;
145                 uint8  shutdown_in_progress;
146                 NTTIME time_to_shutdown;
147                 uint32 next_audit_record;
148                 uint32 unknown;
149         } lsa_AuditLogInfo;
150
151         typedef [v1_enum] enum {
152                 LSA_AUDIT_POLICY_NONE=0,
153                 LSA_AUDIT_POLICY_SUCCESS=1,
154                 LSA_AUDIT_POLICY_FAILURE=2,
155                 LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
156                 LSA_AUDIT_POLICY_CLEAR=4
157         } lsa_PolicyAuditPolicy;
158
159         typedef enum {
160                 LSA_AUDIT_CATEGORY_SYSTEM = 0,
161                 LSA_AUDIT_CATEGORY_LOGON = 1,
162                 LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2,
163                 LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3,
164                 LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4,
165                 LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5,
166                 LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6,
167                 LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7,        /* only in win2k/2k3 */
168                 LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8                    /* only in win2k/2k3 */
169         } lsa_PolicyAuditEventType;
170
171         typedef struct {
172                 uint32 auditing_mode;
173                 [size_is(count)] lsa_PolicyAuditPolicy *settings;
174                 uint32 count;
175         } lsa_AuditEventsInfo;
176
177         typedef struct {
178                 lsa_StringLarge name;
179                 dom_sid2 *sid;
180         } lsa_DomainInfo;
181
182         typedef struct {
183                 lsa_String name;
184         } lsa_PDAccountInfo;
185
186         typedef struct {
187                 uint16 unknown; /* an midl padding bug? */
188                 uint16 role;
189         } lsa_ServerRole;
190
191         typedef struct {
192                 lsa_String source;
193                 lsa_String account;
194         } lsa_ReplicaSourceInfo;
195
196         typedef struct {
197                 uint32 paged_pool;
198                 uint32 non_paged_pool;
199                 uint32 min_wss;
200                 uint32 max_wss;
201                 uint32 pagefile;
202                 hyper unknown;
203         } lsa_DefaultQuotaInfo;
204
205         typedef struct {
206                 hyper modified_id;
207                 NTTIME db_create_time;
208         } lsa_ModificationInfo;
209
210         typedef struct {
211                 uint8 shutdown_on_full;
212         } lsa_AuditFullSetInfo;
213
214         typedef struct {
215                 uint16 unknown; /* an midl padding bug? */
216                 uint8 shutdown_on_full;
217                 uint8 log_is_full;
218         } lsa_AuditFullQueryInfo;
219
220         typedef struct {
221                 /* it's important that we use the lsa_StringLarge here,
222                  * because otherwise windows clients result with such dns hostnames
223                  * e.g. w2k3-client.samba4.samba.orgsamba4.samba.org
224                  * where it should be
225                  *      w2k3-client.samba4.samba.org
226                  */
227                 lsa_StringLarge name;
228                 lsa_StringLarge dns_domain;
229                 lsa_StringLarge dns_forest;
230                 GUID domain_guid;
231                 dom_sid2 *sid;
232         } lsa_DnsDomainInfo;
233
234         typedef enum {
235                 LSA_POLICY_INFO_AUDIT_LOG=1,
236                 LSA_POLICY_INFO_AUDIT_EVENTS=2,
237                 LSA_POLICY_INFO_DOMAIN=3,
238                 LSA_POLICY_INFO_PD=4,
239                 LSA_POLICY_INFO_ACCOUNT_DOMAIN=5,
240                 LSA_POLICY_INFO_ROLE=6,
241                 LSA_POLICY_INFO_REPLICA=7,
242                 LSA_POLICY_INFO_QUOTA=8,
243                 LSA_POLICY_INFO_DB=9,
244                 LSA_POLICY_INFO_AUDIT_FULL_SET=10,
245                 LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
246                 LSA_POLICY_INFO_DNS=12
247         } lsa_PolicyInfo;
248
249         typedef [switch_type(uint16)] union {
250                 [case(LSA_POLICY_INFO_AUDIT_LOG)]        lsa_AuditLogInfo       audit_log;
251                 [case(LSA_POLICY_INFO_AUDIT_EVENTS)]     lsa_AuditEventsInfo    audit_events;
252                 [case(LSA_POLICY_INFO_DOMAIN)]           lsa_DomainInfo         domain;
253                 [case(LSA_POLICY_INFO_PD)]               lsa_PDAccountInfo      pd;
254                 [case(LSA_POLICY_INFO_ACCOUNT_DOMAIN)]   lsa_DomainInfo         account_domain;
255                 [case(LSA_POLICY_INFO_ROLE)]             lsa_ServerRole         role;
256                 [case(LSA_POLICY_INFO_REPLICA)]          lsa_ReplicaSourceInfo  replica;
257                 [case(LSA_POLICY_INFO_QUOTA)]            lsa_DefaultQuotaInfo   quota;
258                 [case(LSA_POLICY_INFO_DB)]               lsa_ModificationInfo   db;
259                 [case(LSA_POLICY_INFO_AUDIT_FULL_SET)]   lsa_AuditFullSetInfo   auditfullset;
260                 [case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery;
261                 [case(LSA_POLICY_INFO_DNS)]              lsa_DnsDomainInfo      dns;
262         } lsa_PolicyInformation;
263
264         NTSTATUS lsa_QueryInfoPolicy (
265                 [in]                            policy_handle *handle,
266                 [in]                            lsa_PolicyInfo level,
267                 [out,unique,switch_is(level)]   lsa_PolicyInformation *info
268                 );
269
270         /******************/
271         /* Function:       0x08 */
272         NTSTATUS lsa_SetInfoPolicy (
273                 [in]                            policy_handle *handle,
274                 [in]                            lsa_PolicyInfo level,
275                 [in,switch_is(level)]           lsa_PolicyInformation *info
276                 );
277
278         /******************/
279         /* Function:       0x09 */
280         [todo] NTSTATUS lsa_ClearAuditLog ();
281
282         /******************/
283         /* Function: 0x0a */
284         [public] NTSTATUS lsa_CreateAccount (
285                 [in]    policy_handle *handle,
286                 [in]    dom_sid2 *sid,
287                 [in]    uint32 access_mask,
288                 [out]   policy_handle *acct_handle
289                 );
290
291         /******************/
292         /* NOTE: This only returns accounts that have at least
293            one privilege set 
294         */
295         /* Function: 0x0b */
296         typedef struct {
297                 dom_sid2 *sid;
298         } lsa_SidPtr;
299         
300         typedef [public] struct {
301                 [range(0,1000)] uint32 num_sids;
302                 [size_is(num_sids)] lsa_SidPtr *sids;
303         } lsa_SidArray;
304
305         [public] NTSTATUS lsa_EnumAccounts (
306                 [in]         policy_handle *handle,
307                 [in,out]     uint32 *resume_handle,
308                 [in,range(0,8192)] uint32 num_entries,
309                 [out]        lsa_SidArray *sids
310                 );
311
312
313         /*************************************************/
314         /* Function: 0x0c                                */
315
316         [public] NTSTATUS lsa_CreateTrustedDomain(
317                 [in]         policy_handle *policy_handle,
318                 [in]         lsa_DomainInfo *info,
319                 [in]         uint32 access_mask,
320                 [out]        policy_handle *trustdom_handle
321                 );
322
323
324         /******************/
325         /* Function: 0x0d */
326
327         /* w2k3 treats max_size as max_domains*60       */
328         const int LSA_ENUM_TRUST_DOMAIN_MULTIPLIER = 60;
329
330         typedef struct {
331                 uint32 count;
332                 [size_is(count)] lsa_DomainInfo *domains;
333         } lsa_DomainList;
334
335         NTSTATUS lsa_EnumTrustDom (
336                 [in]               policy_handle *handle,
337                 [in,out]           uint32 *resume_handle,
338                 [in]               uint32 max_size,
339                 [out]              lsa_DomainList *domains
340                 );
341
342
343         /******************/
344         /* Function: 0x0e */
345         typedef [public] enum {
346                 SID_NAME_USE_NONE = 0,/* NOTUSED */
347                 SID_NAME_USER     = 1, /* user */
348                 SID_NAME_DOM_GRP  = 2, /* domain group */
349                 SID_NAME_DOMAIN   = 3, /* domain: don't know what this is */
350                 SID_NAME_ALIAS    = 4, /* local group */
351                 SID_NAME_WKN_GRP  = 5, /* well-known group */
352                 SID_NAME_DELETED  = 6, /* deleted account: needed for c2 rating */
353                 SID_NAME_INVALID  = 7, /* invalid account */
354                 SID_NAME_UNKNOWN  = 8, /* oops. */
355                 SID_NAME_COMPUTER = 9  /* machine */
356         } lsa_SidType;
357
358         typedef struct {
359                 lsa_SidType sid_type;
360                 uint32 rid;
361                 uint32 sid_index;
362         } lsa_TranslatedSid;
363
364         typedef struct {
365                 [range(0,1000)] uint32 count;
366                 [size_is(count)] lsa_TranslatedSid *sids;
367         } lsa_TransSidArray;
368
369         const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32;
370         typedef struct {
371                 [range(0,1000)] uint32 count;
372                 [size_is(count)] lsa_DomainInfo *domains;
373                 uint32 max_size;
374         } lsa_RefDomainList;
375
376         /* Level 1: Ask everywhere
377          * Level 2: Ask domain and trusted domains, no builtin and wkn
378          * Level 3: Only ask domain
379          * Level 4: W2k3ad: Only ask AD trusts
380          * Level 5: Only ask transitive forest trusts
381          * Level 6: Like 4
382          */
383
384         typedef enum {
385                 LSA_LOOKUP_NAMES_ALL = 1,
386                 LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2,
387                 LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3,
388                 LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4,
389                 LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5,
390                 LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6
391         } lsa_LookupNamesLevel;
392
393         [public] NTSTATUS lsa_LookupNames (
394                 [in]         policy_handle *handle,
395                 [in,range(0,1000)] uint32 num_names,
396                 [in,size_is(num_names)]  lsa_String names[],
397                 [out,unique] lsa_RefDomainList *domains,
398                 [in,out]     lsa_TransSidArray *sids,
399                 [in]         lsa_LookupNamesLevel level,
400                 [in,out]     uint32 *count
401                 );
402
403
404         /******************/
405         /* Function: 0x0f */
406
407         typedef struct {
408                 lsa_SidType sid_type;
409                 lsa_String name;
410                 uint32 sid_index;
411         } lsa_TranslatedName;
412
413         typedef struct {
414                 [range(0,1000)] uint32 count;
415                 [size_is(count)] lsa_TranslatedName *names;
416         } lsa_TransNameArray;
417
418         [public] NTSTATUS lsa_LookupSids (
419                 [in]         policy_handle *handle,
420                 [in]         lsa_SidArray *sids,
421                 [out,unique]        lsa_RefDomainList *domains,
422                 [in,out]     lsa_TransNameArray *names,
423                 [in]         uint16 level,
424                 [in,out] uint32 *count
425                 );
426
427
428         /* Function:        0x10 */
429         [public] NTSTATUS lsa_CreateSecret(
430                 [in]         policy_handle *handle,
431                 [in]         lsa_String       name,
432                 [in]         uint32         access_mask,
433                 [out]        policy_handle *sec_handle
434                 );
435
436
437         /*****************************************/
438         /* Function:     0x11                    */
439         NTSTATUS lsa_OpenAccount (
440                 [in]         policy_handle *handle,
441                 [in]         dom_sid2 *sid,
442                 [in]         uint32 access_mask,
443                 [out]        policy_handle *acct_handle
444                 );
445
446
447         /****************************************/
448         /* Function:    0x12                    */
449
450         typedef struct {
451                 lsa_LUID luid;
452                 uint32 attribute;
453         } lsa_LUIDAttribute;
454         
455         typedef struct {
456                 [range(0,1000)] uint32 count;
457                 uint32 unknown;
458                 [size_is(count)] lsa_LUIDAttribute set[*];
459         } lsa_PrivilegeSet;
460         
461         NTSTATUS lsa_EnumPrivsAccount (
462                 [in]         policy_handle *handle,
463                 [out,unique] lsa_PrivilegeSet *privs
464                 );
465
466
467         /****************************************/
468         /* Function:            0x13 */
469         NTSTATUS lsa_AddPrivilegesToAccount(
470                 [in]         policy_handle *handle,
471                 [in]         lsa_PrivilegeSet *privs
472                 );
473         
474
475         /****************************************/
476         /* Function:         0x14 */
477         NTSTATUS lsa_RemovePrivilegesFromAccount(
478                 [in]         policy_handle *handle,
479                 [in]         uint8 remove_all,
480                 [in,unique]  lsa_PrivilegeSet *privs
481                 );
482
483         /* Function:           0x15 */
484         [todo] NTSTATUS lsa_GetQuotasForAccount();
485         
486         /* Function:           0x16 */
487         [todo] NTSTATUS lsa_SetQuotasForAccount();
488         
489         /* Function:    0x17 */
490         NTSTATUS lsa_GetSystemAccessAccount(
491                 [in]    policy_handle *handle,
492                 [out,ref] uint32 *access_mask
493                 );
494
495         /* Function:    0x18 */
496         NTSTATUS lsa_SetSystemAccessAccount(
497                 [in]    policy_handle *handle,
498                 [in]    uint32 access_mask
499                 );
500
501         /* Function:        0x19 */
502         NTSTATUS lsa_OpenTrustedDomain(
503                 [in]     policy_handle *handle,
504                 [in]     dom_sid2      *sid,
505                 [in]         uint32         access_mask,
506                 [out]    policy_handle *trustdom_handle
507                 );
508
509         typedef [flag(NDR_PAHEX)] struct {
510                 uint32 length;
511                 uint32 size;
512                 [size_is(size),length_is(length)] uint8 *data;
513         } lsa_DATA_BUF;
514
515         typedef [flag(NDR_PAHEX)] struct {
516                 [range(0,65536)] uint32 size;
517                 [size_is(size)] uint8 *data;
518         } lsa_DATA_BUF2;
519
520         typedef enum {
521                 LSA_TRUSTED_DOMAIN_INFO_NAME                  = 1,
522                 LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS           = 2,
523                 LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET          = 3,
524                 LSA_TRUSTED_DOMAIN_INFO_PASSWORD              = 4,
525                 LSA_TRUSTED_DOMAIN_INFO_BASIC                 = 5,
526                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX               = 6,
527                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO             = 7,
528                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO             = 8,
529                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL    = 9,
530                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL    = 10,
531                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL     = 11,
532                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL  = 12,
533                 LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES = 13
534         } lsa_TrustDomInfoEnum;
535
536         typedef [public,bitmap32bit] bitmap {
537                 LSA_TRUST_DIRECTION_INBOUND  = 0x00000001,
538                 LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002
539         } lsa_TrustDirection;
540
541         typedef [v1_enum] enum {
542                 LSA_TRUST_TYPE_DOWNLEVEL  = 0x00000001,
543                 LSA_TRUST_TYPE_UPLEVEL    = 0x00000002,
544                 LSA_TRUST_TYPE_MIT        = 0x00000003
545         } lsa_TrustType;
546
547         typedef [public,bitmap32bit] bitmap {
548                 LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE      = 0x00000001,
549                 LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY        = 0x00000002,
550                 LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN  = 0x00000004,
551                 LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE   = 0x00000008,
552                 LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION  = 0x00000010,
553                 LSA_TRUST_ATTRIBUTE_WITHIN_FOREST       = 0x00000020,
554                 LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL   = 0x00000040,
555                 LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080
556         } lsa_TrustAttributes;
557
558         typedef struct {
559                 lsa_StringLarge  netbios_name;
560         } lsa_TrustDomainInfoName;
561
562
563         typedef struct {
564                 uint32 entries;
565                 [size_is(entries)] lsa_StringLarge  *netbios_names;
566         } lsa_TrustDomainInfoControllers;
567
568         typedef struct {
569                 uint32         posix_offset;
570         } lsa_TrustDomainInfoPosixOffset;
571
572         typedef struct {
573                 lsa_DATA_BUF  *password;
574                 lsa_DATA_BUF  *old_password;
575         } lsa_TrustDomainInfoPassword;
576
577         typedef struct {
578                 lsa_String     netbios_name;
579                 dom_sid2      *sid;
580         } lsa_TrustDomainInfoBasic;
581
582         typedef struct {
583                 lsa_StringLarge     domain_name;
584                 lsa_StringLarge     netbios_name;
585                 dom_sid2           *sid;
586                 lsa_TrustDirection  trust_direction;
587                 lsa_TrustType       trust_type;
588                 lsa_TrustAttributes trust_attributes;
589         } lsa_TrustDomainInfoInfoEx;
590
591         typedef [public,v1_enum] enum {
592                 TRUST_AUTH_TYPE_NONE = 0,
593                 TRUST_AUTH_TYPE_NT4OWF = 1,
594                 TRUST_AUTH_TYPE_CLEAR = 2,
595                 TRUST_AUTH_TYPE_VERSION = 3
596         } lsa_TrustAuthType;
597
598         typedef struct {
599                 NTTIME_hyper   last_update_time;
600                 lsa_TrustAuthType AuthType;
601                 lsa_DATA_BUF2  data;
602         } lsa_TrustDomainInfoBuffer;
603
604         typedef struct {
605                 uint32 incoming_count;
606                 lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
607                 lsa_TrustDomainInfoBuffer *incoming_previous_auth_info;
608                 uint32 outgoing_count;
609                 lsa_TrustDomainInfoBuffer *outgoing_current_auth_info;
610                 lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info;
611         } lsa_TrustDomainInfoAuthInfo;
612
613         typedef struct {
614                 lsa_TrustDomainInfoInfoEx      info_ex;
615                 lsa_TrustDomainInfoPosixOffset posix_offset;
616                 lsa_TrustDomainInfoAuthInfo    auth_info;
617         } lsa_TrustDomainInfoFullInfo;
618
619         typedef struct {
620                 lsa_DATA_BUF2                          auth_blob;
621         } lsa_TrustDomainInfoAuthInfoInternal;
622
623         typedef struct {
624                 lsa_TrustDomainInfoInfoEx              info_ex;
625                 lsa_TrustDomainInfoPosixOffset         posix_offset;
626                 lsa_TrustDomainInfoAuthInfoInternal    auth_info;
627         } lsa_TrustDomainInfoFullInfoInternal;
628
629         typedef struct {
630                 lsa_TrustDomainInfoInfoEx      info_ex;
631                 uint32 forest_trust_length;
632                 [size_is(forest_trust_length)] uint8 *forest_trust_data;
633         } lsa_TrustDomainInfoInfoEx2Internal;
634
635         typedef struct {
636                 lsa_TrustDomainInfoInfoEx2Internal     info;
637                 lsa_TrustDomainInfoPosixOffset posix_offset;
638                 lsa_TrustDomainInfoAuthInfo    auth_info;
639         } lsa_TrustDomainInfoFullInfo2Internal;
640
641         typedef struct {
642                 kerb_EncTypes enc_types;
643         } lsa_TrustDomainInfoSupportedEncTypes;
644
645         typedef [switch_type(lsa_TrustDomInfoEnum)] union {
646                 [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
647                         lsa_TrustDomainInfoName              name;
648                 [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
649                         lsa_TrustDomainInfoControllers   controllers;
650                 [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)]
651                         lsa_TrustDomainInfoPosixOffset       posix_offset;
652                 [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)]
653                         lsa_TrustDomainInfoPassword          password;
654                 [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)]
655                         lsa_TrustDomainInfoBasic             info_basic;
656                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)]
657                         lsa_TrustDomainInfoInfoEx            info_ex;
658                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)]
659                         lsa_TrustDomainInfoAuthInfo          auth_info;
660                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)]
661                         lsa_TrustDomainInfoFullInfo          full_info;
662                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)]
663                         lsa_TrustDomainInfoAuthInfoInternal  auth_info_internal;
664                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
665                         lsa_TrustDomainInfoFullInfoInternal  full_info_internal;
666                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
667                         lsa_TrustDomainInfoInfoEx2Internal   info_ex2_internal;
668                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
669                         lsa_TrustDomainInfoFullInfo2Internal     full_info2_internal;
670                 [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES)]
671                         lsa_TrustDomainInfoSupportedEncTypes enc_types;
672         } lsa_TrustedDomainInfo;
673
674         /* Function:       0x1a */
675         NTSTATUS lsa_QueryTrustedDomainInfo(
676                 [in]     policy_handle                   *trustdom_handle,
677                 [in]     lsa_TrustDomInfoEnum             level, 
678                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
679                 );
680
681         /* Function:     0x1b */
682         NTSTATUS lsa_SetInformationTrustedDomain(
683                 [in]                  policy_handle         *trustdom_handle,
684                 [in]                  lsa_TrustDomInfoEnum   level, 
685                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
686                 );
687
688         /* Function:          0x1c */
689         [public] NTSTATUS lsa_OpenSecret(
690                 [in]     policy_handle    *handle,
691                 [in]         lsa_String        name,
692                 [in]         uint32            access_mask,
693                 [out]    policy_handle    *sec_handle
694                 );
695
696         /* Function:           0x1d */
697
698         [public] NTSTATUS lsa_SetSecret(
699                 [in]     policy_handle    *sec_handle,
700                 [in,unique]         lsa_DATA_BUF     *new_val,
701                 [in,unique]         lsa_DATA_BUF     *old_val
702                 );
703
704         typedef struct {
705                 lsa_DATA_BUF *buf;
706         } lsa_DATA_BUF_PTR;
707
708         /* Function:         0x1e */
709         [public] NTSTATUS lsa_QuerySecret (
710                 [in]     policy_handle     *sec_handle,
711                 [in,out,unique]     lsa_DATA_BUF_PTR  *new_val,
712                 [in,out,unique]     NTTIME_hyper      *new_mtime,
713                 [in,out,unique]     lsa_DATA_BUF_PTR  *old_val,
714                 [in,out,unique]     NTTIME_hyper      *old_mtime
715                 );
716
717         /* Function:     0x1f */
718         NTSTATUS lsa_LookupPrivValue(
719                 [in]     policy_handle *handle,
720                 [in]     lsa_String *name,
721                 [out]    lsa_LUID *luid
722                 );
723
724
725         /* Function:      0x20 */
726         NTSTATUS lsa_LookupPrivName (
727                 [in]     policy_handle *handle,
728                 [in]     lsa_LUID *luid,
729                 [out,unique]        lsa_StringLarge *name
730                 );
731
732
733         /*******************/
734         /* Function:  0x21 */
735         NTSTATUS lsa_LookupPrivDisplayName (
736                 [in]     policy_handle *handle,
737                 [in]     lsa_String *name,
738                 [out,unique]        lsa_StringLarge *disp_name,
739                 /* see http://www.microsoft.com/globaldev/nlsweb/ for
740                    language definitions */
741                 [in,out] uint16 *language_id,
742                 [in]         uint16 unknown
743                 );
744
745         /*******************/
746         /* Function:  0x22 */
747         NTSTATUS lsa_DeleteObject (
748                 [in,out]     policy_handle *handle
749                 );
750
751
752         
753         /*******************/
754         /* Function:      0x23 */
755         NTSTATUS lsa_EnumAccountsWithUserRight (
756                 [in]     policy_handle *handle,
757                 [in,unique]         lsa_String *name,
758                 [out]    lsa_SidArray *sids
759                 );
760
761         /* Function:      0x24 */
762         typedef struct {
763                 [string,charset(UTF16)] uint16 *name;
764         } lsa_RightAttribute;
765         
766         typedef struct {
767                 uint32 count;
768                 [size_is(count)] lsa_StringLarge *names;
769         } lsa_RightSet;
770         
771         NTSTATUS lsa_EnumAccountRights (
772                 [in]     policy_handle *handle,
773                 [in]     dom_sid2 *sid,
774                 [out]    lsa_RightSet *rights
775                 );
776
777
778         /**********************/
779         /* Function:       0x25 */
780         NTSTATUS lsa_AddAccountRights (
781                 [in]     policy_handle *handle,
782                 [in]     dom_sid2 *sid,
783                 [in]     lsa_RightSet *rights
784                 );
785         
786         /**********************/
787         /* Function:       0x26 */
788         NTSTATUS lsa_RemoveAccountRights (
789                 [in]     policy_handle *handle,
790                 [in]     dom_sid2 *sid,
791                 [in]         uint32 unknown,
792                 [in]     lsa_RightSet *rights
793                 );
794
795         /* Function:   0x27 */
796         NTSTATUS lsa_QueryTrustedDomainInfoBySid(
797                 [in]               policy_handle         *handle,
798                 [in]               dom_sid2              *dom_sid,
799                 [in]                   lsa_TrustDomInfoEnum  level, 
800                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
801         );
802
803         /* Function:     0x28 */
804         NTSTATUS lsa_SetTrustedDomainInfo(
805                 [in]               policy_handle         *handle,
806                 [in]               dom_sid2              *dom_sid,
807                 [in]                   lsa_TrustDomInfoEnum  level, 
808                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
809         );
810         /* Function:      0x29 */
811         NTSTATUS lsa_DeleteTrustedDomain(
812                 [in]               policy_handle         *handle,
813                 [in]               dom_sid2              *dom_sid
814         );
815
816         /* Function:       0x2a */
817         [todo] NTSTATUS lsa_StorePrivateData();
818         /* Function:        0x2b */
819         [todo] NTSTATUS lsa_RetrievePrivateData();
820
821
822         /**********************/
823         /* Function:     0x2c */
824         [public] NTSTATUS lsa_OpenPolicy2 (
825                 [in,unique]      [string,charset(UTF16)] uint16 *system_name,
826                 [in]  lsa_ObjectAttribute *attr,
827                 [in]      uint32 access_mask,
828                 [out] policy_handle *handle
829                 );
830
831         /**********************/
832         /* Function:     0x2d */
833         typedef struct {
834                 lsa_String *string;
835         } lsa_StringPointer;
836
837         NTSTATUS lsa_GetUserName(
838                 [in,unique] [string,charset(UTF16)] uint16 *system_name,
839                 [in,out,unique] lsa_String *account_name,
840                 [in,out,unique] lsa_StringPointer *authority_name
841                 );
842
843         /**********************/
844         /* Function:          0x2e */
845
846         NTSTATUS lsa_QueryInfoPolicy2(
847                 [in]                 policy_handle *handle,
848                 [in]                     lsa_PolicyInfo level,
849                 [out,unique,switch_is(level)]   lsa_PolicyInformation *info
850                 );
851
852         /* Function 0x2f */
853         NTSTATUS lsa_SetInfoPolicy2(
854                 [in]                            policy_handle *handle,
855                 [in]                            lsa_PolicyInfo level,
856                 [in,switch_is(level)]           lsa_PolicyInformation *info
857                 );
858
859         /**********************/
860         /* Function 0x30 */
861         NTSTATUS lsa_QueryTrustedDomainInfoByName(
862                 [in]                   policy_handle         *handle,
863                 [in]                   lsa_String             trusted_domain,
864                 [in]                   lsa_TrustDomInfoEnum   level, 
865                 [out,unique,switch_is(level)] lsa_TrustedDomainInfo *info
866                 );
867
868         /**********************/
869         /* Function 0x31 */
870         NTSTATUS lsa_SetTrustedDomainInfoByName(
871                 [in]                   policy_handle         *handle,
872                 [in]                   lsa_String             trusted_domain,
873                 [in]                   lsa_TrustDomInfoEnum   level, 
874                 [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
875                 );
876
877         /* Function 0x32 */
878
879         /* w2k3 treats max_size as max_domains*82       */
880         const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
881
882         typedef struct {
883                 uint32 count;
884                 [size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
885         } lsa_DomainListEx;
886
887         NTSTATUS lsa_EnumTrustedDomainsEx (
888                 [in]               policy_handle *handle,
889                 [in,out]           uint32 *resume_handle,
890                 [out]              lsa_DomainListEx *domains,
891                 [in]               uint32 max_size
892                 );
893
894         /* Function 0x33 */
895         NTSTATUS lsa_CreateTrustedDomainEx(
896                 [in]  policy_handle               *policy_handle,
897                 [in]  lsa_TrustDomainInfoInfoEx   *info,
898                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
899                 [in]  uint32 access_mask,
900                 [out] policy_handle               *trustdom_handle
901                 );
902
903
904         /* Function 0x34 */
905         NTSTATUS lsa_CloseTrustedDomainEx(
906                 [in,out]                   policy_handle         *handle
907         );
908
909         /* Function 0x35 */
910
911         /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 
912            for unknown6 - gd */
913         typedef struct {
914                 uint32 enforce_restrictions;
915                 hyper service_tkt_lifetime;
916                 hyper user_tkt_lifetime;
917                 hyper user_tkt_renewaltime;
918                 hyper clock_skew;
919                 hyper unknown6;
920         } lsa_DomainInfoKerberos;
921
922         typedef struct {
923                 uint32 blob_size;
924                 [size_is(blob_size)] uint8 *efs_blob;
925         } lsa_DomainInfoEfs;
926
927         typedef enum {
928                 LSA_DOMAIN_INFO_POLICY_EFS=2,
929                 LSA_DOMAIN_INFO_POLICY_KERBEROS=3
930         } lsa_DomainInfoEnum;
931
932         typedef [switch_type(uint16)] union {
933                 [case(LSA_DOMAIN_INFO_POLICY_EFS)]      lsa_DomainInfoEfs       efs_info;
934                 [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos  kerberos_info;
935         } lsa_DomainInformationPolicy;
936
937         NTSTATUS lsa_QueryDomainInformationPolicy(
938                 [in]            policy_handle *handle,
939                 [in]                    uint16 level,
940                 [out,unique,switch_is(level)]   lsa_DomainInformationPolicy *info
941                 );
942
943         /* Function 0x36 */
944         NTSTATUS lsa_SetDomainInformationPolicy(
945                 [in]            policy_handle *handle,
946                 [in]                    uint16 level,
947                 [in,unique,switch_is(level)]    lsa_DomainInformationPolicy *info
948                 );
949
950         /**********************/
951         /* Function 0x37 */
952         NTSTATUS lsa_OpenTrustedDomainByName(
953                 [in]     policy_handle *handle,
954                 [in]         lsa_String     name,
955                 [in]         uint32         access_mask,
956                 [out]    policy_handle *trustdom_handle
957                 );
958
959         /* Function 0x38 */
960         [todo] NTSTATUS lsa_TestCall();
961
962         /**********************/
963         /* Function 0x39 */
964
965         typedef struct {
966                 lsa_SidType sid_type;
967                 lsa_String name;
968                 uint32 sid_index;
969                 uint32 unknown;
970         } lsa_TranslatedName2;
971
972         typedef struct {
973                 [range(0,1000)] uint32 count;
974                 [size_is(count)] lsa_TranslatedName2 *names;
975         } lsa_TransNameArray2;
976
977         [public] NTSTATUS lsa_LookupSids2(
978                 [in]     policy_handle *handle,
979                 [in]     lsa_SidArray *sids,
980                 [out,unique]        lsa_RefDomainList *domains,
981                 [in,out] lsa_TransNameArray2 *names,
982                 [in]         uint16 level,
983                 [in,out] uint32 *count,
984                 [in]         uint32 unknown1,
985                 [in]         uint32 unknown2
986                 );
987
988         /**********************/
989         /* Function 0x3a */
990
991         typedef struct {
992                 lsa_SidType sid_type;
993                 uint32 rid;
994                 uint32 sid_index;
995                 uint32 unknown;
996         } lsa_TranslatedSid2;
997
998         typedef struct {
999                 [range(0,1000)] uint32 count;
1000                 [size_is(count)] lsa_TranslatedSid2 *sids;
1001         } lsa_TransSidArray2;
1002
1003         [public] NTSTATUS lsa_LookupNames2 (
1004                 [in]     policy_handle *handle,
1005                 [in,range(0,1000)] uint32 num_names,
1006                 [in,size_is(num_names)]  lsa_String names[],
1007                 [out,unique]        lsa_RefDomainList *domains,
1008                 [in,out] lsa_TransSidArray2 *sids,
1009                 [in]         lsa_LookupNamesLevel level,
1010                 [in,out] uint32 *count,
1011                 [in]         uint32 unknown1,
1012                 [in]         uint32 unknown2
1013                 );
1014
1015         /* Function 0x3b */
1016         NTSTATUS lsa_CreateTrustedDomainEx2(
1017                 [in]  policy_handle               *policy_handle,
1018                 [in]  lsa_TrustDomainInfoInfoEx   *info,
1019                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
1020                 [in]  uint32                       access_mask,
1021                 [out] policy_handle               *trustdom_handle
1022                 );
1023
1024         /* Function 0x3c */
1025         [todo] NTSTATUS lsa_CREDRWRITE();
1026
1027         /* Function 0x3d */
1028         [todo] NTSTATUS lsa_CREDRREAD();
1029
1030         /* Function 0x3e */
1031         [todo] NTSTATUS lsa_CREDRENUMERATE();
1032
1033         /* Function 0x3f */
1034         [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
1035
1036         /* Function 0x40 */
1037         [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
1038
1039         /* Function 0x41 */
1040         [todo] NTSTATUS lsa_CREDRDELETE();
1041
1042         /* Function 0x42 */
1043         [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
1044
1045         /* Function 0x43 */
1046         [todo] NTSTATUS lsa_CREDRPROFILELOADED();
1047
1048         /**********************/
1049         /* Function 0x44 */
1050         typedef struct {
1051                 lsa_SidType sid_type;
1052                 dom_sid2 *sid;
1053                 uint32 sid_index;
1054                 uint32 unknown;
1055         } lsa_TranslatedSid3;
1056
1057         typedef struct {
1058                 [range(0,1000)] uint32 count;
1059                 [size_is(count)] lsa_TranslatedSid3 *sids;
1060         } lsa_TransSidArray3;
1061
1062         [public] NTSTATUS lsa_LookupNames3 (
1063                 [in]     policy_handle *handle,
1064                 [in,range(0,1000)] uint32 num_names,
1065                 [in,size_is(num_names)]  lsa_String names[],
1066                 [out,unique]        lsa_RefDomainList *domains,
1067                 [in,out] lsa_TransSidArray3 *sids,
1068                 [in]         lsa_LookupNamesLevel level,
1069                 [in,out] uint32 *count,
1070                 [in]         uint32 unknown1,
1071                 [in]         uint32 unknown2
1072                 );
1073
1074         /* Function 0x45 */
1075         [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
1076
1077         /* Function 0x46 */
1078         [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
1079
1080         /* Function 0x47 */
1081         [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
1082
1083         /* Function 0x48 */
1084         [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
1085
1086         /* Function 0x49 */
1087         typedef struct {
1088                 [range(0,131072)] uint32 length;
1089                 [size_is(length)] uint8 *data;
1090         } lsa_ForestTrustBinaryData;
1091
1092         typedef struct {
1093                 dom_sid2 *domain_sid;
1094                 lsa_StringLarge dns_domain_name;
1095                 lsa_StringLarge netbios_domain_name;
1096         } lsa_ForestTrustDomainInfo;
1097
1098         typedef [switch_type(uint32)] union {
1099                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
1100                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
1101                 [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
1102                 [default] lsa_ForestTrustBinaryData data;
1103         } lsa_ForestTrustData;
1104
1105         typedef [v1_enum] enum {
1106                 LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
1107                 LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
1108                 LSA_FOREST_TRUST_DOMAIN_INFO = 2,
1109                 LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
1110         } lsa_ForestTrustRecordType;
1111
1112         typedef struct {
1113                 uint32 flags;
1114                 lsa_ForestTrustRecordType level;
1115                 hyper unknown;
1116                 [switch_is(level)] lsa_ForestTrustData forest_trust_data;
1117         } lsa_ForestTrustRecord;
1118
1119         typedef [public] struct {
1120                 [range(0,4000)] uint32 count;
1121                 [size_is(count)] lsa_ForestTrustRecord **entries;
1122         } lsa_ForestTrustInformation;
1123
1124         NTSTATUS lsa_lsaRQueryForestTrustInformation(
1125                 [in] policy_handle *handle,
1126                 [in,ref] lsa_String *trusted_domain_name,
1127                 [in] uint16 unknown, /* level ? */
1128                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1129                 );
1130
1131         /* Function 0x4a */
1132         [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
1133
1134         /* Function 0x4b */
1135         [todo] NTSTATUS lsa_CREDRRENAME();
1136
1137         /*****************/
1138         /* Function 0x4c */
1139
1140         [public] NTSTATUS lsa_LookupSids3(
1141                 [in]         lsa_SidArray *sids,
1142                 [out,unique] lsa_RefDomainList *domains,
1143                 [in,out]     lsa_TransNameArray2 *names,
1144                 [in]         uint16 level,
1145                 [in,out]     uint32 *count,
1146                 [in]         uint32 unknown1,
1147                 [in]         uint32 unknown2
1148                 );
1149
1150         /* Function 0x4d */
1151         NTSTATUS lsa_LookupNames4(
1152                 [in,range(0,1000)] uint32 num_names,
1153                 [in,size_is(num_names)]  lsa_String names[],
1154                 [out,unique]        lsa_RefDomainList *domains,
1155                 [in,out] lsa_TransSidArray3 *sids,
1156                 [in]         lsa_LookupNamesLevel level,
1157                 [in,out] uint32 *count,
1158                 [in]         uint32 unknown1,
1159                 [in]         uint32 unknown2
1160                 );
1161
1162         /* Function 0x4e */
1163         [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
1164
1165         /* Function 0x4f */
1166         [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
1167
1168         /* Function 0x50 */
1169         [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
1170
1171         /* Function 0x51 */
1172         [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
1173
1174 }