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