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