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