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