Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-abartlet
[kai/samba.git] / source4 / librpc / idl / netlogon.idl
1 /*
2   netlogon interface
3   much of this was derived from the ethereal sources - thanks to everyone 
4   who contributed!
5 */
6
7 import "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
8
9 #include "idl_types.h"
10
11 [
12   uuid("12345678-1234-abcd-ef00-01234567cffb"),
13   version(1.0),
14   endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
15   pointer_default(unique),
16   pointer_default_top(unique)
17 ]
18
19 interface netlogon
20 {
21         typedef bitmap samr_AcctFlags samr_AcctFlags;
22         typedef bitmap samr_GroupAttrs samr_GroupAttrs;
23
24         /*****************/
25         /* Function 0x00 */
26
27         typedef struct {
28                 [string,charset(UTF16)] uint16 *account_name;
29                 uint32 priv;
30                 uint32 auth_flags;
31                 uint32 logon_count;
32                 uint32 bad_pw_count;
33                 time_t last_logon;
34                 time_t last_logoff;
35                 time_t logoff_time;
36                 time_t kickoff_time;
37                 uint32 password_age;
38                 time_t pw_can_change;
39                 time_t pw_must_change;
40                 [string,charset(UTF16)] uint16 *computer;
41                 [string,charset(UTF16)] uint16 *domain;
42                 [string,charset(UTF16)] uint16 *script_path;
43                 uint32 unknown;
44         } netr_UasInfo;
45
46         WERROR netr_LogonUasLogon(
47                 [in]   [string,charset(UTF16)] uint16 *server_name,
48                 [in]   [string,charset(UTF16)] uint16 account_name[],
49                 [in]   [string,charset(UTF16)] uint16 workstation[],
50                 [out]  netr_UasInfo *info
51                 );
52
53
54         /*****************/
55         /* Function 0x01 */
56
57         typedef struct {
58                 uint32 duration;
59                 uint16 logon_count;
60         } netr_UasLogoffInfo;
61
62         WERROR netr_LogonUasLogoff(
63                 [in] [string,charset(UTF16)] uint16 *server_name,
64                 [in] [string,charset(UTF16)] uint16 account_name[],
65                 [in] [string,charset(UTF16)] uint16 workstation[],
66                 [out] netr_UasLogoffInfo info
67                 );
68
69
70         /*****************/
71         /* Function 0x02 */
72
73         /* in netr_AcctLockStr size seems to be be 24, and rrenard thinks 
74            that the structure of the bindata looks like this:
75
76                 dlong  lockout_duration;
77                 udlong reset_count;
78                 uint32 bad_attempt_lockout;
79                 uint32 dummy;   
80
81            but it doesn't look as though this structure is reflected at the
82            NDR level. Maybe it is left to the application to decode the bindata array.
83         */
84         typedef struct {
85                 uint16 size;
86                 uint16 length;
87                 [size_is(size/2),length_is(length/2)] uint16 *bindata;
88         } netr_AcctLockStr;
89
90         typedef [public,bitmap32bit] bitmap {
91                 MSV1_0_CLEARTEXT_PASSWORD_ALLOWED       = 0x00000002,
92                 MSV1_0_UPDATE_LOGON_STATISTICS          = 0x00000004,
93                 MSV1_0_RETURN_USER_PARAMETERS           = 0x00000008,
94                 MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT       = 0x00000020,
95                 MSV1_0_RETURN_PROFILE_PATH              = 0x00000200,
96                 MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT  = 0x00000800
97         } netr_LogonParameterControl;
98
99         typedef struct {
100                 lsa_String  domain_name;
101                 netr_LogonParameterControl parameter_control; /* see MSV1_0_* */
102                 uint32      logon_id_low;
103                 uint32      logon_id_high;
104                 lsa_String  account_name;
105                 lsa_String  workstation;
106         } netr_IdentityInfo;
107
108         typedef struct {
109                 netr_IdentityInfo identity_info;
110                 samr_Password lmpassword;
111                 samr_Password ntpassword;
112         } netr_PasswordInfo;
113
114         typedef [flag(NDR_PAHEX)] struct {
115                 uint16 length;
116                 [value(length)] uint16 size;
117                 [size_is(length),length_is(length)] uint8 *data;
118         } netr_ChallengeResponse;
119
120         typedef [flag(NDR_PAHEX)] struct {
121                 netr_IdentityInfo identity_info;
122                 uint8 challenge[8];
123                 netr_ChallengeResponse nt;
124                 netr_ChallengeResponse lm;
125         } netr_NetworkInfo;
126
127         typedef [public,switch_type(uint16)] union {
128                 [case(1)] netr_PasswordInfo *password;
129                 [case(2)] netr_NetworkInfo  *network;
130                 [case(3)] netr_PasswordInfo *password;
131                 [case(5)] netr_PasswordInfo *password;
132                 [case(6)] netr_NetworkInfo  *network;
133         } netr_LogonLevel;
134
135         typedef [public,flag(NDR_PAHEX)] struct {
136                 uint8 key[16];
137         } netr_UserSessionKey;
138
139         typedef [public,flag(NDR_PAHEX)] struct {
140                 uint8 key[8];
141         } netr_LMSessionKey;
142
143         /* Flags for user_flags below */
144         typedef [public,bitmap32bit] bitmap {
145                 NETLOGON_GUEST                  = 0x0001,
146                 NETLOGON_NOENCRYPTION           = 0x0002,
147                 NETLOGON_CACHED_ACCOUNT         = 0x0004,
148                 NETLOGON_USED_LM_PASSWORD       = 0x0008,
149                 NETLOGON_EXTRA_SIDS             = 0x0020,
150                 NETLOGON_SUBAUTH_SESSION_KEY    = 0x0040,
151                 NETLOGON_SERVER_TRUST_ACCOUNT   = 0x0080,
152                 NETLOGON_NTLMV2_ENABLED         = 0x0100,
153                 NETLOGON_RESOURCE_GROUPS        = 0x0200,
154                 NETLOGON_PROFILE_PATH_RETURNED  = 0x0400
155         } netr_UserFlags;
156
157         typedef struct {
158                 NTTIME last_logon;
159                 NTTIME last_logoff;
160                 NTTIME acct_expiry;
161                 NTTIME last_password_change;
162                 NTTIME allow_password_change;
163                 NTTIME force_password_change;
164                 lsa_String account_name;
165                 lsa_String full_name;
166                 lsa_String logon_script;
167                 lsa_String profile_path;
168                 lsa_String home_directory;
169                 lsa_String home_drive;
170                 uint16 logon_count;
171                 uint16 bad_password_count;
172                 uint32 rid;
173                 uint32 primary_gid;
174                 samr_RidWithAttributeArray groups;
175                 netr_UserFlags user_flags;
176                 netr_UserSessionKey key;
177                 lsa_StringLarge logon_server;
178                 lsa_StringLarge domain;
179                 dom_sid2 *domain_sid;
180                 netr_LMSessionKey LMSessKey;
181                 samr_AcctFlags acct_flags;
182                 uint32 unknown[7];
183         } netr_SamBaseInfo;
184
185         typedef struct {
186                 netr_SamBaseInfo base;
187         } netr_SamInfo2;
188
189         typedef struct {
190                 dom_sid2 *sid;
191                 samr_GroupAttrs attributes;
192         } netr_SidAttr;
193
194         typedef [public] struct {
195                 netr_SamBaseInfo base;
196                 uint32 sidcount;
197                 [size_is(sidcount)] netr_SidAttr *sids;
198         } netr_SamInfo3;
199
200         typedef struct {
201                 netr_SamBaseInfo base;
202                 uint32 sidcount;
203                 [size_is(sidcount)] netr_SidAttr *sids;
204                 lsa_String forest;
205                 lsa_String principle;
206                 uint32 unknown4[20];
207         } netr_SamInfo6;
208
209         typedef struct {
210                 uint32 pac_size;
211                 [size_is(pac_size)] uint8 *pac;
212                 lsa_String logon_domain;
213                 lsa_String logon_server;
214                 lsa_String principal_name;
215                 uint32 auth_size;
216                 [size_is(auth_size)] uint8 *auth;
217                 netr_UserSessionKey user_session_key;
218                 uint32 expansionroom[10];
219                 lsa_String unknown1;
220                 lsa_String unknown2;
221                 lsa_String unknown3;
222                 lsa_String unknown4;
223         } netr_PacInfo;
224
225         typedef [public,switch_type(uint16)] union {
226                 [case(2)] netr_SamInfo2 *sam2;
227                 [case(3)] netr_SamInfo3 *sam3;
228                 [case(4)] netr_PacInfo  *pac;
229                 [case(5)] netr_PacInfo  *pac;
230                 [case(6)] netr_SamInfo6 *sam6;
231         } netr_Validation;
232
233         typedef [public, flag(NDR_PAHEX)] struct {
234                 uint8 data[8];
235         } netr_Credential;
236
237         typedef [public] struct {
238                 netr_Credential cred;
239                 time_t timestamp;
240         } netr_Authenticator;
241
242         NTSTATUS netr_LogonSamLogon(
243                 [in] [string,charset(UTF16)] uint16 *server_name,
244                 [in] [string,charset(UTF16)] uint16 *computer_name,
245                 [in] netr_Authenticator *credential,
246                 [in][out] netr_Authenticator *return_authenticator,
247                 [in]  uint16 logon_level,
248                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
249                 [in]  uint16 validation_level,
250                 [out] [switch_is(validation_level)] netr_Validation validation,
251                 [out] uint8 authoritative
252                 );
253
254
255         /*****************/
256         /* Function 0x03 */
257
258         NTSTATUS netr_LogonSamLogoff(
259                 [in] [string,charset(UTF16)] uint16 *server_name,
260                 [in] [string,charset(UTF16)] uint16 *computer_name,
261                 [in]      netr_Authenticator *credential,
262                 [in][out] netr_Authenticator *return_authenticator,
263                 [in] uint16 logon_level,
264                 [in] [switch_is(logon_level)] netr_LogonLevel logon
265                 );
266         
267
268
269         /*****************/
270         /* Function 0x04 */
271
272         [public] NTSTATUS netr_ServerReqChallenge(
273                 [in,string,charset(UTF16)] uint16 *server_name,
274                 [in,string,charset(UTF16)] uint16 computer_name[],
275                 [in,out,ref] netr_Credential *credentials
276                 );
277
278
279         /*****************/
280         /* Function 0x05 */
281
282         typedef enum netr_SchannelType netr_SchannelType;
283
284         NTSTATUS netr_ServerAuthenticate(
285                 [in,string,charset(UTF16)] uint16 *server_name,
286                 [in,string,charset(UTF16)] uint16 account_name[],
287                 [in]                       netr_SchannelType secure_channel_type,
288                 [in,string,charset(UTF16)] uint16 computer_name[],
289                 [in,out,ref] netr_Credential *credentials
290                 );
291
292
293         /*****************/
294         /* Function 0x06 */
295
296         NTSTATUS netr_ServerPasswordSet(
297                 [in]  [string,charset(UTF16)] uint16 *server_name,
298                 [in]  [string,charset(UTF16)] uint16 account_name[],
299                 [in]  netr_SchannelType secure_channel_type,
300                 [in]  [string,charset(UTF16)] uint16 computer_name[],
301                 [in]  netr_Authenticator credential,
302                 [in]  samr_Password new_password,
303                 [out] netr_Authenticator return_authenticator
304                 );
305
306
307         /*****************/
308         /* Function 0x07 */
309
310         typedef enum netr_SamDatabaseID netr_SamDatabaseID;
311
312         typedef struct {
313                 [string,charset(UTF16)] uint16 *account_name;
314                 lsa_String unknown1;
315                 lsa_String unknown2;
316                 lsa_String unknown3;
317                 lsa_String unknown4;
318                 uint32 unknown5;
319                 uint32 unknown6;
320                 uint32 unknown7;
321                 uint32 unknown8;
322         } netr_DELTA_DELETE_USER;
323
324         typedef struct {
325                 uint16 length;
326                 [value(length)] uint16 size;
327                 uint32 flags;
328                 samr_Password pwd;
329         } netr_USER_KEY16;
330
331         typedef struct {
332                 uint16 nt_length;
333                 [value(nt_length)] uint16 nt_size;
334                 uint32 nt_flags;
335                 uint16 lm_length;
336                 [value(lm_length)] uint16 lm_size;
337                 uint32 lm_flags;
338                 uint8 nt_history[nt_length];
339                 uint8 lm_history[lm_length];
340         } netr_PasswordHistory;
341
342         typedef struct {
343                 netr_USER_KEY16 lmpassword;
344                 netr_USER_KEY16 ntpassword;
345                 netr_PasswordHistory history;
346         } netr_USER_KEYS2;
347
348         typedef struct { /* TODO: make this a union! */
349                 netr_USER_KEYS2 keys2;
350         } netr_USER_KEY_UNION;
351
352         typedef [public] struct {
353                 uint32 version;
354                 netr_USER_KEY_UNION keys;
355         } netr_USER_KEYS;
356
357         typedef struct {
358                 boolean8  SensitiveDataFlag;
359                 uint32 DataLength;
360
361                 /* netr_USER_KEYS encrypted with the session key */
362                 [size_is(DataLength)][flag(NDR_PAHEX)] uint8 *SensitiveData;
363         } netr_USER_PRIVATE_INFO;
364
365         typedef struct {
366                 lsa_String account_name;
367                 lsa_String full_name;
368                 uint32 rid;
369                 uint32 primary_gid;
370                 lsa_String home_directory;
371                 lsa_String home_drive;
372                 lsa_String logon_script;
373                 lsa_String description;
374                 lsa_String workstations;
375                 NTTIME last_logon;
376                 NTTIME last_logoff;
377                 samr_LogonHours logon_hours;
378                 uint16 bad_password_count;
379                 uint16 logon_count;
380                 NTTIME last_password_change;
381                 NTTIME acct_expiry;
382                 samr_AcctFlags acct_flags;
383                 samr_Password lmpassword;
384                 samr_Password ntpassword;
385                 boolean8 nt_password_present;
386                 boolean8 lm_password_present;
387                 boolean8 password_expired;
388                 lsa_String comment;
389                 lsa_String parameters;
390                 uint16 country_code;
391                 uint16 code_page;
392                 netr_USER_PRIVATE_INFO user_private_info;
393                 uint32 SecurityInformation;
394                 sec_desc_buf sdbuf;
395                 lsa_String profile_path;
396                 lsa_String unknown2;
397                 lsa_String unknown3;
398                 lsa_String unknown4;
399                 uint32 unknown5;
400                 uint32 unknown6;
401                 uint32 unknown7;
402                 uint32 unknown8;
403         } netr_DELTA_USER;
404
405         typedef struct {
406                 lsa_String domain_name;
407                 lsa_String comment;
408                 dlong force_logoff_time;
409                 uint16 min_password_length;
410                 uint16 password_history_length;
411                 /* yes, these are signed. They are in negative 100ns */
412                 dlong  max_password_age;
413                 dlong  min_password_age;
414                 udlong sequence_num;
415                 NTTIME domain_create_time;
416                 uint32 SecurityInformation;
417                 sec_desc_buf sdbuf;
418                 netr_AcctLockStr account_lockout;
419                 lsa_String unknown2;
420                 lsa_String unknown3;
421                 lsa_String unknown4;
422                 uint32 logon_to_chgpass;
423                 uint32 unknown6;
424                 uint32 unknown7;
425                 uint32 unknown8;
426         } netr_DELTA_DOMAIN;
427
428         typedef struct {
429                 lsa_String group_name;
430                 uint32 rid;
431                 uint32 attributes;
432                 lsa_String description;
433                 uint32 SecurityInformation;
434                 sec_desc_buf sdbuf;
435                 lsa_String unknown1;
436                 lsa_String unknown2;
437                 lsa_String unknown3;
438                 lsa_String unknown4;
439                 uint32 unknown5;
440                 uint32 unknown6;
441                 uint32 unknown7;
442                 uint32 unknown8;
443         } netr_DELTA_GROUP;
444
445         typedef struct {
446                 lsa_String OldName;
447                 lsa_String NewName;
448                 lsa_String unknown1;
449                 lsa_String unknown2;
450                 lsa_String unknown3;
451                 lsa_String unknown4;
452                 uint32 unknown5;
453                 uint32 unknown6;
454                 uint32 unknown7;
455                 uint32 unknown8;
456         } netr_DELTA_RENAME;
457
458         typedef struct {
459                 [size_is(num_rids)] uint32 *rids;
460                 [size_is(num_rids)] uint32 *attribs;
461                 uint32 num_rids;
462                 uint32 unknown1;
463                 uint32 unknown2;
464                 uint32 unknown3;
465                 uint32 unknown4;
466         } netr_DELTA_GROUP_MEMBER;
467
468         typedef struct {
469                 lsa_String alias_name;
470                 uint32 rid;
471                 uint32 SecurityInformation;
472                 sec_desc_buf sdbuf;
473                 lsa_String description;
474                 lsa_String unknown2;
475                 lsa_String unknown3;
476                 lsa_String unknown4;
477                 uint32 unknown5;
478                 uint32 unknown6;
479                 uint32 unknown7;
480                 uint32 unknown8;
481         } netr_DELTA_ALIAS;
482
483         typedef struct {
484                 lsa_SidArray sids;
485                 uint32 unknown1;
486                 uint32 unknown2;
487                 uint32 unknown3;
488                 uint32 unknown4;
489         } netr_DELTA_ALIAS_MEMBER;
490
491         typedef struct {
492                 uint32 pagedpoollimit;
493                 uint32 nonpagedpoollimit;
494                 uint32 minimumworkingsetsize;
495                 uint32 maximumworkingsetsize;
496                 uint32 pagefilelimit;
497                 NTTIME timelimit;
498         } netr_QUOTA_LIMITS;
499
500         typedef struct {
501                 uint32 maxlogsize;
502                 NTTIME auditretentionperiod;
503                 boolean8 auditingmode;
504                 uint32 maxauditeventcount;
505                 [size_is(maxauditeventcount+1)] uint32 *eventauditoptions;
506                 lsa_String primary_domain_name;
507                 dom_sid2 *sid;
508                 netr_QUOTA_LIMITS quota_limits;
509                 udlong sequence_num;
510                 NTTIME db_create_time;
511                 uint32 SecurityInformation;
512                 sec_desc_buf sdbuf;
513                 lsa_String unknown1;
514                 lsa_String unknown2;
515                 lsa_String unknown3;
516                 lsa_String unknown4;
517                 uint32 unknown5;
518                 uint32 unknown6;
519                 uint32 unknown7;
520                 uint32 unknown8;
521         } netr_DELTA_POLICY;
522
523         typedef struct {
524                 lsa_String domain_name;
525                 uint32 num_controllers;
526                 [size_is(num_controllers)] lsa_String *controller_names;
527                 uint32 SecurityInformation;
528                 sec_desc_buf sdbuf;
529                 lsa_String unknown1;
530                 lsa_String unknown2;
531                 lsa_String unknown3;
532                 lsa_String unknown4;
533                 uint32 posix_offset;
534                 uint32 unknown6;
535                 uint32 unknown7;
536                 uint32 unknown8;
537         } netr_DELTA_TRUSTED_DOMAIN;
538
539         typedef struct {
540                 uint16 unknown;
541         } netr_DELTA_DELETE_TRUST;
542
543         typedef struct {
544                 uint32 privilege_entries;
545                 uint32 privilege_control;
546                 [size_is(privilege_entries)] uint32 *privilege_attrib;
547                 [size_is(privilege_entries)] lsa_String *privilege_name;
548                 netr_QUOTA_LIMITS quotalimits;
549                 uint32 system_flags;
550                 uint32 SecurityInformation;
551                 sec_desc_buf sdbuf;
552                 lsa_String unknown1;
553                 lsa_String unknown2;
554                 lsa_String unknown3;
555                 lsa_String unknown4;
556                 uint32 unknown5;
557                 uint32 unknown6;
558                 uint32 unknown7;
559                 uint32 unknown8;
560         } netr_DELTA_ACCOUNT;
561
562         typedef struct {
563                 uint16 unknown;
564         } netr_DELTA_DELETE_ACCOUNT;
565
566         typedef struct {
567                 uint16 unknown;
568         } netr_DELTA_DELETE_SECRET;
569
570         typedef struct {
571                 uint32 len;
572                 uint32 maxlen;
573                 [size_is(maxlen)][length_is(len)] uint8 *cipher_data;
574         } netr_CIPHER_VALUE;
575
576         typedef struct {
577                 netr_CIPHER_VALUE current_cipher;
578                 NTTIME current_cipher_set_time;
579                 netr_CIPHER_VALUE old_cipher;
580                 NTTIME old_cipher_set_time;
581                 uint32 SecurityInformation;
582                 sec_desc_buf sdbuf;
583                 lsa_String unknown1;
584                 lsa_String unknown2;
585                 lsa_String unknown3;
586                 lsa_String unknown4;
587                 uint32 unknown5;
588                 uint32 unknown6;
589                 uint32 unknown7;
590                 uint32 unknown8;
591         } netr_DELTA_SECRET;
592
593         typedef enum {
594                 NETR_DELTA_DOMAIN           = 1,
595                 NETR_DELTA_GROUP            = 2,
596                 NETR_DELTA_DELETE_GROUP     = 3,
597                 NETR_DELTA_RENAME_GROUP     = 4,
598                 NETR_DELTA_USER             = 5,
599                 NETR_DELTA_DELETE_USER      = 6,
600                 NETR_DELTA_RENAME_USER      = 7,
601                 NETR_DELTA_GROUP_MEMBER     = 8,
602                 NETR_DELTA_ALIAS            = 9,
603                 NETR_DELTA_DELETE_ALIAS     = 10,
604                 NETR_DELTA_RENAME_ALIAS     = 11,
605                 NETR_DELTA_ALIAS_MEMBER     = 12,
606                 NETR_DELTA_POLICY           = 13,
607                 NETR_DELTA_TRUSTED_DOMAIN   = 14,
608                 NETR_DELTA_DELETE_TRUST     = 15,
609                 NETR_DELTA_ACCOUNT          = 16,
610                 NETR_DELTA_DELETE_ACCOUNT   = 17,
611                 NETR_DELTA_SECRET           = 18,
612                 NETR_DELTA_DELETE_SECRET    = 19,
613                 NETR_DELTA_DELETE_GROUP2    = 20,
614                 NETR_DELTA_DELETE_USER2     = 21,
615                 NETR_DELTA_MODIFY_COUNT     = 22
616         } netr_DeltaEnum;
617
618         typedef [switch_type(netr_DeltaEnum)] union {
619                 [case(NETR_DELTA_DOMAIN)]          netr_DELTA_DOMAIN          *domain;
620                 [case(NETR_DELTA_GROUP)]           netr_DELTA_GROUP           *group;
621                 [case(NETR_DELTA_DELETE_GROUP)]    ; /* rid only */
622                 [case(NETR_DELTA_RENAME_GROUP)]    netr_DELTA_RENAME          *rename_group;
623                 [case(NETR_DELTA_USER)]            netr_DELTA_USER            *user;
624                 [case(NETR_DELTA_DELETE_USER)]     ; /* rid only */
625                 [case(NETR_DELTA_RENAME_USER)]     netr_DELTA_RENAME          *rename_user;
626                 [case(NETR_DELTA_GROUP_MEMBER)]    netr_DELTA_GROUP_MEMBER    *group_member;
627                 [case(NETR_DELTA_ALIAS)]           netr_DELTA_ALIAS           *alias;
628                 [case(NETR_DELTA_DELETE_ALIAS)]    ; /* rid only */
629                 [case(NETR_DELTA_RENAME_ALIAS)]    netr_DELTA_RENAME          *rename_alias;
630                 [case(NETR_DELTA_ALIAS_MEMBER)]    netr_DELTA_ALIAS_MEMBER    *alias_member;
631                 [case(NETR_DELTA_POLICY)]          netr_DELTA_POLICY          *policy;
632                 [case(NETR_DELTA_TRUSTED_DOMAIN)]  netr_DELTA_TRUSTED_DOMAIN   *trusted_domain;
633                 [case(NETR_DELTA_DELETE_TRUST)]    netr_DELTA_DELETE_TRUST     delete_trust;
634                 [case(NETR_DELTA_ACCOUNT)]         netr_DELTA_ACCOUNT         *account;
635                 [case(NETR_DELTA_DELETE_ACCOUNT)]  netr_DELTA_DELETE_ACCOUNT   delete_account;
636                 [case(NETR_DELTA_SECRET)]          netr_DELTA_SECRET          *secret;
637                 [case(NETR_DELTA_DELETE_SECRET)]   netr_DELTA_DELETE_SECRET    delete_secret;
638                 [case(NETR_DELTA_DELETE_GROUP2)]   netr_DELTA_DELETE_USER     *delete_group;
639                 [case(NETR_DELTA_DELETE_USER2)]    netr_DELTA_DELETE_USER     *delete_user;
640                 [case(NETR_DELTA_MODIFY_COUNT)]    udlong                     *modified_count;
641         } netr_DELTA_UNION;
642
643         typedef [switch_type(netr_DeltaEnum)] union {
644                 [case(NETR_DELTA_DOMAIN)]          uint32 rid;
645                 [case(NETR_DELTA_GROUP)]           uint32 rid;
646                 [case(NETR_DELTA_DELETE_GROUP)]    uint32 rid;
647                 [case(NETR_DELTA_RENAME_GROUP)]    uint32 rid;
648                 [case(NETR_DELTA_USER)]            uint32 rid;
649                 [case(NETR_DELTA_DELETE_USER)]     uint32 rid;
650                 [case(NETR_DELTA_RENAME_USER)]     uint32 rid;
651                 [case(NETR_DELTA_GROUP_MEMBER)]    uint32 rid;
652                 [case(NETR_DELTA_ALIAS)]           uint32 rid;
653                 [case(NETR_DELTA_DELETE_ALIAS)]    uint32 rid;
654                 [case(NETR_DELTA_RENAME_ALIAS)]    uint32 rid;
655                 [case(NETR_DELTA_ALIAS_MEMBER)]    uint32 rid;
656                 [case(NETR_DELTA_POLICY)]          dom_sid2 *sid;
657                 [case(NETR_DELTA_TRUSTED_DOMAIN)]  dom_sid2 *sid;
658                 [case(NETR_DELTA_DELETE_TRUST)]    dom_sid2 *sid;
659                 [case(NETR_DELTA_ACCOUNT)]         dom_sid2 *sid;
660                 [case(NETR_DELTA_DELETE_ACCOUNT)]  dom_sid2 *sid;
661                 [case(NETR_DELTA_SECRET)]          [string,charset(UTF16)] uint16 *name;
662                 [case(NETR_DELTA_DELETE_SECRET)]   [string,charset(UTF16)] uint16 *name;
663                 [case(NETR_DELTA_DELETE_GROUP2)]   uint32 rid;
664                 [case(NETR_DELTA_DELETE_USER2)]    uint32 rid;
665                 [case(NETR_DELTA_MODIFY_COUNT)]    ;
666         } netr_DELTA_ID_UNION;
667
668         typedef struct {
669                 netr_DeltaEnum delta_type;
670                 [switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union;
671                 [switch_is(delta_type)] netr_DELTA_UNION delta_union;
672         } netr_DELTA_ENUM;
673
674         typedef struct {
675                 uint32 num_deltas;
676                 [size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
677         } netr_DELTA_ENUM_ARRAY;
678
679
680         NTSTATUS netr_DatabaseDeltas(
681                 [in]      [string,charset(UTF16)] uint16 logon_server[],
682                 [in]      [string,charset(UTF16)] uint16 computername[],
683                 [in]      netr_Authenticator credential,
684                 [in,out]  netr_Authenticator return_authenticator,
685                 [in]      netr_SamDatabaseID database_id,
686                 [in,out]  udlong sequence_num,
687                 [in]      uint32 preferredmaximumlength,
688                 [out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
689                 );
690
691
692         /*****************/
693         /* Function 0x08 */
694
695         NTSTATUS netr_DatabaseSync(
696                 [in]     [string,charset(UTF16)] uint16 logon_server[],
697                 [in]     [string,charset(UTF16)] uint16 computername[],
698                 [in]     netr_Authenticator credential,
699                 [in,out] netr_Authenticator return_authenticator,
700                 [in]     netr_SamDatabaseID database_id,
701                 [in,out] uint32 sync_context,
702                 [in]     uint32 preferredmaximumlength,
703                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
704                 );
705
706
707         /*****************/
708         /* Function 0x09 */
709
710         /* w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this call */
711
712         typedef [flag(NDR_PAHEX)] struct {
713                 uint8 computer_name[16];
714                 uint32 timecreated;
715                 uint32 serial_number;
716         } netr_UAS_INFO_0;
717
718         typedef struct {
719                 [flag(NDR_REMAINING)] DATA_BLOB blob;
720         } netr_AccountBuffer;
721
722         NTSTATUS netr_AccountDeltas(
723                 [in]     [string,charset(UTF16)] uint16 *logon_server,
724                 [in]     [string,charset(UTF16)] uint16 computername[],
725                 [in]     netr_Authenticator credential,
726                 [in,out] netr_Authenticator return_authenticator,
727                 [in]     netr_UAS_INFO_0 uas,
728                 [in]     uint32 count,
729                 [in]     uint32 level,
730                 [in]     uint32 buffersize,
731                 [out,subcontext(4)] netr_AccountBuffer buffer,
732                 [out]    uint32 count_returned,
733                 [out]    uint32 total_entries,
734                 [out]    netr_UAS_INFO_0 recordid
735                 );
736
737
738         /*****************/
739         /* Function 0x0A */
740
741         NTSTATUS netr_AccountSync(
742                 [in]      [string,charset(UTF16)] uint16 *logon_server,
743                 [in]      [string,charset(UTF16)] uint16 computername[],
744                 [in]      netr_Authenticator credential,
745                 [in,out]  netr_Authenticator return_authenticator,
746                 [in]      uint32 reference,
747                 [in]      uint32 level,
748                 [in]      uint32 buffersize,
749                 [out,subcontext(4)] netr_AccountBuffer buffer,
750                 [out]     uint32 count_returned,
751                 [out]     uint32 total_entries,
752                 [out]     uint32 next_reference,
753                 [in,out]  netr_UAS_INFO_0 recordid
754                 );
755
756
757         /*****************/
758         /* Function 0x0B */
759
760         WERROR netr_GetDcName(
761                 [in]  [string,charset(UTF16)] uint16 logon_server[],
762                 [in]  [string,charset(UTF16)] uint16 *domainname,
763                 [out] [string,charset(UTF16)] uint16 *dcname
764                 );
765
766         /*****************/
767         /* Function 0x0C */
768
769         typedef struct {
770                 uint32 flags;
771                 uint32 pdc_connection_status;
772         } netr_NETLOGON_INFO_1;
773
774         typedef struct {
775                 uint32 flags;
776                 uint32 pdc_connection_status;
777                 [string,charset(UTF16)] uint16 trusted_dc_name[];
778                 uint32 tc_connection_status;
779         } netr_NETLOGON_INFO_2;
780
781         typedef struct {
782                 uint32 flags;
783                 uint32 logon_attempts;
784                 uint32 unknown1;
785                 uint32 unknown2;
786                 uint32 unknown3;
787                 uint32 unknown4;
788                 uint32 unknown5;
789         } netr_NETLOGON_INFO_3;
790
791         typedef union {
792                 [case(1)]  netr_NETLOGON_INFO_1 *info1;
793                 [case(2)]  netr_NETLOGON_INFO_2 *info2;
794                 [case(3)]  netr_NETLOGON_INFO_3 *info3;
795         } netr_CONTROL_QUERY_INFORMATION;
796
797         /* function_code values */
798         typedef [v1_enum] enum {
799                 NETLOGON_CONTROL_REDISCOVER       = 5,
800                 NETLOGON_CONTROL_TC_QUERY         = 6,
801                 NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7,
802                 NETLOGON_CONTROL_SET_DBFLAG       = 65534
803         } netr_LogonControlCode;
804
805         WERROR netr_LogonControl(
806                 [in]   [string,charset(UTF16)] uint16 *logon_server,
807                 [in]   netr_LogonControlCode function_code,
808                 [in]   uint32 level,
809                 [out,switch_is(level)]  netr_CONTROL_QUERY_INFORMATION info
810                 );
811
812
813         /*****************/
814         /* Function 0x0D */
815
816         WERROR netr_GetAnyDCName(
817                 [in]  [string,charset(UTF16)] uint16 *logon_server,
818                 [in]  [string,charset(UTF16)] uint16 *domainname,
819                 [out] [string,charset(UTF16)] uint16 *dcname
820                 );
821
822
823         /*****************/
824         /* Function 0x0E */
825
826         typedef union {
827                 [case(NETLOGON_CONTROL_REDISCOVER)]        [string,charset(UTF16)] uint16 *domain;
828                 [case(NETLOGON_CONTROL_TC_QUERY)]          [string,charset(UTF16)] uint16 *domain;
829                 [case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)]  [string,charset(UTF16)] uint16 *domain;
830                 [case(NETLOGON_CONTROL_SET_DBFLAG)]        uint32 debug_level;
831         } netr_CONTROL_DATA_INFORMATION;
832
833         WERROR netr_LogonControl2(
834                 [in]    [string,charset(UTF16)] uint16 *logon_server,
835                 [in]    uint32 function_code,
836                 [in]    uint32 level,
837                 [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
838                 [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
839                 );
840
841
842         /* If this flag is not set, then the passwords and LM session keys are
843          * encrypted with DES calls.  (And the user session key is
844          * unencrypted) */ 
845         const int NETLOGON_NEG_ARCFOUR  = 0x00000004;
846         const int NETLOGON_NEG_128BIT   = 0x00004000;
847         const int NETLOGON_NEG_SCHANNEL = 0x40000000;
848
849         /*****************/
850         /* Function 0x0F */
851
852         NTSTATUS netr_ServerAuthenticate2(
853                 [in]         [string,charset(UTF16)] uint16 *server_name,
854                 [in]         [string,charset(UTF16)] uint16 account_name[],
855                 [in]         netr_SchannelType secure_channel_type,
856                 [in]         [string,charset(UTF16)] uint16 computer_name[],
857                 [in,out,ref] netr_Credential *credentials,
858                 [in,out,ref] uint32 *negotiate_flags
859                 );
860
861
862         /*****************/
863         /* Function 0x10 */
864
865         NTSTATUS netr_DatabaseSync2(
866                 [in]     [string,charset(UTF16)] uint16 logon_server[],
867                 [in]     [string,charset(UTF16)] uint16 computername[],
868                 [in]     netr_Authenticator credential,
869                 [in,out] netr_Authenticator return_authenticator,
870                 [in]     netr_SamDatabaseID database_id,
871                 [in]     uint16 restart_state,
872                 [in,out] uint32 sync_context,
873                 [in]     uint32 preferredmaximumlength,
874                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
875                 );
876
877
878         /*****************/
879         /* Function 0x11 */
880
881         /* i'm not at all sure how this call works */
882
883         NTSTATUS netr_DatabaseRedo(
884                 [in]     [string,charset(UTF16)] uint16 logon_server[],
885                 [in]     [string,charset(UTF16)] uint16 computername[],
886                 [in]     netr_Authenticator credential,
887                 [in,out] netr_Authenticator return_authenticator,
888                 [in][size_is(change_log_entry_size)] uint8 *change_log_entry,
889                 [in]     uint32 change_log_entry_size,
890                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
891                 );
892
893
894         /*****************/
895         /* Function 0x12 */
896
897         WERROR netr_LogonControl2Ex(
898                 [in]   [string,charset(UTF16)] uint16 *logon_server,
899                 [in]   uint32 function_code,
900                 [in]   uint32 level,
901                 [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
902                 [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
903                 );
904
905         /*****************/
906         /* Function 0x13 */
907         typedef struct {
908                 uint32 length;
909                 [size_is(length)] uint8 *data;
910         } netr_Blob;
911
912         WERROR netr_NetrEnumerateTrustedDomains(
913                 [in] [string,charset(UTF16)] uint16 *server_name,
914                 [out,ref] netr_Blob *trusted_domains_blob
915                 );
916
917         /*****************/
918         /* Function 0x14 */
919
920         /* two unkown bits still: DS_IP_VERSION_AGNOSTIC and
921          * DS_TRY_NEXTCLOSEST_SITE - Guenther */
922
923         typedef [bitmap32bit] bitmap {
924                 DS_FORCE_REDISCOVERY            = 0x00000001,
925                 DS_DIRECTORY_SERVICE_REQUIRED   = 0x00000010,
926                 DS_DIRECTORY_SERVICE_PREFERRED  = 0x00000020,
927                 DS_GC_SERVER_REQUIRED           = 0x00000040,
928                 DS_PDC_REQUIRED                 = 0x00000080,
929                 DS_BACKGROUND_ONLY              = 0x00000100,
930                 DS_IP_REQUIRED                  = 0x00000200,
931                 DS_KDC_REQUIRED                 = 0x00000400,
932                 DS_TIMESERV_REQUIRED            = 0x00000800,
933                 DS_WRITABLE_REQUIRED            = 0x00001000,
934                 DS_GOOD_TIMESERV_PREFERRED      = 0x00002000,
935                 DS_AVOID_SELF                   = 0x00004000,
936                 DS_ONLY_LDAP_NEEDED             = 0x00008000,
937                 DS_IS_FLAT_NAME                 = 0x00010000,
938                 DS_IS_DNS_NAME                  = 0x00020000,
939                 DS_RETURN_DNS_NAME              = 0x40000000,
940                 DS_RETURN_FLAT_NAME             = 0x80000000
941         } netr_DsRGetDCName_flags;
942
943         typedef [v1_enum] enum {
944                 DS_ADDRESS_TYPE_INET            = 1,
945                 DS_ADDRESS_TYPE_NETBIOS         = 2
946         } netr_DsRGetDCNameInfo_AddressType;
947
948         typedef [bitmap32bit] bitmap {
949                 DS_SERVER_PDC            = NBT_SERVER_PDC,
950                 DS_SERVER_GC             = NBT_SERVER_GC,
951                 DS_SERVER_LDAP           = NBT_SERVER_LDAP,
952                 DS_SERVER_DS             = NBT_SERVER_DS,
953                 DS_SERVER_KDC            = NBT_SERVER_KDC,
954                 DS_SERVER_TIMESERV       = NBT_SERVER_TIMESERV,
955                 DS_SERVER_CLOSEST        = NBT_SERVER_CLOSEST,
956                 DS_SERVER_WRITABLE       = NBT_SERVER_WRITABLE,
957                 DS_SERVER_GOOD_TIMESERV  = NBT_SERVER_GOOD_TIMESERV,
958                 DS_SERVER_NDNC           = 0x00000400,
959                 DS_DNS_CONTROLLER        = 0x20000000,
960                 DS_DNS_DOMAIN            = 0x40000000,
961                 DS_DNS_FOREST            = 0x80000000
962         } netr_DsR_DcFlags;
963
964         typedef struct {
965                 [string,charset(UTF16)] uint16 *dc_unc;
966                 [string,charset(UTF16)] uint16 *dc_address;
967                 netr_DsRGetDCNameInfo_AddressType dc_address_type;
968                 GUID domain_guid;
969                 [string,charset(UTF16)] uint16 *domain_name;
970                 [string,charset(UTF16)] uint16 *forest_name;
971                 netr_DsR_DcFlags dc_flags;
972                 [string,charset(UTF16)] uint16 *dc_site_name;
973                 [string,charset(UTF16)] uint16 *client_site_name;
974         } netr_DsRGetDCNameInfo;
975
976         WERROR netr_DsRGetDCName(
977                 [in] [string,charset(UTF16)] uint16 *server_unc,
978                 [in] [string,charset(UTF16)] uint16 *domain_name,
979                 [in] GUID *domain_guid,
980                 [in] GUID *site_guid,
981                 [in] netr_DsRGetDCName_flags flags,
982                 [out] netr_DsRGetDCNameInfo *info
983                 );
984
985         /*****************/
986         /* Function 0x15 */
987         WERROR netr_NETRLOGONDUMMYROUTINE1();
988
989         /****************/
990         /* Function 0x16 */
991         WERROR netr_NETRLOGONSETSERVICEBITS();
992
993         /****************/
994         /* Function 0x17 */
995         WERROR netr_LogonGetTrustRid(
996                 [in] [string,charset(UTF16)] uint16 *server_name,
997                 [in] [string,charset(UTF16)] uint16 *domain_name,
998                 [out,ref] uint32 *rid
999         );
1000
1001         /****************/
1002         /* Function 0x18 */
1003         WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
1004
1005         /****************/
1006         /* Function 0x19 */
1007         WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
1008
1009         /****************/
1010         /* Function 0x1a */
1011         [public] NTSTATUS netr_ServerAuthenticate3(
1012                 [in]         [string,charset(UTF16)] uint16 *server_name,
1013                 [in]         [string,charset(UTF16)] uint16 account_name[],
1014                 [in]         netr_SchannelType secure_channel_type,
1015                 [in]         [string,charset(UTF16)] uint16 computer_name[],
1016                 [in,out,ref] netr_Credential *credentials,
1017                 [in,out,ref] uint32 *negotiate_flags,
1018                 [out,ref]    uint32 *rid
1019                 );
1020
1021         /****************/
1022         /* Function 0x1b */
1023
1024         WERROR netr_DsRGetDCNameEx(
1025                 [in] [string,charset(UTF16)] uint16 *server_unc,
1026                 [in] [string,charset(UTF16)] uint16 *domain_name,
1027                 [in] GUID *domain_guid,
1028                 [in] [string,charset(UTF16)] uint16 *site_name,
1029                 [in] netr_DsRGetDCName_flags flags,
1030                 [out] netr_DsRGetDCNameInfo *info
1031                 );
1032
1033         /****************/
1034         /* Function 0x1c */
1035         WERROR netr_DsRGetSiteName(
1036                 [in] [string,charset(UTF16)] uint16 *computer_name,
1037                 [out] [string,charset(UTF16)] uint16 *site
1038                 );
1039
1040         /****************/
1041         /* Function 0x1d */
1042
1043         typedef [flag(NDR_PAHEX)] struct {
1044                 uint16 length;
1045                 uint16 size;
1046                 [size_is(size/2),length_is(length/2)] uint16 *data;
1047         } netr_BinaryString;
1048
1049         typedef struct {
1050                 netr_Blob blob;
1051                 [string,charset(UTF16)] uint16 *workstation_domain;
1052                 [string,charset(UTF16)] uint16 *workstation_site;
1053                 [string,charset(UTF16)] uint16 *unknown1;
1054                 [string,charset(UTF16)] uint16 *unknown2;
1055                 [string,charset(UTF16)] uint16 *unknown3;
1056                 [string,charset(UTF16)] uint16 *unknown4;
1057                 netr_BinaryString blob2;
1058                 lsa_String product;
1059                 lsa_String unknown5;
1060                 lsa_String unknown6;
1061                 uint32 unknown7[4];
1062         } netr_DomainQuery1;
1063
1064         typedef union {
1065                 [case(1)] netr_DomainQuery1 *query1;
1066                 [case(2)] netr_DomainQuery1 *query1;
1067         } netr_DomainQuery;
1068
1069         typedef struct {
1070                 lsa_String domainname;
1071                 lsa_String fulldomainname;
1072                 lsa_String forest;
1073                 GUID        guid;
1074                 dom_sid2    *sid;
1075                 netr_BinaryString unknown1[4];
1076                 uint32      unknown[4];
1077         } netr_DomainTrustInfo;
1078
1079         typedef struct {
1080                 netr_DomainTrustInfo domaininfo;
1081                 uint32 num_trusts;
1082                 [size_is(num_trusts)] netr_DomainTrustInfo *trusts;
1083                 uint32 unknown[14]; /* room for expansion? */
1084         } netr_DomainInfo1;
1085
1086         typedef union {
1087                 [case(1)] netr_DomainInfo1 *info1;
1088                 [case(2)] netr_DomainInfo1 *info1;
1089         } netr_DomainInfo;
1090         
1091         NTSTATUS netr_LogonGetDomainInfo(
1092                 [in]         [string,charset(UTF16)] uint16 server_name[],
1093                 [in]         [string,charset(UTF16)] uint16 *computer_name,
1094                 [in,ref]     netr_Authenticator *credential,
1095                 [in,out,ref] netr_Authenticator *return_authenticator,
1096                 [in]         uint32 level,
1097                 [in,switch_is(level)] netr_DomainQuery query,
1098                 [out,switch_is(level)] netr_DomainInfo info
1099                 );
1100
1101         typedef [flag(NDR_PAHEX)] struct {
1102                 uint8 data[512];
1103                 uint32 length;
1104         } netr_CryptPassword;
1105
1106         /*****************/
1107         /* Function 0x1e */
1108         NTSTATUS netr_ServerPasswordSet2(
1109                 [in]  [string,charset(UTF16)] uint16 *server_name,
1110                 [in]  [string,charset(UTF16)] uint16 account_name[],
1111                 [in]  netr_SchannelType secure_channel_type,
1112                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1113                 [in]  netr_Authenticator credential,
1114                 [in]  netr_CryptPassword new_password,
1115                 [out] netr_Authenticator return_authenticator
1116                 );
1117
1118         /****************/
1119         /* Function 0x1f */
1120         WERROR netr_ServerPasswordGet(
1121                 [in]  [string,charset(UTF16)] uint16 *server_name,
1122                 [in]  [string,charset(UTF16)] uint16 account_name[],
1123                 [in]  netr_SchannelType secure_channel_type,
1124                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1125                 [in,ref] netr_Authenticator *credential,
1126                 [out,ref] netr_Authenticator *return_authenticator,
1127                 [out,ref] samr_Password *password
1128                 );
1129
1130         /****************/
1131         /* Function 0x20 */
1132         WERROR netr_NETRLOGONSENDTOSAM();
1133
1134         /****************/
1135         /* Function 0x21 */
1136         typedef struct {
1137                 uint32 count;
1138                 [size_is(count)] lsa_String *sitename;
1139         } netr_DsRAddressToSitenamesWCtr;
1140
1141         typedef struct {
1142                 [size_is(size)] uint8 *buffer;
1143                 uint32 size;
1144         } netr_DsRAddress;
1145
1146         WERROR netr_DsRAddressToSitenamesW(
1147                 [in] [string,charset(UTF16)] uint16 *server_name,
1148                 [in] [range(0,32000)] uint32 count,
1149                 [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
1150                 [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr
1151                 );
1152
1153         /****************/
1154         /* Function 0x22 */
1155         WERROR netr_DsRGetDCNameEx2(
1156                 [in] [string,charset(UTF16)] uint16 *server_unc,
1157                 [in] [string,charset(UTF16)] uint16 *client_account,
1158                 [in] samr_AcctFlags mask,
1159                 [in] [string,charset(UTF16)] uint16 *domain_name,
1160                 [in] GUID *domain_guid,
1161                 [in] [string,charset(UTF16)] uint16 *site_name,
1162                 [in] netr_DsRGetDCName_flags flags,
1163                 [out] netr_DsRGetDCNameInfo *info
1164                 );
1165
1166         /****************/
1167         /* Function 0x23 */
1168         WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
1169
1170         /****************/
1171         /* Function 0x24 */
1172         typedef [bitmap32bit] bitmap {
1173                 NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
1174                 NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
1175                 NETR_TRUST_FLAG_TREEROOT  = 0x00000004,
1176                 NETR_TRUST_FLAG_PRIMARY   = 0x00000008,
1177                 NETR_TRUST_FLAG_NATIVE    = 0x00000010,
1178                 NETR_TRUST_FLAG_INBOUND   = 0x00000020
1179         } netr_TrustFlags;
1180
1181         typedef [v1_enum] enum {
1182                 NETR_TRUST_TYPE_DOWNLEVEL       = 1,
1183                 NETR_TRUST_TYPE_UPLEVEL         = 2,
1184                 NETR_TRUST_TYPE_MIT             = 3,
1185                 NETR_TRUST_TYPE_DCE             = 4
1186         } netr_TrustType;
1187
1188         typedef [bitmap32bit] bitmap {
1189                 NETR_TRUST_ATTRIBUTE_NON_TRANSITIVE     = 0x00000001,
1190                 NETR_TRUST_ATTRIBUTE_UPLEVEL_ONLY       = 0x00000002,
1191                 NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
1192                 NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE  = 0x00000008,
1193                 NETR_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
1194                 NETR_TRUST_ATTRIBUTE_WITHIN_FOREST      = 0x00000020,
1195                 NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL  = 0x00000040
1196         } netr_TrustAttributes;
1197
1198         typedef struct {
1199                 [string,charset(UTF16)] uint16                  *netbios_name;
1200                 [string,charset(UTF16)] uint16                  *dns_name;
1201                 netr_TrustFlags         trust_flags;
1202                 uint32                  parent_index;
1203                 netr_TrustType          trust_type;
1204                 netr_TrustAttributes    trust_attributes;
1205                 dom_sid2                *sid;
1206                 GUID                    guid;
1207         } netr_DomainTrust;
1208
1209         typedef struct {
1210                 uint32 count;
1211                 [size_is(count)] netr_DomainTrust *array;
1212         } netr_DomainTrustList;
1213
1214         WERROR netr_NetrEnumerateTrustedDomainsEx(
1215                 [in] [string,charset(UTF16)] uint16 *server_name,
1216                 [out,ref] netr_DomainTrustList *dom_trust_list
1217         );
1218
1219         /****************/
1220         /* Function 0x25 */
1221         typedef struct {
1222                 uint32 count;
1223                 [size_is(count)] lsa_String *sitename;
1224                 [size_is(count)] lsa_String *subnetname;
1225         } netr_DsRAddressToSitenamesExWCtr;
1226
1227         WERROR netr_DsRAddressToSitenamesExW(
1228                 [in] [string,charset(UTF16)] uint16 *server_name,
1229                 [in] [range(0,32000)] uint32 count,
1230                 [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
1231                 [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr
1232                 );
1233
1234         /****************/
1235         /* Function 0x26 */
1236
1237         typedef struct {
1238                 uint32 num_sites;
1239                 [size_is(num_sites)] [unique] lsa_String *sites;
1240         } DcSitesCtr;
1241
1242         WERROR netr_DsrGetDcSiteCoverageW(
1243                 [in] [string,charset(UTF16)] uint16 *server_name,
1244                 [out] DcSitesCtr *ctr
1245                 );
1246
1247         /****************/
1248         /* Function 0x27 */
1249         NTSTATUS netr_LogonSamLogonEx(
1250                 [in] [string,charset(UTF16)] uint16 *server_name,
1251                 [in] [string,charset(UTF16)] uint16 *computer_name,
1252                 [in]  uint16 logon_level,
1253                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1254                 [in]  uint16 validation_level,
1255                 [out] [switch_is(validation_level)] netr_Validation validation,
1256                 [out] uint8 authoritative,
1257                 [in,out] uint32 flags
1258                 );
1259
1260         /****************/
1261         /* Function 0x28 */
1262
1263         WERROR netr_DsrEnumerateDomainTrusts(
1264                 [in]                 [string,charset(UTF16)] uint16           *server_name,
1265                 [in]                 netr_TrustFlags  trust_flags,
1266                 [out]                uint32           count,
1267                 [out,size_is(count)] netr_DomainTrust *trusts
1268                 );
1269
1270
1271         /****************/
1272         /* Function 0x29 */
1273         WERROR netr_DsrDeregisterDNSHostRecords(
1274                 [in] [string,charset(UTF16)] uint16 *server_name,
1275                 [in] [string,charset(UTF16)] uint16 *domain,
1276                 [in] GUID *domain_guid,
1277                 [in] GUID *dsa_guid,
1278                 [in,ref] [string,charset(UTF16)] uint16 *dns_host
1279                 );
1280
1281         /****************/
1282         /* Function 0x2a */
1283         NTSTATUS netr_ServerTrustPasswordsGet(
1284                 [in]  [string,charset(UTF16)] uint16 *server_name,
1285                 [in]  [string,charset(UTF16)] uint16 account_name[],
1286                 [in]  netr_SchannelType secure_channel_type,
1287                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1288                 [in,ref] netr_Authenticator *credential,
1289                 [out,ref] netr_Authenticator *return_authenticator,
1290                 [out,ref] samr_Password *password,
1291                 [out,ref] samr_Password *password2
1292         );
1293
1294         /****************/
1295         /* Function 0x2b */
1296
1297         const int DS_GFTI_UPDATE_TDO = 0x1;
1298
1299         WERROR netr_DsRGetForestTrustInformation(
1300                 [in] [string,charset(UTF16)] uint16 *server_name,
1301                 [in] [string,charset(UTF16)] uint16 *trusted_domain_name,
1302                 [in] uint32 flags,
1303                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1304                 );
1305
1306         /****************/
1307         /* Function 0x2c */
1308         WERROR netr_GetForestTrustInformation(
1309                 [in] [string,charset(UTF16)] uint16 *server_name,
1310                 [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name,
1311                 [in,ref] netr_Authenticator *credential,
1312                 [out,ref] netr_Authenticator *return_authenticator,
1313                 [in] uint32 flags,
1314                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1315                 );
1316
1317         /****************/
1318         /* Function 0x2d */
1319
1320         /* this is the ADS varient. I don't yet know what the "flags" are for */
1321         NTSTATUS netr_LogonSamLogonWithFlags(
1322                 [in] [string,charset(UTF16)] uint16 *server_name,
1323                 [in] [string,charset(UTF16)] uint16 *computer_name,
1324                 [in] netr_Authenticator *credential,
1325                 [in][out] netr_Authenticator *return_authenticator,
1326                 [in]  uint16 logon_level,
1327                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1328                 [in]  uint16 validation_level,
1329                 [out] [switch_is(validation_level)] netr_Validation validation,
1330                 [out] uint8 authoritative,
1331                 [in,out] uint32 flags
1332                 );
1333
1334         /****************/
1335         /* Function 0x2e */
1336         WERROR netr_NETRSERVERGETTRUSTINFO();
1337 }