summaryrefslogtreecommitdiff
path: root/source4/librpc/idl/netlogon.idl
blob: b880698ffd3de22ace7dd43fdcad54409425c73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
/*
  netlogon interface
  much of this was derived from the ethereal sources - thanks to everyone 
  who contributed!
*/

#include "idl_types.h"

[
  uuid("12345678-1234-abcd-ef00-01234567cffb"),
  version(1.0),
  endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
  pointer_default(unique),
  depends(lsa,samr)
]

interface netlogon
{
	typedef [public] struct {
		[value(strlen_m(r->string)*2)]  uint16 size;
		[value(r->size)]                uint16 length;
		unistr_noterm *string;
	} netr_String;
	
	/*****************/
	/* Function 0x00 */

	typedef struct {
		unistr *account_name;
		uint32 priv;
		uint32 auth_flags;
		uint32 logon_count;
		uint32 bad_pw_count;
		time_t last_logon;
		time_t last_logoff;
		time_t logoff_time;
		time_t kickoff_time;
		uint32 password_age;
		time_t pw_can_change;
		time_t pw_must_change;
		unistr *computer;
		unistr *domain;
		unistr *script_path;
		uint32 unknown;
	} netr_UasInfo;

	WERROR netr_LogonUasLogon(
		[in]   unistr *server_name,
		[in]   unistr account_name,
		[in]   unistr workstation,
		[out]  netr_UasInfo *info
		);


	/*****************/
	/* Function 0x01 */

	typedef struct {
		uint32 duration;
		uint16 logon_count;
	} netr_UasLogoffInfo;

	WERROR netr_LogonUasLogoff(
		[in] unistr *server_name,
		[in] unistr account_name,
		[in] unistr workstation,
		[out] netr_UasLogoffInfo info
		);


	/*****************/
	/* Function 0x02 */

	/* in netr_AcctLockStr size seems to be be 24, and rrenard thinks 
	   that the structure of the bindata looks like this:

		uint64 lockout_duration;
		uint64 reset_count;
		uint32 bad_attempt_lockout;
		uint32 dummy;	

	   but it doesn't look as though this structure is reflected at the
	   NDR level. Maybe it is left to the application to decode the bindata array.
	*/
	typedef struct {
		uint16 size;
		uint16 length;
		[size_is(size/2),length_is(length/2)] uint16 *bindata;
	} netr_AcctLockStr;

	typedef struct {
		netr_String domain_name;
		uint32      parameter_control;
		uint32      logon_id_low;
		uint32      logon_id_high;
		netr_String account_name;
		netr_String workstation;
	} netr_IdentityInfo;

	typedef struct {
		netr_IdentityInfo identity_info;
		samr_Password lmpassword;
		samr_Password ntpassword;
	} netr_PasswordInfo;

	typedef [flag(NDR_PAHEX)] struct {
		uint16 length;
		[value(r->length)] uint16 size;
		[size_is(size),length_is(length)] uint8 *data;
	} netr_ChallengeResponse;

	typedef [flag(NDR_PAHEX)] struct {
		netr_IdentityInfo identity_info;
		uint8 challenge[8];
		netr_ChallengeResponse nt;
		netr_ChallengeResponse lm;
	} netr_NetworkInfo;

	typedef union {
		[case(1)] netr_PasswordInfo *password;
		[case(2)] netr_NetworkInfo  *network;
		[case(3)] netr_PasswordInfo *password;
		[case(5)] netr_PasswordInfo *password;
		[case(6)] netr_NetworkInfo  *network;
	} netr_LogonLevel;

	typedef [public] struct {
		uint32 rid;
		uint32 attributes;
	} netr_GroupMembership;

