fixed a number of places in our LSA server where we should return the
[metze/samba/wip.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_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC = 7
392         } lsa_LookupNamesLevel;
393
394         [public] NTSTATUS lsa_LookupNames (
395                 [in]         policy_handle *handle,
396                 [in,range(0,1000)] uint32 num_names,
397                 [in,size_is(num_names)]  lsa_String names[],
398                 [out,unique] lsa_RefDomainList *domains,
399                 [in,out]     lsa_TransSidArray *sids,
400                 [in]         lsa_LookupNamesLevel level,
401                 [in,out]     uint32 *count
402                 );
403
404
405         /******************/
406         /* Function: 0x0f */
407
408         typedef struct {
409                 lsa_SidType sid_type;
410                 lsa_String name;
411                 uint32 sid_index;
412         } lsa_TranslatedName;
413
414         typedef struct {
415                 [range(0,1000)] uint32 count;
416                 [size_is(count)] lsa_TranslatedName *names;
417         } lsa_TransNameArray;
418
419         [public] NTSTATUS lsa_LookupSids (
420                 [in]         policy_handle *handle,
421                 [in]         lsa_SidArray *sids,
422                 [out,unique]        lsa_RefDomainList *domains,
423                 [in,out]     lsa_TransNameArray *names,
424                 [in]         uint16 level,
425                 [in,out] uint32 *count
426                 );
427
428
429         /* Function:        0x10 */
430         [public] NTSTATUS lsa_CreateSecret(
431                 [in]         policy_handle *handle,
432                 [in]         lsa_String       name,
433                 [in]         uint32         access_mask,
434                 [out]        policy_handle *sec_handle
435                 );
436
437
438         /*****************************************/
439         /* Function:     0x11                    */
440         NTSTATUS lsa_OpenAccount (
441                 [in]         policy_handle *handle,
442                 [in]         dom_sid2 *sid,
443                 [in]         uint32 access_mask,
444                 [out]        policy_handle *acct_handle
445                 );
446
447
448         /****************************************/
449         /* Function:    0x12                    */
450
451         typedef struct {
452                 lsa_LUID luid;
453                 uint32 attribute;
454         } lsa_LUIDAttribute;
455         
456         typedef struct {
457                 [range(0,1000)] uint32 count;
458                 uint32 unknown;
459                 [size_is(count)] lsa_LUIDAttribute set[*];
460         } lsa_PrivilegeSet;
461         
462         NTSTATUS lsa_EnumPrivsAccount (
463                 [in]         policy_handle *handle,
464                 [out,unique] lsa_PrivilegeSet *privs
465                 );
466
467
468         /****************************************/
469         /* Function:            0x13 */
470         NTSTATUS lsa_AddPrivilegesToAccount(
471                 [in]         policy_handle *handle,
472                 [in]         lsa_PrivilegeSet *privs
473                 );
474         
475
476         /****************************************/
477         /* Function:         0x14 */
478         NTSTATUS lsa_RemovePrivilegesFromAccount(
479                 [in]         policy_handle *handle,
480                 [in]         uint8 remove_all,
481                 [in,unique]  lsa_PrivilegeSet *privs
482                 );
483
484         /* Function:           0x15 */
485         [todo] NTSTATUS lsa_GetQuotasForAccount();
486         
487         /* Function:           0x16 */
488         [todo] NTSTATUS lsa_SetQuotasForAccount();
489         
490         /* Function:    0x17 */
491         NTSTATUS lsa_GetSystemAccessAccount(
492                 [in]    policy_handle *handle,
493                 [out,ref] uint32 *access_mask
494                 );
495
496         /* Function:    0x18 */
497         NTSTATUS lsa_SetSystemAccessAccount(
498                 [in]    policy_handle *handle,
499                 [in]    uint32 access_mask
500                 );
501
502         /* Function:        0x19 */
503         NTSTATUS lsa_OpenTrustedDomain(
504                 [in]     policy_handle *handle,
505                 [in]     dom_sid2      *sid,
506                 [in]         uint32         access_mask,
507                 [out]    policy_handle *trustdom_handle
508                 );
509
510         typedef [flag(NDR_PAHEX)] struct {
511                 uint32 length;
512                 uint32 size;
513                 [size_is(size),length_is(length)] uint8 *data;
514         } lsa_DATA_BUF;
515
516         typedef [flag(NDR_PAHEX)] struct {
517                 [range(0,65536)] uint32 size;
518                 [size_is(size)] uint8 *data;
519         } lsa_DATA_BUF2;
520
521         typedef enum {
522                 LSA_TRUSTED_DOMAIN_INFO_NAME                  = 1,
523                 LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS           = 2,
524                 LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET          = 3,
525                 LSA_TRUSTED_DOMAIN_INFO_PASSWORD              = 4,
526                 LSA_TRUSTED_DOMAIN_INFO_BASIC                 = 5,
527                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX               = 6,
528                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO             = 7,
529                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO             = 8,
530                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL    = 9,
531                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL    = 10,
532                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL     = 11,
533                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL  = 12,
534                 LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES = 13
535         } lsa_TrustDomInfoEnum;
536
537         typedef [public,bitmap32bit] bitmap {
538                 LSA_TRUST_DIRECTION_INBOUND  = 0x00000001,
539                 LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002
540         } lsa_TrustDirection;
541
542         typedef [v1_enum] enum {
543                 LSA_TRUST_TYPE_DOWNLEVEL  = 0x00000001,
544                 LSA_TRUST_TYPE_UPLEVEL    = 0x00000002,
545                 LSA_TRUST_TYPE_MIT        = 0x00000003
546         } lsa_TrustType;
547
548         typedef [public,bitmap32bit] bitmap {
549                 LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE      = 0x00000001,
550                 LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY        = 0x00000002,
551                 LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN  = 0x00000004,
552                 LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE   = 0x00000008,
553                 LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION  = 0x00000010,
554                 LSA_TRUST_ATTRIBUTE_WITHIN_FOREST       = 0x00000020,
555                 LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL   = 0x00000040,
556                 LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080
557         } lsa_TrustAttributes;
558
559         typedef struct {
560                 lsa_StringLarge  netbios_name;
561         } lsa_TrustDomainInfoName;
562
563
564         typedef struct {
565                 uint32 entries;
566                 [size_is(entries)] lsa_StringLarge  *netbios_names;
567         } lsa_TrustDomainInfoControllers;
568
569         typedef struct {
570                 uint32         posix_offset;
571         } lsa_TrustDomainInfoPosixOffset;
572
573         typedef struct {
574                 lsa_DATA_BUF  *password;
575                 lsa_DATA_BUF  *old_password;
576         } lsa_TrustDomainInfoPassword;
577
578         typedef struct {
579                 lsa_String     netbios_name;
580                 dom_sid2      *sid;
581         } lsa_TrustDomainInfoBasic;
582
583         typedef struct {
584                 lsa_StringLarge     domain_name;
585                 lsa_StringLarge     netbios_name;
586                 dom_sid2           *sid;
587                 lsa_TrustDirection  trust_direction;
588                 lsa_TrustType       trust_type;
589                 lsa_TrustAttributes trust_attributes;
590         } lsa_TrustDomainInfoInfoEx;
591
592         typedef [public,v1_enum] enum {
593                 TRUST_AUTH_TYPE_NONE = 0,
594                 TRUST_AUTH_TYPE_NT4OWF = 1,
595                 TRUST_AUTH_TYPE_CLEAR = 2,
596                 TRUST_AUTH_TYPE_VERSION = 3
597         } lsa_TrustAuthType;
598
599         typedef struct {
600                 NTTIME_hyper   last_update_time;
601                 lsa_TrustAuthType AuthType;
602                 lsa_DATA_BUF2  data;
603         } lsa_TrustDomainInfoBuffer;
604
605         typedef struct {
606                 uint32 incoming_count;
607                 lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
608                 lsa_TrustDomainInfoBuffer *incoming_previous_auth_info;
609                 uint32 outgoing_count;
610                 lsa_TrustDomainInfoBuffer *outgoing_current_auth_info;
611                 lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info;
612         } lsa_TrustDomainInfoAuthInfo;
613
614         typedef struct {
615                 lsa_TrustDomainInfoInfoEx      info_ex;
616                 lsa_TrustDomainInfoPosixOffset posix_offset;
617                 lsa_TrustDomainInfoAuthInfo    auth_info;
618         } lsa_TrustDomainInfoFullInfo;
619
620         typedef struct {
621                 lsa_DATA_BUF2                          auth_blob;
622         } lsa_TrustDomainInfoAuthInfoInternal;
623
624         typedef struct {
625                 lsa_TrustDomainInfoInfoEx              info_ex;
626                 lsa_TrustDomainInfoPosixOffset         posix_offset;
627                 lsa_TrustDomainInfoAuthInfoInternal    auth_info;
628         } lsa_TrustDomainInfoFullInfoInternal;
629
630         typedef struct {
631                 lsa_TrustDomainInfoInfoEx      info_ex;
632                 uint32 forest_trust_length;
633                 [size_is(forest_trust_length)] uint8 *forest_trust_data;
634         } lsa_TrustDomainInfoInfoEx2Internal;
635
636         typedef struct {
637                 lsa_TrustDomainInfoInfoEx2Internal     info;
638                 lsa_TrustDomainInfoPosixOffset posix_offset;
639                 lsa_TrustDomainInfoAuthInfo    auth_info;
640         } lsa_TrustDomainInfoFullInfo2Internal;
641
642         typedef struct {
643                 kerb_EncTypes enc_types;
644         } lsa_TrustDomainInfoSupportedEncTypes;
645
646         typedef [switch_type(lsa_TrustDomInfoEnum)] union {
647                 [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
648                         lsa_TrustDomainInfoName              name;
649                 [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
650                         lsa_TrustDomainInfoControllers   controllers;
651                 [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)]
652                         lsa_TrustDomainInfoPosixOffset       posix_offset;
653                 [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)]
654                         lsa_TrustDomainInfoPassword          password;
655                 [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)]
656                         lsa_TrustDomainInfoBasic             info_basic;
657                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)]
658                         lsa_TrustDomainInfoInfoEx            info_ex;
659                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)]
660                         lsa_TrustDomainInfoAuthInfo          auth_info;
661                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)]
662                         lsa_TrustDomainInfoFullInfo          full_info;
663                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)]
664                         lsa_TrustDomainInfoAuthInfoInternal  auth_info_internal;
665                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
666                         lsa_TrustDomainInfoFullInfoInternal  full_info_internal;
667                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
668                         lsa_TrustDomainInfoInfoEx2Internal   info_ex2_internal;
669                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
670                         lsa_TrustDomainInfoFullInfo2Internal     full_info2_internal;
671                 [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES)]
672                         lsa_TrustDomainInfoSupportedEncTypes enc_types;
673         } lsa_TrustedDomainInfo;
674
675         /* Function:       0x1a */
676         NTSTATUS lsa_QueryTrustedDomainInfo(
677                 [in]     policy_handle                   *trustdom_handle,
678                 [in]     lsa_TrustDomInfoEnum             level, 
679                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
680                 );
681
682         /* Function:     0x1b */
683         NTSTATUS lsa_SetInformationTrustedDomain(
684                 [in]                  policy_handle         *trustdom_handle,
685                 [in]                  lsa_TrustDomInfoEnum   level, 
686                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
687                 );
688
689         /* Function:          0x1c */
690         [public] NTSTATUS lsa_OpenSecret(
691                 [in]     policy_handle    *handle,
692                 [in]         lsa_String        name,
693                 [in]         uint32            access_mask,
694                 [out]    policy_handle    *sec_handle
695                 );
696
697         /* Function:           0x1d */
698
699         [public] NTSTATUS lsa_SetSecret(
700                 [in]     policy_handle    *sec_handle,
701                 [in,unique]         lsa_DATA_BUF     *new_val,
702                 [in,unique]         lsa_DATA_BUF     *old_val
703                 );
704
705         typedef struct {
706                 lsa_DATA_BUF *buf;
707         } lsa_DATA_BUF_PTR;
708
709         /* Function:         0x1e */
710         [public] NTSTATUS lsa_QuerySecret (
711                 [in]     policy_handle     *sec_handle,
712                 [in,out,unique]     lsa_DATA_BUF_PTR  *new_val,
713                 [in,out,unique]     NTTIME_hyper      *new_mtime,
714                 [in,out,unique]     lsa_DATA_BUF_PTR  *old_val,
715                 [in,out,unique]     NTTIME_hyper      *old_mtime
716                 );
717
718         /* Function:     0x1f */
719         NTSTATUS lsa_LookupPrivValue(
720                 [in]     policy_handle *handle,
721                 [in]     lsa_String *name,
722                 [out]    lsa_LUID *luid
723                 );
724
725
726         /* Function:      0x20 */
727         NTSTATUS lsa_LookupPrivName (
728                 [in]     policy_handle *handle,
729                 [in]     lsa_LUID *luid,
730                 [out,unique]        lsa_StringLarge *name
731                 );
732
733
734         /*******************/
735         /* Function:  0x21 */
736         NTSTATUS lsa_LookupPrivDisplayName (
737                 [in]     policy_handle *handle,
738                 [in]     lsa_String *name,
739                 [out,unique]        lsa_StringLarge *disp_name,
740                 /* see http://www.microsoft.com/globaldev/nlsweb/ for
741                    language definitions */
742                 [in,out] uint16 *language_id,
743                 [in]         uint16 unknown
744                 );
745
746         /*******************/
747         /* Function:  0x22 */
748         NTSTATUS lsa_DeleteObject (
749                 [in,out]     policy_handle *handle
750                 );
751
752
753         
754         /*******************/
755         /* Function:      0x23 */
756         NTSTATUS lsa_EnumAccountsWithUserRight (
757                 [in]     policy_handle *handle,
758                 [in,unique]         lsa_String *name,
759                 [out]    lsa_SidArray *sids
760                 );
761
762         /* Function:      0x24 */
763         typedef struct {
764                 [string,charset(UTF16)] uint16 *name;
765         } lsa_RightAttribute;
766         
767         typedef struct {
768                 uint32 count;
769                 [size_is(count)] lsa_StringLarge *names;
770         } lsa_RightSet;
771         
772         NTSTATUS lsa_EnumAccountRights (
773                 [in]     policy_handle *handle,
774                 [in]     dom_sid2 *sid,
775                 [out]    lsa_RightSet *rights
776                 );
777
778
779         /**********************/
780         /* Function:       0x25 */
781         NTSTATUS lsa_AddAccountRights (
782                 [in]     policy_handle *handle,
783                 [in]     dom_sid2 *sid,
784                 [in]     lsa_RightSet *rights
785                 );
786         
787         /**********************/
788         /* Function:       0x26 */
789         NTSTATUS lsa_RemoveAccountRights (
790                 [in]     policy_handle *handle,
791                 [in]     dom_sid2 *sid,
792                 [in]         uint32 unknown,
793                 [in]     lsa_RightSet *rights
794                 );
795
796         /* Function:   0x27 */
797         NTSTATUS lsa_QueryTrustedDomainInfoBySid(
798                 [in]               policy_handle         *handle,
799                 [in]               dom_sid2              *dom_sid,
800                 [in]                   lsa_TrustDomInfoEnum  level, 
801                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
802         );
803
804         /* Function:     0x28 */
805         NTSTATUS lsa_SetTrustedDomainInfo(
806                 [in]               policy_handle         *handle,
807                 [in]               dom_sid2              *dom_sid,
808                 [in]                   lsa_TrustDomInfoEnum  level, 
809                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
810         );
811         /* Function:      0x29 */
812         NTSTATUS lsa_DeleteTrustedDomain(
813                 [in]               policy_handle         *handle,
814                 [in]               dom_sid2              *dom_sid
815         );
816
817         /* Function:       0x2a */
818         [todo] NTSTATUS lsa_StorePrivateData();
819         /* Function:        0x2b */
820         [todo] NTSTATUS lsa_RetrievePrivateData();
821
822
823         /**********************/
824         /* Function:     0x2c */
825         [public] NTSTATUS lsa_OpenPolicy2 (
826                 [in,unique]      [string,charset(UTF16)] uint16 *system_name,
827                 [in]  lsa_ObjectAttribute *attr,
828                 [in]      uint32 access_mask,
829                 [out] policy_handle *handle
830                 );
831
832         /**********************/
833         /* Function:     0x2d */
834         typedef struct {
835                 lsa_String *string;
836         } lsa_StringPointer;
837
838         NTSTATUS lsa_GetUserName(
839                 [in,unique] [string,charset(UTF16)] uint16 *system_name,
840                 [in,out,unique] lsa_String *account_name,
841                 [in,out,unique] lsa_StringPointer *authority_name
842                 );
843
844         /**********************/
845         /* Function:          0x2e */
846
847         NTSTATUS lsa_QueryInfoPolicy2(
848                 [in]                 policy_handle *handle,
849                 [in]                     lsa_PolicyInfo level,
850                 [out,unique,switch_is(level)]   lsa_PolicyInformation *info
851                 );
852
853         /* Function 0x2f */
854         NTSTATUS lsa_SetInfoPolicy2(
855                 [in]                            policy_handle *handle,
856                 [in]                            lsa_PolicyInfo level,
857                 [in,switch_is(level)]           lsa_PolicyInformation *info
858                 );
859
860         /**********************/
861         /* Function 0x30 */
862         NTSTATUS lsa_QueryTrustedDomainInfoByName(
863                 [in]                   policy_handle         *handle,
864                 [in]                   lsa_String             trusted_domain,
865                 [in]                   lsa_TrustDomInfoEnum   level, 
866                 [out,unique,switch_is(level)] lsa_TrustedDomainInfo *info
867                 );
868
869         /**********************/
870         /* Function 0x31 */
871         NTSTATUS lsa_SetTrustedDomainInfoByName(
872                 [in]                   policy_handle         *handle,
873                 [in]                   lsa_String             trusted_domain,
874                 [in]                   lsa_TrustDomInfoEnum   level, 
875                 [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
876                 );
877
878         /* Function 0x32 */
879
880         /* w2k3 treats max_size as max_domains*82       */
881         const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
882
883         typedef struct {
884                 uint32 count;
885                 [size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
886         } lsa_DomainListEx;
887
888         NTSTATUS lsa_EnumTrustedDomainsEx (
889                 [in]               policy_handle *handle,
890                 [in,out]           uint32 *resume_handle,
891                 [out]              lsa_DomainListEx *domains,
892                 [in]               uint32 max_size
893                 );
894
895         /* Function 0x33 */
896         NTSTATUS lsa_CreateTrustedDomainEx(
897                 [in]  policy_handle               *policy_handle,
898                 [in]  lsa_TrustDomainInfoInfoEx   *info,
899                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
900                 [in]  uint32 access_mask,
901                 [out] policy_handle               *trustdom_handle
902                 );
903
904
905         /* Function 0x34 */
906         NTSTATUS lsa_CloseTrustedDomainEx(
907                 [in,out]                   policy_handle         *handle
908         );
909
910         /* Function 0x35 */
911
912         /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 
913            for unknown6 - gd */
914         typedef struct {
915                 uint32 enforce_restrictions;
916                 hyper service_tkt_lifetime;
917                 hyper user_tkt_lifetime;
918                 hyper user_tkt_renewaltime;
919                 hyper clock_skew;
920                 hyper unknown6;
921         } lsa_DomainInfoKerberos;
922
923         typedef struct {
924                 uint32 blob_size;
925                 [size_is(blob_size)] uint8 *efs_blob;
926         } lsa_DomainInfoEfs;
927
928         typedef enum {
929                 LSA_DOMAIN_INFO_POLICY_EFS=2,
930                 LSA_DOMAIN_INFO_POLICY_KERBEROS=3
931         } lsa_DomainInfoEnum;
932
933         typedef [switch_type(uint16)] union {
934                 [case(LSA_DOMAIN_INFO_POLICY_EFS)]      lsa_DomainInfoEfs       efs_info;
935                 [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos  kerberos_info;
936         } lsa_DomainInformationPolicy;
937
938         NTSTATUS lsa_QueryDomainInformationPolicy(
939                 [in]            policy_handle *handle,
940                 [in]                    uint16 level,
941                 [out,unique,switch_is(level)]   lsa_DomainInformationPolicy *info
942                 );
943
944         /* Function 0x36 */
945         NTSTATUS lsa_SetDomainInformationPolicy(
946                 [in]            policy_handle *handle,
947                 [in]                    uint16 level,
948                 [in,unique,switch_is(level)]    lsa_DomainInformationPolicy *info
949                 );
950
951         /**********************/
952         /* Function 0x37 */
953         NTSTATUS lsa_OpenTrustedDomainByName(
954                 [in]     policy_handle *handle,
955                 [in]         lsa_String     name,
956                 [in]         uint32         access_mask,
957                 [out]    policy_handle *trustdom_handle
958                 );
959
960         /* Function 0x38 */
961         [todo] NTSTATUS lsa_TestCall();
962
963         /**********************/
964         /* Function 0x39 */
965
966         typedef struct {
967                 lsa_SidType sid_type;
968                 lsa_String name;
969                 uint32 sid_index;
970                 uint32 unknown;
971         } lsa_TranslatedName2;
972
973         typedef struct {
974                 [range(0,1000)] uint32 count;
975                 [size_is(count)] lsa_TranslatedName2 *names;
976         } lsa_TransNameArray2;
977
978         [public] NTSTATUS lsa_LookupSids2(
979                 [in]     policy_handle *handle,
980                 [in]     lsa_SidArray *sids,
981                 [out,unique]        lsa_RefDomainList *domains,
982                 [in,out] lsa_TransNameArray2 *names,
983                 [in]         uint16 level,
984                 [in,out] uint32 *count,
985                 [in]         uint32 unknown1,
986                 [in]         uint32 unknown2
987                 );
988
989         /**********************/
990         /* Function 0x3a */
991
992         typedef struct {
993                 lsa_SidType sid_type;
994                 uint32 rid;
995                 uint32 sid_index;
996                 uint32 unknown;
997         } lsa_TranslatedSid2;
998
999         typedef struct {
1000                 [range(0,1000)] uint32 count;
1001                 [size_is(count)] lsa_TranslatedSid2 *sids;
1002         } lsa_TransSidArray2;
1003
1004         [public] NTSTATUS lsa_LookupNames2 (
1005                 [in]     policy_handle *handle,
1006                 [in,range(0,1000)] uint32 num_names,
1007                 [in,size_is(num_names)]  lsa_String names[],
1008                 [out,unique]        lsa_RefDomainList *domains,
1009                 [in,out] lsa_TransSidArray2 *sids,
1010                 [in]         lsa_LookupNamesLevel level,
1011                 [in,out] uint32 *count,
1012                 [in]         uint32 unknown1,
1013                 [in]         uint32 unknown2
1014                 );
1015
1016         /* Function 0x3b */
1017         NTSTATUS lsa_CreateTrustedDomainEx2(
1018                 [in]  policy_handle               *policy_handle,
1019                 [in]  lsa_TrustDomainInfoInfoEx   *info,
1020                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
1021                 [in]  uint32                       access_mask,
1022                 [out] policy_handle               *trustdom_handle
1023                 );
1024
1025         /* Function 0x3c */
1026         [todo] NTSTATUS lsa_CREDRWRITE();
1027
1028         /* Function 0x3d */
1029         [todo] NTSTATUS lsa_CREDRREAD();
1030
1031         /* Function 0x3e */
1032         [todo] NTSTATUS lsa_CREDRENUMERATE();
1033
1034         /* Function 0x3f */
1035         [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
1036
1037         /* Function 0x40 */
1038         [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
1039
1040         /* Function 0x41 */
1041         [todo] NTSTATUS lsa_CREDRDELETE();
1042
1043         /* Function 0x42 */
1044         [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
1045
1046         /* Function 0x43 */
1047         [todo] NTSTATUS lsa_CREDRPROFILELOADED();
1048
1049         /**********************/
1050         /* Function 0x44 */
1051         typedef struct {
1052                 lsa_SidType sid_type;
1053                 dom_sid2 *sid;
1054                 uint32 sid_index;
1055                 uint32 flags;
1056         } lsa_TranslatedSid3;
1057
1058         typedef struct {
1059                 [range(0,1000)] uint32 count;
1060                 [size_is(count)] lsa_TranslatedSid3 *sids;
1061         } lsa_TransSidArray3;
1062
1063         [public] NTSTATUS lsa_LookupNames3 (
1064                 [in]     policy_handle *handle,
1065                 [in,range(0,1000)] uint32 num_names,
1066                 [in,size_is(num_names)]  lsa_String names[],
1067                 [out,unique]        lsa_RefDomainList *domains,
1068                 [in,out] lsa_TransSidArray3 *sids,
1069                 [in]         lsa_LookupNamesLevel level,
1070                 [in,out] uint32 *count,
1071                 [in]         uint32 unknown1,
1072                 [in]         uint32 unknown2
1073                 );
1074
1075         /* Function 0x45 */
1076         [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
1077
1078         /* Function 0x46 */
1079         [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
1080
1081         /* Function 0x47 */
1082         [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
1083
1084         /* Function 0x48 */
1085         [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
1086
1087         /* Function 0x49 */
1088         typedef struct {
1089                 [range(0,131072)] uint32 length;
1090                 [size_is(length)] uint8 *data;
1091         } lsa_ForestTrustBinaryData;
1092
1093         typedef struct {
1094                 dom_sid2 *domain_sid;
1095                 lsa_StringLarge dns_domain_name;
1096                 lsa_StringLarge netbios_domain_name;
1097         } lsa_ForestTrustDomainInfo;
1098
1099         typedef [switch_type(uint32)] union {
1100                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
1101                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
1102                 [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
1103                 [default] lsa_ForestTrustBinaryData data;
1104         } lsa_ForestTrustData;
1105
1106         typedef [v1_enum] enum {
1107                 LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
1108                 LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
1109                 LSA_FOREST_TRUST_DOMAIN_INFO = 2,
1110                 LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
1111         } lsa_ForestTrustRecordType;
1112
1113         typedef struct {
1114                 uint32 flags;
1115                 lsa_ForestTrustRecordType level;
1116                 hyper unknown;
1117                 [switch_is(level)] lsa_ForestTrustData forest_trust_data;
1118         } lsa_ForestTrustRecord;
1119
1120         typedef [public] struct {
1121                 [range(0,4000)] uint32 count;
1122                 [size_is(count)] lsa_ForestTrustRecord **entries;
1123         } lsa_ForestTrustInformation;
1124
1125         NTSTATUS lsa_lsaRQueryForestTrustInformation(
1126                 [in] policy_handle *handle,
1127                 [in,ref] lsa_String *trusted_domain_name,
1128                 [in] uint16 unknown, /* level ? */
1129                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1130                 );
1131
1132         /* Function 0x4a */
1133         [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
1134
1135         /* Function 0x4b */
1136         [todo] NTSTATUS lsa_CREDRRENAME();
1137
1138         /*****************/
1139         /* Function 0x4c */
1140
1141         [public] NTSTATUS lsa_LookupSids3(
1142                 [in]         lsa_SidArray *sids,
1143                 [out,unique] lsa_RefDomainList *domains,
1144                 [in,out]     lsa_TransNameArray2 *names,
1145                 [in]         uint16 level,
1146                 [in,out]     uint32 *count,
1147                 [in]         uint32 unknown1,
1148                 [in]         uint32 unknown2
1149                 );
1150
1151         /* Function 0x4d */
1152         NTSTATUS lsa_LookupNames4(
1153                 [in,range(0,1000)] uint32 num_names,
1154                 [in,size_is(num_names)]  lsa_String names[],
1155                 [out,unique]        lsa_RefDomainList *domains,
1156                 [in,out] lsa_TransSidArray3 *sids,
1157                 [in]         lsa_LookupNamesLevel level,
1158                 [in,out] uint32 *count,
1159                 [in]         uint32 unknown1,
1160                 [in]         uint32 unknown2
1161                 );
1162
1163         /* Function 0x4e */
1164         [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
1165
1166         /* Function 0x4f */
1167         [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
1168
1169         /* Function 0x50 */
1170         [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
1171
1172         /* Function 0x51 */
1173         [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
1174
1175 }