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