	typedef [public] struct {
		NTTIME last_logon;
		NTTIME last_logoff;
		NTTIME acct_expiry;
		NTTIME last_password_change;
		NTTIME allow_password_change;
		NTTIME force_password_change;
		netr_String account_name;
		netr_String full_name;
		netr_String logon_script;
		netr_String profile_path;
		netr_String home_directory;
		netr_String home_drive;
		uint16 logon_count;
		uint16 bad_password_count;
		uint32 rid;
		uint32 primary_gid;
		uint32 group_count;
		[size_is(group_count)] netr_GroupMembership *groupids;
		uint32 user_flags;
		netr_UserSessionKey key;
		netr_String logon_server;
		netr_String domain;
		dom_sid2 *domain_sid;
		netr_LMSessionKey LMSessKey;
		uint32 acct_flags;
		uint32 unknown[7];
	} netr_SamBaseInfo;

	typedef [public] struct {
		netr_SamBaseInfo base;
	} netr_SamInfo2;

	typedef [public] struct {
		dom_sid2 *sid;
		uint32 attribute;
	} netr_SidAttr;

	typedef [public] struct {
		netr_SamBaseInfo base;
		uint32 sidcount;
		[size_is(sidcount)] netr_SidAttr *sids;
	} netr_SamInfo3;

	typedef struct {
		netr_SamBaseInfo base;
		uint32 sidcount;
		[size_is(sidcount)] netr_SidAttr *sids;
		netr_String forest;
		netr_String principle;
		uint32 unknown4[20];
	} netr_SamInfo6;

	typedef struct {
		uint32 pac_size;
		[size_is(pac_size)] uint8 *pac;
		netr_String logon_domain;
		netr_String logon_server;
		netr_String principal_name;
		uint32 auth_size;
		[size_is(auth_size)] uint8 *auth;
		netr_UserSessionKey user_session_key;
		uint32 expansionroom[10];
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
	} netr_PacInfo;

	typedef union {
		[case(2)] netr_SamInfo2 *sam2;
		[case(3)] netr_SamInfo3 *sam3;
		[case(4)] netr_PacInfo  *pac;
		[case(5)] netr_PacInfo  *pac;
		[case(6)] netr_SamInfo6 *sam6;
	} netr_Validation;

	NTSTATUS netr_LogonSamLogon(
		[in] unistr *server_name,
		[in] unistr *workstation,
		[in] netr_Authenticator *credential,
		[in][out] netr_Authenticator *return_authenticator,
		[in]  uint16 logon_level,
		[in]  [switch_is(logon_level)] netr_LogonLevel logon,
		[in]  uint16 validation_level,
		[out] [switch_is(validation_level)] netr_Validation validation,
		[out] uint32 authoritative
		);


	/*****************/
	/* Function 0x03 */

	NTSTATUS netr_LogonSamLogoff(
		[in] unistr *server_name,
		[in] unistr *computer_name,
		[in]      netr_Authenticator *credential,
		[in][out] netr_Authenticator *return_authenticator,
		[in] uint16 logon_level,
		[in] [switch_is(logon_level)] netr_LogonLevel logon
		);



	/*****************/
	/* Function 0x04 */

	NTSTATUS netr_ServerReqChallenge(
		[in]         unistr *server_name,
		[in]         unistr computer_name,
		[in,out,ref] netr_Credential *credentials
		);


	/*****************/
	/* Function 0x05 */

	/* secure channel types */
	const int SEC_CHAN_WKSTA   = 2;
	const int SEC_CHAN_DOMAIN  = 4;
	const int SEC_CHAN_BDC     = 6;

	NTSTATUS netr_ServerAuthenticate(
		[in]         unistr *server_name,
		[in]         unistr account_name,
		[in]         uint16 secure_channel_type,
		[in]         unistr computer_name,
		[in,out,ref] netr_Credential *credentials
		);


	/*****************/
	/* Function 0x06 */

	NTSTATUS netr_ServerPasswordSet(
		[in]  unistr *server_name,
		[in]  unistr account_name,
		[in]  uint16 secure_channel_type,
		[in]  unistr computer_name,
		[in]  netr_Authenticator credential,
		[in]  samr_Password new_password,
		[out] netr_Authenticator return_authenticator
		);


