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
|
/*
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),
pointer_default(unique)
]
interface netlogon
{
/*****************/
/* 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 username,
[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 username,
[in] unistr workstation,
[out] netr_UasLogoffInfo info
);
/*****************/
/* Function 0x02 */
typedef [flag(NDR_PAHEX)] struct {
uint8 data[8];
} netr_Credential;
typedef [flag(NDR_PAHEX)] struct {
uint8 session_key[8];
uint32 sequence;
netr_Credential cred1;
netr_Credential cred2;
} netr_CredentialState;
typedef struct {
[value(strlen_m(r->string)*2)] uint16 size;
[value(r->size)] uint16 length;
unistr_noterm *string;
} netr_String;
typedef struct {
netr_String domain_name;
uint32 parameter_control;
uint32 logon_id_low;
uint32 logon_id_high;
netr_String username;
netr_String workstation;
} netr_IdentityInfo;
typedef [flag(NDR_PAHEX)] struct {
uint8 data[16];
} netr_Password;
typedef struct {
netr_IdentityInfo identity_info;
netr_Password lmpassword;
netr_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 logon_info;
uint8 challenge[8];
netr_ChallengeResponse nt;
netr_ChallengeResponse lm;
} netr_NetworkInfo;
typedef union {
[case(1)] netr_PasswordInfo *interactive;
[case(2)] netr_NetworkInfo *network;
[case(3)] netr_PasswordInfo *service;
} netr_LogonLevel;
typedef struct {
netr_Credential cred;
time_t timestamp;
} netr_Authenticator;
typedef struct {
uint32 user_id;
uint32 attributes;
} netr_GroupMembership;
typedef [flag(NDR_PAHEX)] struct {
uint8 user_session_key[16];
} netr_UserSessionKey;
typedef struct {
NTTIME logon_time;
NTTIME logoff_time;
NTTIME kickoff_time;
NTTIME passwd_last_set;
NTTIME passwd_can_change;
NTTIME passwd_must_change;
netr_String account_name;
netr_String full_name;
netr_String logon_script;
netr_String profile_path;
netr_String home_dir;
netr_String home_drive;
uint16 logon_count;
uint16 bad_passwd_count;
uint32 userid;
uint32 primary_group;
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;
uint32 expansionroom[10];
} netr_SamInfo;
typedef struct {
dom_sid2 *sid;
uint32 attribute;
} netr_SidAttr;
typedef struct {
NTTIME logon_time;
NTTIME logoff_time;
NTTIME kickoff_time;
NTTIME passwd_last_set;
NTTIME passwd_can_change;
NTTIME passwd_must_change;
netr_String account_name;
netr_String full_name;
netr_String logon_script;
netr_String profile_path;
netr_String home_dir;
netr_String home_drive;
uint16 logon_count;
uint16 bad_passwd_count;
uint32 userid;
uint32 primary_group;
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;
uint32 expansionroom[10];
uint32 sidcount;
[size_is(sidcount)] netr_SidAttr *sids;
} netr_SamInfo2;
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_SamInfo *sam;
[case(3)] netr_SamInfo2 *sam2;
[case(4)] netr_PacInfo *pac;
[case(5)] netr_PacInfo *pac2;
} netr_Validation;
NTSTATUS netr_LogonSamLogon(
[in] unistr *server_name,
[in] unistr *workstation,
[in] netr_Authenticator *credential,
[in][out] netr_Authenticator *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
);
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
);
WERROR netr_ServerReqChallenge(
[in] unistr *server_name,
[in] unistr computer_name,
[in][out] netr_Credential credentials
);
WERROR netr_ServerAuthenticate(
[in] unistr *server_name,
[in] unistr username,
[in] uint16 secure_challenge_type,
[in] unistr computer_name,
[in,out] netr_Credential credentials
);
NTSTATUS netr_ServerPasswordSet(
[in] unistr *server_name,
[in] unistr username,
[in] uint16 secure_challenge_type,
[in] unistr computer_name,
[in] netr_Authenticator credential,
[in] netr_Password new_password,
[out] netr_Authenticator return_authenticator
);
#if 0
typedef struct {
unistr *username;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_DELETE_USER;
typedef struct {
bool SensitiveDataFlag;
uint32 DataLength;
[size_is(DataLength)] uint8 *SensitiveData;
} USER_PRIVATE_INFO;
typedef struct {
netr_String username;
netr_String FullName;
uint32 UserID;
uint32 PrimaryGroupID;
netr_String HomeDir;
netr_String HomeDirDrive;
netr_String LogonScript;
netr_String Comment;
netr_String workstations;
NTTIME LastLogon;
NTTIME LastLogoff;
LOGON_HOURS logonhours;
uint16 BadPwCount;
uint16 LogonCount;
NTTIME PwLastSet;
NTTIME AccountExpires;
uint32 AccountControl;
LM_OWF_PASSWORD lmpw;
NT_OWF_PASSWORD ntpw;
bool NTPwPresent;
bool LMPwPresent;
bool PwExpired;
netr_String UserComment;
netr_String Parameters;
uint16 CountryCode;
uint16 CodePage;
USER_PRIVATE_INFO user_private_info;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_USER;
typedef struct {
netr_String DomainName;
netr_String OEMInfo;
NTTIME forcedlogoff;
uint16 minpasswdlen;
uint16 passwdhistorylen;
NTTIME pwd_must_change_time;
NTTIME pwd_can_change_time;
NTTIME domain_modify_time;
NTTIME domain_create_time;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_DOMAIN;
typedef struct {
netr_String groupname;
GROUP_MEMBERSHIP group_membership;
netr_String comment;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_GROUP;
typedef struct {
netr_String OldName;
netr_String NewName;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_RENAME;
typedef struct {
[size_is(num_rids)] uint32 *rids;
[size_is(num_rids)] uint32 *attribs;
uint32 num_rids;
uint32 dummy1;
uint32 dummy2;
uint32 dummy3;
uint32 dummy4;
} DELTA_GROUP_MEMBER;
typedef struct {
netr_String alias_name;
uint32 rid;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_ALIAS;
typedef struct {
SID_ARRAY sids;
uint32 dummy1;
uint32 dummy2;
uint32 dummy3;
uint32 dummy4;
} DELTA_ALIAS_MEMBER;
typedef struct {
uint32 pagedpoollimit;
uint32 nonpagedpoollimit;
uint32 minimumworkingsetsize;
uint32 maximumworkingsetsize;
uint32 pagefilelimit;
NTTIME timelimit;
} QUOTA_LIMITS;
typedef struct {
uint32 maxlogsize;
NTTIME auditretentionperiod;
bool auditingmode;
uint32 maxauditeventcount;
[size_is(maxauditeventcount)] uint32 *eventauditoptions;
netr_String primarydomainname;
dom_sid2 *sid;
QUOTA_LIMITS quota_limits;
NTTIME db_modify_time;
NTTIME db_create_time;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_POLICY;
typedef struct {
netr_String DomainName;
uint32 num_controllers;
[size_is(num_controllers)] netr_String *controller_names;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_TRUSTED_DOMAINS;
typedef struct {
uint32 privilegeentries;
uint32 provolegecontrol;
[size_is(privilege_entries)] uint32 *privilege_attrib;
[size_is(privilege_entries)] netr_String *privilege_name;
QUOTALIMITS quotalimits;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_ACCOUNTS;
typedef struct {
uint32 len;
uint32 maxlen;
[size_is(maxlen)][length_is(len)] uint8 *cipher_data;
} CIPHER_VALUE;
typedef struct {
CIPHER_VALUE current_cipher;
NTTIME current_cipher_set_time;
CIPHER_VALUE old_cipher;
NTTIME old_cipher_set_time;
uint32 SecurityInformation;
LSA_SECURITY_DESCRIPTOR sec_desc;
netr_String dummy1;
netr_String dummy2;
netr_String dummy3;
netr_String dummy4;
uint32 dummy5;
uint32 dummy6;
uint32 dummy7;
uint32 dummy8;
} DELTA_SECRET;
typedef struct {
uint32 low_value;
uint32 high_value;
} xxx;
typedef [switch_type(short)] union {
[case(1)] DELTA_DOMAIN *domain;
[case(2)] DELTA_GROUP *group;
[case(4)] DELTA_RENAME_GROUP *rename_group;
[case(5)] DELTA_USER *user;
[case(7)] DELTA_RENAME_USER *rename_user;
[case(8)] DELTA_GROUP_MEMBER *group_member;
[case(9)] DELTA_ALIAS *alias;
[case(11)] DELTA_RENAME_ALIAS *rename_alias;
[case(12)] DELTA_ALIAS_MEMBER *alias_member;
[case(13)] DELTA_POLICY *policy;
[case(14)] DELTA_TRUSTED_DOMAINS *trusted_domains;
[case(16)] DELTA_ACCOUNTS *accounts;
[case(18)] DELTA_SECRET *secret;
[case(20)] DELTA_DELETE_USER *delete_group;
[case(21)] DELTA_DELETE_USER *delete_user;
[case(22)] MODIFIED_COUNT *modified_count;
} DELTA_UNION;
typedef [switch_type(short)] union {
[case(1)] uint32 rid;
[case(2)] uint32 rid;
[case(3)] uint32 rid;
[case(4)] uint32 rid;
[case(5)] uint32 rid;
[case(6)] uint32 rid;
[case(7)] uint32 rid;
[case(8)] uint32 rid;
[case(9)] uint32 rid;
[case(10)] uint32 rid;
[case(11)] uint32 rid;
[case(12)] uint32 rid;
[case(13)] dom_sid2 *sid;
[case(14)] dom_sid2 *sid;
[case(15)] dom_sid2 *sid;
[case(16)] dom_sid2 *sid;
[case(17)] dom_sid2 *sid;
[case(18)] unistr *Name ;
[case(19)] unistr *Name ;
[case(20)] uint32 rid;
[case(21)] uint32 rid;
} DELTA_ID_UNION;
typedef struct {
uint16 delta_type;
DELTA_ID_UNION delta_id_union;
DELTA_UNION delta_union;
} DELTA_ENUM;
typedef struct {
uint32 num_deltas;
[size_is(num_deltas)] DELTA_ENUM *delta_enum;
} DELTA_ENUM_ARRAY;
WERROR netr_DatabaseDeltas(
[in][string][ref] wchar_t *logonserver, # REF!!!
[in][string][ref] wchar_t *computername,
[in][ref] AUTHENTICATOR credential,
[in][out][ref] AUTHENTICATOR return_authenticator,
[in] uint32 database_id,
[in][out][ref] MODIFIED_COUNT domain_modify_count,
[in] uint32 preferredmaximumlength,
[out] DELTA_ENUM_ARRAY *delta_enum_array
);
WERROR netr_DatabaseSync(
[in][string][ref] wchar_t *logonserver, # REF!!!
[in][string][ref] wchar_t *computername,
[in][ref] AUTHENTICATOR credential,
[in][out][ref] AUTHENTICATOR return_authenticator,
[in] uint32 database_id,
[in][out][ref] uint32 sync_context,
[in] uint32 preferredmaximumlength,
[out] DELTA_ENUM_ARRAY *delta_enum_array
);
typedef struct {
uint8 computer_name[16];
uint32 timecreated;
uint32 serial_number;
} UAS_INFO_0;
WERROR netr_AccountDeltas(
[in][string] wchar_t *logonserver,
[in][string][ref] wchar_t *computername,
[in][ref] AUTHENTICATOR credential,
[in][out][ref] AUTHENTICATOR return_authenticator,
[out][ref][size_is(count_returned)] uint8 *Buffer,
[out][ref] uint32 count_returned,
[out][ref] uint32 total_entries,
[in][out][ref] UAS_INFO_0 recordid,
[in][long] count,
[in][long] level,
[in][long] buffersize,
);
WERROR netr_AccountSync(
[in][string] wchar_t *logonserver,
[in][string][ref] wchar_t *computername,
[in][ref] AUTHENTICATOR credential,
[in][out][ref] AUTHENTICATOR return_authenticator,
[out][ref][size_is(count_returned)] uint8 *Buffer,
[out][ref] uint32 count_returned,
[out][ref] uint32 total_entries,
[out][ref] uint32 next_reference,
[in][long] reference,
[in][long] level,
[in][long] buffersize,
[in][out][ref] UAS_INFO_0 recordid,
);
WERROR netr_GetDcName(
[in] unistr logon_server,
[in] unistr *domainname,
[out]unistr *dcname,
};
typedef struct {
uint32 flags;
uint32 pdc_connection_status;
} NETLOGON_INFO_1;
typedef struct {
uint32 flags;
uint32 pdc_connection_status;
unistrtrusted_dc_name;
uint32 tc_connection_status;
} NETLOGON_INFO_2;
typedef struct {
uint32 flags;
uint32 logon_attempts;
uint32 reserved;
uint32 reserved;
uint32 reserved;
uint32 reserved;
uint32 reserved;
} NETLOGON_INFO_3;
typedef [switch_type(long)] union {
[case(1)] NETLOGON_INFO_1 *i1;
[case(2)] NETLOGON_INFO_2 *i2;
[case(3)] NETLOGON_INFO_3 *i3;
} CONTROL_QUERY_INFORMATION;
WERROR netr_LogonControl(
[in][string] wchar_t *logonserver,
[in] uint32 function_code,
[in] uint32 level,
[out][ref] CONTROL_QUERY_INFORMATION
);
WERROR netr_GetAnyDCName(
[in] unistr *logon_server,
[in] unistr *domainname,
[out]unistr *dcname,
};
typedef [switch_type(long)] union {
[case(5)] unistr *unknown;
[case(6)] unistr *unknown;
[case(0xfffe)] uint32 unknown;
[case(7)] unistry*unknown;
} CONTROL_DATA_INFORMATION;
WERROR netr_LogonControl2(
[in][string] wchar_t *logonserver,
[in] uint32 function_code,
[in] uint32 level,
[in][ref] CONTROL_DATA_INFORMATION *data,
[out][ref] CONTROL_QUERY_INFORMATION *query
);
WERROR netr_ServerAuthenticate2(
[in][string] wchar_t *logonserver,
[in] unistr username,
[in] uint16 secure_channel_type,
[in] unistr computername,
[in][ref] CREDENTIAL *client_chal,
[out][ref] CREDENTIAL *server_chal,
[in][out][ref] uint32 *negotiate_flags,
);
WERROR netr_DatabaseSync2(
[in][string][ref] wchar_t *logonserver, # REF!!!
[in][string][ref] wchar_t *computername,
[in][ref] AUTHENTICATOR credential,
[in][out][ref] AUTHENTICATOR return_authenticator,
[in] uint32 database_id,
[in] uint16 restart_state,
[in][out][ref] uint32 *sync_context,
[in] uint32 preferredmaximumlength,
[out] DELTA_ENUM_ARRAY *delta_enum_array
);
WERROR netr_DatabaseRedo(
[in][string][ref] wchar_t *logonserver, # REF!!!
[in][string][ref] wchar_t *computername,
[in][ref] AUTHENTICATOR credential,
[in][out][ref] AUTHENTICATOR return_authenticator,
[in][ref][size_is(change_log_entry_size)] uint8 *change_log_entry,
[in] uint32 change_log_entry_size,
[out] DELTA_ENUM_ARRAY *delta_enum_array
);
WERROR netr_LogonControl2Ex(
[in][string] wchar_t *logonserver,
[in] uint32 function_code,
[in] uint32 level,
[in][ref] CONTROL_DATA_INFORMATION *data,
[out][ref] CONTROL_QUERY_INFORMATION *query
);
#endif
}
|