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