	/*****************/
	/* Function 0x07 */

	typedef struct {
		unistr *account_name;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_DELETE_USER;

	typedef struct {
		bool8  SensitiveDataFlag;
		uint32 DataLength;
		[size_is(DataLength)] uint8 *SensitiveData;
	} netr_USER_PRIVATE_INFO;

	typedef struct {
		netr_String account_name;
		netr_String full_name;
		uint32 rid;
		uint32 primary_group;
		netr_String home_dir;
		netr_String home_drive;
		netr_String logon_script;
		netr_String description;
		netr_String workstations;
		NTTIME LastLogon;
		NTTIME LastLogoff;
		samr_LogonHours logon_hours;
		uint16 bad_pw_count;
		uint16 logon_count;
		NTTIME PwLastSet;
		NTTIME AccountExpires;
		uint32 AccountControl;
		samr_Password lmpw;
		samr_Password ntpw;
		bool8 NTPwPresent;
		bool8 LMPwPresent;
		bool8 PwExpired;
		netr_String UserComment;
		netr_String Parameters;
		uint16 CountryCode;
		uint16 CodePage;
		netr_USER_PRIVATE_INFO user_private_info;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String profile_path;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_USER;

	typedef struct {
		netr_String DomainName;
		netr_String OEMInfo;
		NTTIME forcedlogoff;
		uint16 min_password_len;
		uint16 password_history_len;
		uint64 password_must_change_time;
		uint64 password_can_change_time;
		uint64 sequence_num;
		NTTIME domain_create_time;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_AcctLockStr account_lockout;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_DOMAIN;

	typedef struct {
		netr_String groupname;
		netr_GroupMembership group_membership;
		netr_String comment;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_GROUP;

	typedef struct {
		netr_String OldName;
		netr_String NewName;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_RENAME;

	typedef struct {
		[size_is(num_rids)] uint32 *rids;
		[size_is(num_rids)] uint32 *attribs;
		uint32 num_rids;
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
	} netr_DELTA_GROUP_MEMBER;

	typedef struct {
		netr_String alias_name;
		uint32 rid;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_ALIAS;

	typedef struct {
		lsa_SidArray sids;
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
	} netr_DELTA_ALIAS_MEMBER;

	typedef struct {
		uint32 pagedpoollimit;
		uint32 nonpagedpoollimit;
		uint32 minimumworkingsetsize;
		uint32 maximumworkingsetsize;
		uint32 pagefilelimit;
		NTTIME timelimit;
	} netr_QUOTA_LIMITS;

	typedef struct {
		uint32 maxlogsize;
		NTTIME auditretentionperiod;
		bool8 auditingmode;
		uint32 maxauditeventcount;
		[size_is(maxauditeventcount+1)] uint32 *eventauditoptions;
		netr_String primarydomainname;
		dom_sid2 *sid;
		netr_QUOTA_LIMITS quota_limits;
		uint64 sequence_num;
		NTTIME db_create_time;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_POLICY;

	typedef struct {
		netr_String DomainName;
		uint32 num_controllers;
		[size_is(num_controllers)] netr_String *controller_names;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_TRUSTED_DOMAINS;

	typedef struct {
		uint16 unknown;
	} netr_DELTA_DELETE_TRUST;

	typedef struct {
		uint32 privilege_entries;
		uint32 privilege_control;
		[size_is(privilege_entries)] uint32 *privilege_attrib;
		[size_is(privilege_entries)] netr_String *privilege_name;
		netr_QUOTA_LIMITS quotalimits;
		uint32 system_flags;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_ACCOUNTS;

	typedef struct {
		uint16 unknown;
	} netr_DELTA_DELETE_ACCOUNT;

	typedef struct {
		uint16 unknown;
	} netr_DELTA_DELETE_SECRET;

	typedef struct {
		uint32 len;
		uint32 maxlen;
		[size_is(maxlen)][length_is(len)] uint8 *cipher_data;
	} netr_CIPHER_VALUE;

	typedef struct {
		netr_CIPHER_VALUE current_cipher;
		NTTIME current_cipher_set_time;
		netr_CIPHER_VALUE old_cipher;
		NTTIME old_cipher_set_time;
		uint32 SecurityInformation;
		sec_desc_buf sdbuf;
		netr_String unknown1;
		netr_String unknown2;
		netr_String unknown3;
		netr_String unknown4;
		uint32 unknown5;
		uint32 unknown6;
		uint32 unknown7;
		uint32 unknown8;
	} netr_DELTA_SECRET;

	typedef enum {
		NETR_DELTA_DOMAIN           = 1,
		NETR_DELTA_GROUP            = 2,
		NETR_DELTA_DELETE_GROUP     = 3,
		NETR_DELTA_RENAME_GROUP     = 4,
		NETR_DELTA_USER             = 5,
		NETR_DELTA_DELETE_USER      = 6,
		NETR_DELTA_RENAME_USER      = 7,
		NETR_DELTA_GROUP_MEMBER     = 8,
		NETR_DELTA_ALIAS            = 9,
		NETR_DELTA_DELETE_ALIAS     = 10,
		NETR_DELTA_RENAME_ALIAS     = 11,
		NETR_DELTA_ALIAS_MEMBER     = 12,
		NETR_DELTA_POLICY           = 13,
		NETR_DELTA_TRUSTED_DOMAINS  = 14,
		NETR_DELTA_DELETE_TRUST     = 15,
		NETR_DELTA_ACCOUNTS         = 16,
		NETR_DELTA_DELETE_ACCOUNT   = 17,
		NETR_DELTA_SECRET           = 18,
		NETR_DELTA_DELETE_SECRET    = 19,
		NETR_DELTA_DELETE_GROUP2    = 20,
		NETR_DELTA_DELETE_USER2     = 21,
		NETR_DELTA_MODIFY_COUNT     = 22
	} netr_DeltaEnum;

	typedef union {
		[case(NETR_DELTA_DOMAIN)]          netr_DELTA_DOMAIN          *domain;
		[case(NETR_DELTA_GROUP)]           netr_DELTA_GROUP           *group;
		[case(NETR_DELTA_DELETE_GROUP)]    ; /* rid only */
		[case(NETR_DELTA_RENAME_GROUP)]    netr_DELTA_RENAME          *rename_group;
		[case(NETR_DELTA_USER)]            netr_DELTA_USER            *user;
		[case(NETR_DELTA_DELETE_USER)]     ; /* rid only */
		[case(NETR_DELTA_RENAME_USER)]     netr_DELTA_RENAME          *rename_user;
		[case(NETR_DELTA_GROUP_MEMBER)]    netr_DELTA_GROUP_MEMBER    *group_member;
		[case(NETR_DELTA_ALIAS)]           netr_DELTA_ALIAS           *alias;
		[case(NETR_DELTA_DELETE_ALIAS)]    ; /* rid only */
		[case(NETR_DELTA_RENAME_ALIAS)]    netr_DELTA_RENAME          *rename_alias;
		[case(NETR_DELTA_ALIAS_MEMBER)]    netr_DELTA_ALIAS_MEMBER    *alias_member;
		[case(NETR_DELTA_POLICY)]          netr_DELTA_POLICY          *policy;
		[case(NETR_DELTA_TRUSTED_DOMAINS)] netr_DELTA_TRUSTED_DOMAINS *trusted_domains;
		[case(NETR_DELTA_DELETE_TRUST)]    netr_DELTA_DELETE_TRUST    delete_trust;
		[case(NETR_DELTA_ACCOUNTS)]        netr_DELTA_ACCOUNTS        *accounts;
		[case(NETR_DELTA_DELETE_ACCOUNT)]  netr_DELTA_DELETE_ACCOUNT  delete_account;
		[case(NETR_DELTA_SECRET)]          netr_DELTA_SECRET          *secret;
		[case(NETR_DELTA_DELETE_SECRET)]   netr_DELTA_DELETE_SECRET   delete_secret;
		[case(NETR_DELTA_DELETE_GROUP2)]   netr_DELTA_DELETE_USER     *delete_group;
		[case(NETR_DELTA_DELETE_USER2)]    netr_DELTA_DELETE_USER     *delete_user;
		[case(NETR_DELTA_MODIFY_COUNT)]    uint64                     *modified_count;
	} netr_DELTA_UNION;

	typedef union {
		[case(NETR_DELTA_DOMAIN)]          uint32 rid;
		[case(NETR_DELTA_GROUP)]           uint32 rid;
		[case(NETR_DELTA_DELETE_GROUP)]    uint32 rid;
		[case(NETR_DELTA_RENAME_GROUP)]    uint32 rid;
		[case(NETR_DELTA_USER)]            uint32 rid;
		[case(NETR_DELTA_DELETE_USER)]     uint32 rid;
		[case(NETR_DELTA_RENAME_USER)]     uint32 rid;
		[case(NETR_DELTA_GROUP_MEMBER)]    uint32 rid;
		[case(NETR_DELTA_ALIAS)]           uint32 rid;
		[case(NETR_DELTA_DELETE_ALIAS)]    uint32 rid;
		[case(NETR_DELTA_RENAME_ALIAS)]    uint32 rid;
		[case(NETR_DELTA_ALIAS_MEMBER)]    uint32 rid;
		[case(NETR_DELTA_POLICY)]          dom_sid2 *sid;
		[case(NETR_DELTA_TRUSTED_DOMAINS)] dom_sid2 *sid;
		[case(NETR_DELTA_DELETE_TRUST)]    dom_sid2 *sid;
		[case(NETR_DELTA_ACCOUNTS)]        dom_sid2 *sid;
		[case(NETR_DELTA_DELETE_ACCOUNT)]  dom_sid2 *sid;
		[case(NETR_DELTA_SECRET)]          unistr *name;
		[case(NETR_DELTA_DELETE_SECRET)]   unistr *name;
		[case(NETR_DELTA_DELETE_GROUP2)]   uint32 rid;
		[case(NETR_DELTA_DELETE_USER2)]    uint32 rid;
		[case(NETR_DELTA_MODIFY_COUNT)]    ;
	} netr_DELTA_ID_UNION;

	typedef struct {
		uint16 delta_type;
		[switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union;
		[switch_is(delta_type)] netr_DELTA_UNION delta_union;
	} netr_DELTA_ENUM;

	typedef struct {
		uint32 num_deltas;
		[size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
	} netr_DELTA_ENUM_ARRAY;


	NTSTATUS netr_DatabaseDeltas(
		[in]      unistr logon_server,
		[in]      unistr computername,
		[in]      netr_Authenticator credential,
		[in,out]  netr_Authenticator return_authenticator,
		[in]      uint32 database_id,
		[in,out]  uint64 sequence_num,
		[in]      uint32 preferredmaximumlength,
		[out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
		);


	/*****************/
	/* Function 0x08 */

	NTSTATUS netr_DatabaseSync(
		[in]     unistr logon_server,
		[in]     unistr computername,
		[in]     netr_Authenticator credential,
		[in,out] netr_Authenticator return_authenticator,
		[in]     uint32 database_id,
		[in,out] uint32 sync_context,
		[in]     uint32 preferredmaximumlength,
		[out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
		);


	/*****************/
	/* Function 0x09 */

	/* w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this call */

	typedef [flag(NDR_PAHEX)] struct {
		uint8 computer_name[16];
		uint32 timecreated;
		uint32 serial_number;
	} netr_UAS_INFO_0;

	typedef struct {
		[flag(NDR_REMAINING)] DATA_BLOB blob;
	} netr_AccountBuffer;

	NTSTATUS netr_AccountDeltas(
		[in]     unistr *logon_server,
		[in]     unistr computername,
		[in]     netr_Authenticator credential,
		[in,out] netr_Authenticator return_authenticator,
		[in]     netr_UAS_INFO_0 uas,
		[in]     uint32 count,
		[in]     uint32 level,
		[in]     uint32 buffersize,
		[out,subcontext(4)] netr_AccountBuffer buffer,
		[out]    uint32 count_returned,
		[out]    uint32 total_entries,
		[out]    netr_UAS_INFO_0 recordid
		);


	/*****************/
	/* Function 0x0A */

	NTSTATUS netr_AccountSync(
		[in]      unistr *logon_server,
		[in]      unistr computername,
		[in]      netr_Authenticator credential,
		[in,out]  netr_Authenticator return_authenticator,
		[in]      uint32 reference,
		[in]      uint32 level,
		[in]      uint32 buffersize,
		[out,subcontext(4)] netr_AccountBuffer buffer,
		[out]     uint32 count_returned,
		[out]     uint32 total_entries,
		[out]     uint32 next_reference,
		[in,out]  netr_UAS_INFO_0 recordid
		);


	/*****************/
	/* Function 0x0B */

	NTSTATUS netr_GetDcName(
		[in]  unistr logon_server,
		[in]  unistr *domainname,
		[out] unistr *dcname
		);



	/*****************/
	/* Function 0x0C */

	typedef struct {
		uint32 flags;
		uint32 pdc_connection_status;
	} netr_NETLOGON_INFO_1;

	typedef struct {
		uint32 flags;
		uint32 pdc_connection_status;
		unistr trusted_dc_name;
		uint32 tc_connection_status;
	} netr_NETLOGON_INFO_2;

	typedef struct {
		uint32 flags;
		uint32 logon_attempts;
		uint32 unknown1;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
		uint32 unknown5;
	} netr_NETLOGON_INFO_3;

	typedef union {
		[case(1)]  netr_NETLOGON_INFO_1 *info1;
		[case(2)]  netr_NETLOGON_INFO_2 *info2;
		[case(3)]  netr_NETLOGON_INFO_3 *info3;
	} netr_CONTROL_QUERY_INFORMATION;

	/* function_code values */
	const int NETLOGON_CONTROL_REDISCOVER       = 5;
	const int NETLOGON_CONTROL_TC_QUERY         = 6;
	const int NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7;
	const int NETLOGON_CONTROL_SET_DBFLAG       = 65534;

	WERROR netr_LogonControl(
		[in]   unistr *logon_server,
		[in]   uint32 function_code,
		[in]   uint32 level,
		[out,switch_is(level)]  netr_CONTROL_QUERY_INFORMATION info
		);


	/*****************/
	/* Function 0x0D */

	WERROR netr_GetAnyDCName(
		[in]  unistr *logon_server,
		[in]  unistr *domainname,
		[out] unistr *dcname
		);


	/*****************/
	/* Function 0x0E */

	typedef union {
		[case(NETLOGON_CONTROL_REDISCOVER)]        unistr *domain;
		[case(NETLOGON_CONTROL_TC_QUERY)]          unistr *domain;
		[case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)]  unistr *domain;
		[case(NETLOGON_CONTROL_SET_DBFLAG)]        uint32 debug_level;
	} netr_CONTROL_DATA_INFORMATION;

	WERROR netr_LogonControl2(
		[in]    unistr *logon_server,
		[in]    uint32 function_code,
		[in]    uint32 level,
		[in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
		[out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
		);


	/*****************/
	/* Function 0x0F */

	NTSTATUS netr_ServerAuthenticate2(
		[in]         unistr *server_name,
		[in]         unistr account_name,
		[in]         uint16 secure_channel_type,
		[in]         unistr computer_name,
		[in,out,ref] netr_Credential *credentials,
		[in,out,ref] uint32 *negotiate_flags
		);


	/*****************/
	/* Function 0x10 */

	NTSTATUS netr_DatabaseSync2(
		[in]     unistr logon_server,
		[in]     unistr computername,
		[in]     netr_Authenticator credential,
		[in,out] netr_Authenticator return_authenticator,
		[in]     uint32 database_id,
		[in]     uint16 restart_state,
		[in,out] uint32 sync_context,
		[in]     uint32 preferredmaximumlength,
		[out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
		);


	/*****************/
	/* Function 0x11 */

	/* i'm not at all sure how this call works */

	NTSTATUS netr_DatabaseRedo(
		[in]     unistr logon_server,
		[in]     unistr computername,
		[in]     netr_Authenticator credential,
		[in,out] netr_Authenticator return_authenticator,
		[in][size_is(change_log_entry_size)] uint8 *change_log_entry,
		[in]     uint32 change_log_entry_size,
		[out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
		);


	/*****************/
	/* Function 0x12 */

	WERROR netr_LogonControl2Ex(
		[in]   unistr *logon_server,
		[in]   uint32 function_code,
		[in]   uint32 level,
		[in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
		[out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
		);

	/*****************/
	/* Function 0x13 */
	WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ;

	/*****************/
	/* Function 0x14 */		
	WERROR netr_DSRGETDCNAME() ;

	/*****************/
	/* Function 0x15 */
	WERROR netr_NETRLOGONDUMMYROUTINE1();

	/****************/
	/* Function 0x16 */
	WERROR netr_NETRLOGONSETSERVICEBITS();

	/****************/
	/* Function 0x17 */
	WERROR netr_NETRLOGONGETTRUSTRID();

	/****************/
	/* Function 0x18 */
	WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();

	/****************/
	/* Function 0x19 */
	WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();

	/****************/
	/* Function 0x1a */
	NTSTATUS netr_ServerAuthenticate3(
		[in]         unistr *server_name,
		[in]         unistr account_name,
		[in]         uint16 secure_channel_type,
		[in]         unistr computer_name,
		[in,out,ref] netr_Credential *credentials,
		[in,out,ref] uint32 *negotiate_flags,
		[out,ref]    uint32 *rid
		);

	/****************/
	/* Function 0x1b */
	WERROR netr_DSRGETDCNAMEX();

	/****************/
	/* Function 0x1c */
	WERROR netr_DSRGETSITENAME();

	/****************/
	/* Function 0x1d */

	typedef struct {
		uint32 length;
		[size_is(length)] uint8 *data;
	} netr_Blob;

	typedef [flag(NDR_PAHEX)] struct {
		uint16 length;
		uint16 size;
		[size_is(size/2),length_is(length/2)] uint16 *data;
	} netr_BinaryString;

	typedef struct {
		netr_Blob blob;
		unistr *workstation_domain;
		unistr *workstation_site;
		unistr *unknown1;
		unistr *unknown2;
		unistr *unknown3;
		unistr *unknown4;
		netr_BinaryString blob2;
		netr_String product;
		uint32 unknown5;
		unistr *unknown6;
		uint32 unknown7[6];
	} netr_DomainQuery1;

	typedef union {
		[case(1)] netr_DomainQuery1 *query1;
		[case(2)] netr_DomainQuery1 *query1;
	} netr_DomainQuery;

	typedef struct {
		netr_String domainname;
		netr_String fulldomainname;
		netr_String forest;
		GUID        guid;
		dom_sid2    *sid;
		netr_BinaryString unknown1[4];
		uint32      unknown[4];
	} netr_DomainTrustInfo;

	typedef struct {
		netr_DomainTrustInfo domaininfo;
		uint32 num_trusts;
		[size_is(num_trusts)] netr_DomainTrustInfo *trusts;
		uint32 unknown[14]; /* room for expansion? */
	} netr_DomainInfo1;

	typedef union {
		[case(1)] netr_DomainInfo1 *info1;
		[case(2)] netr_DomainInfo1 *info1;
	} netr_DomainInfo;
	
	NTSTATUS netr_LogonGetDomainInfo(
		[in]         unistr server_name,
		[in]         unistr *computer_name,
		[in,out,ref] netr_Authenticator *credential,
		[in]         uint32 unknown1,
		[in]         uint32 i1[2],
		[in]	     uint32 level,
		[in,switch_is(level)] netr_DomainQuery query,
		[out,switch_is(level)] netr_DomainInfo info
		);

	/****************/
	/* Function 0x1e */
	WERROR netr_NETRSERVERPASSWORDSET2();

	/****************/
	/* Function 0x1f */
	WERROR netr_NETRSERVERPASSWORDGET();

	/****************/
	/* Function 0x20 */
	WERROR netr_NETRLOGONSENDTOSAM();

	/****************/
	/* Function 0x21 */
	WERROR netr_DSRADDRESSTOSITENAMESW();

	/****************/
	/* Function 0x22 */
	WERROR netr_DSRGETDCNAMEEX2();

	/****************/
	/* Function 0x23 */
	WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();

	/****************/
	/* Function 0x24 */
	WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX();

	/****************/
	/* Function 0x25 */
	WERROR netr_DSRADDRESSTOSITENAMESEXW();

	/****************/
	/* Function 0x26 */
	WERROR netr_DSRGETDCSITECOVERAGEW();

	/****************/
	/* Function 0x27 */
	WERROR netr_NETRLOGONSAMLOGONEX();

	/****************/
	/* Function 0x28 */

	const int NETR_TRUST_FLAG_IN_FOREST = 0x01;
	const int NETR_TRUST_FLAG_OUTBOUND  = 0x02;
	const int NETR_TRUST_FLAG_TREEROOT  = 0x04;
	const int NETR_TRUST_FLAG_PRIMARY   = 0x08;
	const int NETR_TRUST_FLAG_NATIVE    = 0x10;
	const int NETR_TRUST_FLAG_INBOUND   = 0x20;

	typedef struct {
		unistr *netbios_name;
		unistr *dns_name;
		uint32 trust_flags;
		uint32 parent_index;
		uint32 trust_type;
		uint32 trust_attributes;
		dom_sid2 *sid;
		GUID   guid;
	} netr_DomainTrust;

	WERROR netr_DsrEnumerateDomainTrusts(
		[in]                 unistr           *server_name,
		[in]                 uint32           trust_flags,
		[out]                uint32           count,
		[out,size_is(count)] netr_DomainTrust *trusts
		);


	/****************/
	/* Function 0x29 */
	WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();

	/****************/
	/* Function 0x2a */
	WERROR netr_NETRSERVERTRUSTPASSWORDSGET();

	/****************/
	/* Function 0x2b */
	WERROR netr_DSRGETFORESTTRUSTINFORMATION();

	/****************/
	/* Function 0x2c */
	WERROR netr_NETRGETFORESTTRUSTINFORMATION();

	/****************/
	/* Function 0x2d */

	/* this is the ADS varient. I don't yet know what the "flags" are for */
	NTSTATUS netr_LogonSamLogonWithFlags(
		[in] unistr *server_name,
		[in] unistr *workstation,
		[in] netr_Authenticator *credential,
		[in][out] netr_Authenticator *return_authenticator,
		[in]  uint16 logon_level,
		[in]  [switch_is(logon_level)] netr_LogonLevel logon,
		[in]  uint16 validation_level,
		[out] [switch_is(validation_level)] netr_Validation validation,
		[out] uint32 authoritative,
		[in,out] uint32 flags
		);

	/****************/
	/* Function 0x2e */
	WERROR netr_NETRSERVERGETTRUSTINFO();
}