-
Notifications
You must be signed in to change notification settings - Fork 2
/
pac.go
3453 lines (3382 loc) · 140 KB
/
pac.go
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
// The pac package implements the PAC client protocol.
//
// # Introduction
//
// The Privilege Attribute Certificate (PAC) Data Structure is used by authentication
// protocols that verify identities to transport authorization information, which controls
// access to resources. The Kerberos protocol [RFC4120] does not provide authorization.
// The Privilege Attribute Certificate (PAC) was created to provide this authorization
// data for Kerberos Protocol Extensions [MS-KILE]. Into the PAC structure [MS-KILE]
// encodes authorization information, which consists of group memberships, additional
// credential information, profile and policy information, and supporting security metadata.<1>
//
// # Overview
//
// The PAC is a structure that conveys authorization-related information provided by
// domain controllers (DCs). The PAC is used by authentication protocols that verify
// identities to transport authorization information, which controls access to resources.
// Once authentication has been accomplished, the next task is to decide if a particular
// request is authorized. Management of network systems often models broad authorization
// decisions through groups; for example, all engineers who can access a specific printer
// or all sales personnel who can access a certain web server. Making group information
// consistently available to several services allows for simpler management.
//
// The Kerberos protocol is one of the most commonly used authentication mechanisms.
// However, the Kerberos protocol [RFC4120] does not provide authorization; "kerberized"
// applications are expected to manage their own authorization, typically through names.
// Specifically, the Kerberos protocol does not define any explicit group membership
// or logon policy information to be carried in the Kerberos tickets. It leaves that
// for Kerberos extensions to provide a mechanism to convey authorization information
// by encapsulating this information within an AuthorizationData structure ([RFC4120]
// section 5.2.6). The PAC was created to provide this authorization data for Kerberos
// Protocol Extensions [MS-KILE].
//
// [MS-KILE] requires that the PAC information be encoded within an AuthorizationData
// element ([RFC4120] section 5.2.6) which consists of group memberships, additional
// credential information, profile and policy information, and supporting security metadata.
// [MS-KILE] also requires that the PAC information be enclosed in an AD-IF-RELEVANT
// AuthorizationData element, since this information is noncritical authorization data.
// This clearly indicates to the receiver that this data can be ignored if the receiver
// does consume the information in the PAC.
//
// Examples of information that can be provided by a DC include:
//
// * Authorization data such as security identifiers (SIDs) ( f2ef15b6-1e9b-48b5-bf0b-019f061d41c8#gt_83f2020d-0804-4840-a5ac-e06439d50f8d
// ) and relative identifiers (RIDs) ( f2ef15b6-1e9b-48b5-bf0b-019f061d41c8#gt_df3d0b61-56cd-4dac-9402-982f1fedc41c
// ).
//
// * User profile information such as a home directory or logon script.
//
// * Password credentials, used during smart card authentication, for password based
// authentication protocols to use at a later time.
//
// * Service for User (S4U) ( f2ef15b6-1e9b-48b5-bf0b-019f061d41c8#gt_083a5403-f654-4db6-b17e-9c10dc5cd420
// ) protocol [MS-SFU] ( ../ms-sfu/3bff5864-8135-400e-bdd9-33b552051d94 ) data.
package pac
import (
"context"
"fmt"
"strings"
"unicode/utf16"
dcerpc "github.com/oiweiwei/go-msrpc/dcerpc"
errors "github.com/oiweiwei/go-msrpc/dcerpc/errors"
uuid "github.com/oiweiwei/go-msrpc/midl/uuid"
claims "github.com/oiweiwei/go-msrpc/msrpc/adts/claims/claims/v1"
dtyp "github.com/oiweiwei/go-msrpc/msrpc/dtyp"
ndr "github.com/oiweiwei/go-msrpc/ndr"
)
var (
_ = context.Background
_ = fmt.Errorf
_ = utf16.Encode
_ = strings.TrimPrefix
_ = ndr.ZeroString
_ = (*uuid.UUID)(nil)
_ = (*dcerpc.SyntaxID)(nil)
_ = (*errors.Error)(nil)
_ = dtyp.GoPackage
_ = claims.GoPackage
)
var (
// import guard
GoPackage = "pac"
)
// PACInfoBufferTypeLogonInfo represents the PAC_INFO_BUFFER_TYPE_LOGON_INFO RPC constant
const PACInfoBufferTypeLogonInfo = 0x00000001
// PACInfoBufferTypeCredentialsInfo represents the PAC_INFO_BUFFER_TYPE_CREDENTIALS_INFO RPC constant
const PACInfoBufferTypeCredentialsInfo = 0x00000002
// PACInfoBufferTypeServerChecksum represents the PAC_INFO_BUFFER_TYPE_SERVER_CHECKSUM RPC constant
const PACInfoBufferTypeServerChecksum = 0x00000006
// PACInfoBufferTypeKDCChecksum represents the PAC_INFO_BUFFER_TYPE_KDC_CHECKSUM RPC constant
const PACInfoBufferTypeKDCChecksum = 0x00000007
// PACInfoBufferTypeClientNameAndTicketInfo represents the PAC_INFO_BUFFER_TYPE_CLIENT_NAME_AND_TICKET_INFO RPC constant
const PACInfoBufferTypeClientNameAndTicketInfo = 0x0000000A
// PACInfoBufferTypeConstrainedDelegationInfo represents the PAC_INFO_BUFFER_TYPE_CONSTRAINED_DELEGATION_INFO RPC constant
const PACInfoBufferTypeConstrainedDelegationInfo = 0x0000000B
// PACInfoBufferTypeUPNAndDNSInfo represents the PAC_INFO_BUFFER_TYPE_UPN_AND_DNS_INFO RPC constant
const PACInfoBufferTypeUPNAndDNSInfo = 0x0000000C
// PACInfoBufferTypeClientClaimsInfo represents the PAC_INFO_BUFFER_TYPE_CLIENT_CLAIMS_INFO RPC constant
const PACInfoBufferTypeClientClaimsInfo = 0x0000000D
// PACInfoBufferTypeDeviceInfo represents the PAC_INFO_BUFFER_TYPE_DEVICE_INFO RPC constant
const PACInfoBufferTypeDeviceInfo = 0x0000000E
// PACInfoBufferTypeDeviceClaimsInfo represents the PAC_INFO_BUFFER_TYPE_DEVICE_CLAIMS_INFO RPC constant
const PACInfoBufferTypeDeviceClaimsInfo = 0x0000000F
// PACInfoBufferTypeTicketChecksum represents the PAC_INFO_BUFFER_TYPE_TICKET_CHECKSUM RPC constant
const PACInfoBufferTypeTicketChecksum = 0x00000010
// PACInfoBufferTypeAttributes represents the PAC_INFO_BUFFER_TYPE_ATTRIBUTES RPC constant
const PACInfoBufferTypeAttributes = 0x00000011
// PACInfoBufferTypeRequestorSID represents the PAC_INFO_BUFFER_TYPE_REQUESTOR_SID RPC constant
const PACInfoBufferTypeRequestorSID = 0x00000012
// PACInfoBufferTypeExtendedKDCChecksum represents the PAC_INFO_BUFFER_TYPE_EXTENDED_KDC_CHECKSUM RPC constant
const PACInfoBufferTypeExtendedKDCChecksum = 0x00000013
// PACInfoBufferTypeRequestorGUID represents the PAC_INFO_BUFFER_TYPE_REQUESTOR_GUID RPC constant
const PACInfoBufferTypeRequestorGUID = 0x00000014
// EncryptionTypeNone represents the ENCRYPTION_TYPE_NONE RPC constant
const EncryptionTypeNone = 0x00000000
// EncryptionTypeDESCBCCRC represents the ENCRYPTION_TYPE_DES_CBC_CRC RPC constant
const EncryptionTypeDESCBCCRC = 0x00000001
// EncryptionTypeDESCBCMD5 represents the ENCRYPTION_TYPE_DES_CBC_MD5 RPC constant
const EncryptionTypeDESCBCMD5 = 0x00000003
// EncryptionTypeAES128CTSHMACSHA196 represents the ENCRYPTION_TYPE_AES128_CTS_HMAC_SHA1_96 RPC constant
const EncryptionTypeAES128CTSHMACSHA196 = 0x00000011
// EncryptionTypeAES256CTSHMACSHA196 represents the ENCRYPTION_TYPE_AES256_CTS_HMAC_SHA1_96 RPC constant
const EncryptionTypeAES256CTSHMACSHA196 = 0x00000012
// EncryptionTypeRC4HMAC represents the ENCRYPTION_TYPE_RC4_HMAC RPC constant
const EncryptionTypeRC4HMAC = 0x00000017
// SignatureTypeKerberosChecksumHMACMD5 represents the SIGNATURE_TYPE_KERB_CHECKSUM_HMAC_MD5 RPC constant
const SignatureTypeKerberosChecksumHMACMD5 = 0xFFFFFF76
// SignatureTypeHMACSHA196AES128 represents the SIGNATURE_TYPE_HMAC_SHA1_96_AES128 RPC constant
const SignatureTypeHMACSHA196AES128 = 0x0000000F
// SignatureTypeHMACSHA196AES256 represents the SIGNATURE_TYPE_HMAC_SHA1_96_AES256 RPC constant
const SignatureTypeHMACSHA196AES256 = 0x00000010
// PACWasRequested represents the PAC_WAS_REQUESTED RPC constant
const PACWasRequested = 0x00000001
// PACWasGivenImplicitly represents the PAC_WAS_GIVEN_IMPLICITLY RPC constant
const PACWasGivenImplicitly = 0x00000002
// KerberosSIDAndAttributes structure represents KERB_SID_AND_ATTRIBUTES RPC structure.
//
// The KERB_SID_AND_ATTRIBUTES structure represents a SID and its attributes for use
// in authentication. It is sent within the KERB_VALIDATION_INFO (section 2.5) structure
// and used to include additional information about the group that the SID references.
//
// The KERB_SID_AND_ATTRIBUTES structure is defined as follows.
type KerberosSIDAndAttributes struct {
// Sid: A pointer to an RPC_SID structure ([MS-DTYP] section 2.4.2.3).
SID *dtyp.SID `idl:"name:Sid" json:"sid"`
// Attributes: A set of bit flags that describe attributes of the SID in the Sid field.
//
// Attributes can contain one or more of the following bits.
//
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 3 | 1 |
// | | | | | | | | | | | 0 | | | | | | | | | | 0 | | | | | | | | | | 0 | |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 0 | 0 | E | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | D | C | B | A |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
//
// Where the bits are defined as:
//
// +-------+----------------------------------------------------------------------------------+
// | | |
// | VALUE | DESCRIPTION |
// | | |
// +-------+----------------------------------------------------------------------------------+
// +-------+----------------------------------------------------------------------------------+
// | A | This setting means that the group is mandatory for the user and cannot be |
// | | disabled. Corresponds to SE_GROUP_MANDATORY. For more information, see [SIDATT]. |
// +-------+----------------------------------------------------------------------------------+
// | B | This setting means that the group is marked as enabled by default. Corresponds |
// | | to SE_GROUP_ENABLED_BY_DEFAULT. For more information, see [SIDATT]. |
// +-------+----------------------------------------------------------------------------------+
// | C | This setting means that the group is enabled for use. Corresponds to |
// | | SE_GROUP_ENABLED. For more information, see [SIDATT]. |
// +-------+----------------------------------------------------------------------------------+
// | D | This setting means that the group can be assigned as an owner of a resource. |
// | | Corresponds to SE_GROUP_OWNER. For more information, see [SIDATT]. |
// +-------+----------------------------------------------------------------------------------+
// | E | This setting means that the group is a domain-local or resource group. |
// | | Corresponds to SE_GROUP_RESOURCE. For more information, see [SIDATT]. |
// +-------+----------------------------------------------------------------------------------+
Attributes uint32 `idl:"name:Attributes" json:"attributes"`
}
func (o *KerberosSIDAndAttributes) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *KerberosSIDAndAttributes) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if o.SID != nil {
_ptr_Sid := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.SID != nil {
if err := o.SID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.SID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.SID, _ptr_Sid); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.Attributes); err != nil {
return err
}
return nil
}
func (o *KerberosSIDAndAttributes) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
_ptr_Sid := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.SID == nil {
o.SID = &dtyp.SID{}
}
if err := o.SID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_Sid := func(ptr interface{}) { o.SID = *ptr.(**dtyp.SID) }
if err := w.ReadPointer(&o.SID, _s_Sid, _ptr_Sid); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
return nil
}
// GroupMembership structure represents GROUP_MEMBERSHIP RPC structure.
//
// The GROUP_MEMBERSHIP structure identifies a group to which an account belongs. It
// is sent within the KERB_VALIDATION_INFO (section 2.5) structure.
//
// The GROUP_MEMBERSHIP structure is defined as follows.
type GroupMembership struct {
// RelativeId: A 32-bit unsigned integer that contains the RID of a particular group.
RelativeID uint32 `idl:"name:RelativeId" json:"relative_id"`
// Attributes: A 32-bit unsigned integer value that contains the group membership attributes
// set for the RID contained in RelativeId. The possible values for the Attributes flags
// are identical to those specified in KERB_SID_AND_ATTRIBUTES (section 2.2.1).
Attributes uint32 `idl:"name:Attributes" json:"attributes"`
}
func (o *GroupMembership) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *GroupMembership) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.RelativeID); err != nil {
return err
}
if err := w.WriteData(o.Attributes); err != nil {
return err
}
return nil
}
func (o *GroupMembership) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.RelativeID); err != nil {
return err
}
if err := w.ReadData(&o.Attributes); err != nil {
return err
}
return nil
}
// DomainGroupMembership structure represents DOMAIN_GROUP_MEMBERSHIP RPC structure.
//
// The DOMAIN_GROUP_MEMBERSHIP structure identifies a domain and groups to which an
// account belongs. It is sent within the PAC_DEVICE_INFO (section 2.12) structure.<2>
//
// The DOMAIN_GROUP_MEMBERSHIP structure is defined as follows.
type DomainGroupMembership struct {
// DomainId: A SID structure that contains the SID for the domain. This member is used
// in conjunction with the GroupIds members to create group SIDs for the device.
DomainID *dtyp.SID `idl:"name:DomainId" json:"domain_id"`
// GroupCount: A 32-bit unsigned integer that contains the number of groups within the
// domain to which the account belongs.
GroupCount uint32 `idl:"name:GroupCount" json:"group_count"`
// GroupIds: A pointer to a list of GROUP_MEMBERSHIP structures that contain the groups
// to which the account belongs in the domain. The number of groups in this list MUST
// be equal to GroupCount.
GroupIDs []*GroupMembership `idl:"name:GroupIds;size_is:(GroupCount)" json:"group_ids"`
}
func (o *DomainGroupMembership) xxx_PreparePayload(ctx context.Context) error {
if o.GroupIDs != nil && o.GroupCount == 0 {
o.GroupCount = uint32(len(o.GroupIDs))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *DomainGroupMembership) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if o.DomainID != nil {
_ptr_DomainId := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
if o.DomainID != nil {
if err := o.DomainID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.SID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.DomainID, _ptr_DomainId); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
if err := w.WriteData(o.GroupCount); err != nil {
return err
}
if o.GroupIDs != nil || o.GroupCount > 0 {
_ptr_GroupIds := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.GroupCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.GroupIDs {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.GroupIDs[i1] != nil {
if err := o.GroupIDs[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&GroupMembership{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.GroupIDs); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&GroupMembership{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.GroupIDs, _ptr_GroupIds); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *DomainGroupMembership) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
_ptr_DomainId := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
if o.DomainID == nil {
o.DomainID = &dtyp.SID{}
}
if err := o.DomainID.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
})
_s_DomainId := func(ptr interface{}) { o.DomainID = *ptr.(**dtyp.SID) }
if err := w.ReadPointer(&o.DomainID, _s_DomainId, _ptr_DomainId); err != nil {
return err
}
if err := w.ReadData(&o.GroupCount); err != nil {
return err
}
_ptr_GroupIds := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.GroupCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.GroupCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.GroupIDs", sizeInfo[0])
}
o.GroupIDs = make([]*GroupMembership, sizeInfo[0])
for i1 := range o.GroupIDs {
i1 := i1
if o.GroupIDs[i1] == nil {
o.GroupIDs[i1] = &GroupMembership{}
}
if err := o.GroupIDs[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_GroupIds := func(ptr interface{}) { o.GroupIDs = *ptr.(*[]*GroupMembership) }
if err := w.ReadPointer(&o.GroupIDs, _s_GroupIds, _ptr_GroupIds); err != nil {
return err
}
return nil
}
// PACType structure represents PACTYPE RPC structure.
//
// The PACTYPE structure is the topmost structure of the PAC and specifies the number
// of elements in the PAC_INFO_BUFFER (section 2.4) array. The PACTYPE structure serves
// as the header for the complete PAC data.
//
// The PACTYPE structure is defined as follows.
//
// The format of the PACTYPE structure is defined as follows.
//
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 3 | 1 |
// | | | | | | | | | | | 0 | | | | | | | | | | 0 | | | | | | | | | | 0 | |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | cBuffers |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | Version |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | Buffers (variable) |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | ... |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
type PACType struct {
// cBuffers (4 bytes): A 32-bit unsigned integer in little-endian format that defines
// the number of entries in the Buffers array.
BuffersCount uint32 `idl:"name:cBuffers" json:"buffers_count"`
// Version (4 bytes): A 32-bit unsigned integer in little-endian format that defines
// the PAC version; MUST be 0x00000000.
Version uint32 `idl:"name:Version" json:"version"`
// Buffers (variable): An array of PAC_INFO_BUFFER structures (section 2.4).
//
// The actual contents of the PAC are placed serially after the variable set of PAC_INFO_BUFFER
// structures. The contents are individually serialized PAC elements. All PAC elements
// MUST be placed on an 8-byte boundary.
Buffers []*PACInfoBuffer `idl:"name:Buffers;size_is:(cBuffers)" json:"buffers"`
}
func (o *PACType) xxx_PreparePayload(ctx context.Context) error {
if o.Buffers != nil && o.BuffersCount == 0 {
o.BuffersCount = uint32(len(o.Buffers))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *PACType) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(9); err != nil {
return err
}
if err := w.WriteData(o.BuffersCount); err != nil {
return err
}
if err := w.WriteData(o.Version); err != nil {
return err
}
if o.Buffers != nil || o.BuffersCount > 0 {
_ptr_Buffers := ndr.MarshalNDRFunc(func(ctx context.Context, w ndr.Writer) error {
dimSize1 := uint64(o.BuffersCount)
if err := w.WriteSize(dimSize1); err != nil {
return err
}
sizeInfo := []uint64{
dimSize1,
}
for i1 := range o.Buffers {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if o.Buffers[i1] != nil {
if err := o.Buffers[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&PACInfoBuffer{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Buffers); uint64(i1) < sizeInfo[0]; i1++ {
if err := (&PACInfoBuffer{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
if err := w.WritePointer(&o.Buffers, _ptr_Buffers); err != nil {
return err
}
} else {
if err := w.WritePointer(nil); err != nil {
return err
}
}
return nil
}
func (o *PACType) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(9); err != nil {
return err
}
if err := w.ReadData(&o.BuffersCount); err != nil {
return err
}
if err := w.ReadData(&o.Version); err != nil {
return err
}
_ptr_Buffers := ndr.UnmarshalNDRFunc(func(ctx context.Context, w ndr.Reader) error {
sizeInfo := []uint64{
0,
}
for sz1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[sz1]); err != nil {
return err
}
}
// XXX: for opaque unmarshaling
if o.BuffersCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.BuffersCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Buffers", sizeInfo[0])
}
o.Buffers = make([]*PACInfoBuffer, sizeInfo[0])
for i1 := range o.Buffers {
i1 := i1
if o.Buffers[i1] == nil {
o.Buffers[i1] = &PACInfoBuffer{}
}
if err := o.Buffers[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
})
_s_Buffers := func(ptr interface{}) { o.Buffers = *ptr.(*[]*PACInfoBuffer) }
if err := w.ReadPointer(&o.Buffers, _s_Buffers, _ptr_Buffers); err != nil {
return err
}
return nil
}
// PACInfoBuffer structure represents PAC_INFO_BUFFER RPC structure.
//
// Following the PACTYPE (section 2.3) structure is an array of PAC_INFO_BUFFER structures
// each of which defines the type and byte offset to a buffer of the PAC. The PAC_INFO_BUFFER
// array has no defined ordering. Therefore, the order of the PAC_INFO_BUFFER buffers
// has no significance. However, once the Key Distribution Center (KDC) and server signatures
// are generated, the ordering of the buffers MUST NOT change, or signature verification
// of the PAC contents will fail.
//
// The PAC_INFO_BUFFER structure is defined as follows.
//
// The format of the PAC_INFO_BUFFER structure is defined as follows.
//
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 3 | 1 |
// | | | | | | | | | | | 0 | | | | | | | | | | 0 | | | | | | | | | | 0 | |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | ulType |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | cbBufferSize |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | Offset |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | ... |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
type PACInfoBuffer struct {
// ulType (4 bytes): A 32-bit unsigned integer in little-endian format that describes
// the type of data present in the buffer contained at Offset. Types that are not understood
// MUST be ignored.
//
// +-----------------+----------------------------------------------------------------------------------+
// | | |
// | VALUE | MEANING |
// | | |
// +-----------------+----------------------------------------------------------------------------------+
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000001 (1) | Logon information (section 2.5). PAC structures MUST contain one buffer of this |
// | | type. Additional logon information buffers MUST be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000002 (2) | Credentials information (section 2.6). PAC structures SHOULD NOT contain more |
// | | than one buffer of this type, based on constraints specified in section 2.6. |
// | | Second or subsequent credentials information buffers MUST be ignored on receipt. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000006 (6) | Server checksum (section 2.8). PAC structures MUST contain one buffer of this |
// | | type for Kerberos ticket-granting service (TGS) requests or Kerberos application |
// | | protocol (AP) requests, and none otherwise. Additional logon server checksum |
// | | buffers MUST be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000007 (7) | KDC (privilege server) checksum (section 2.8). PAC structures MUST contain |
// | | one buffer of this type for Kerberos ticket-granting service (TGS) requests or |
// | | Kerberos application protocol (AP) requests, and none otherwise. Additional KDC |
// | | checksum buffers MUST be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x0000000A (10) | Client name and ticket information (section 2.7). PAC structures MUST contain |
// | | one buffer of this type. Additional client and ticket information buffers MUST |
// | | be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x0000000B (11) | Constrained delegation information (section 2.9). PAC structures MUST contain |
// | | one buffer of this type for Service for User to Proxy (S4U2proxy) [MS-SFU] |
// | | requests and none otherwise. Additional constrained delegation information |
// | | buffers MUST be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x0000000C (12) | User principal name (UPN) and Domain Name System (DNS) information (section |
// | | 2.10). PAC structures SHOULD NOT<3> contain more than one buffer of this type. |
// | | Second or subsequent UPN and DNS information buffers MUST be ignored on receipt. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x0000000D (13) | Client claims information (section 2.11). PAC structures SHOULD NOT<4> contain |
// | | more than one buffer of this type. Additional client claims information buffers |
// | | MUST be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x0000000E (14) | Device information (section 2.12). PAC structures SHOULD NOT<5> contain more |
// | | than one buffer of this type. Additional device information buffers MUST be |
// | | ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x0000000F (15) | Device claims information (section 2.13). PAC structures SHOULD NOT<6> contain |
// | | more than one buffer of this type. Additional device claims information buffers |
// | | MUST be ignored. |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000010 (16) | Ticket checksum (section 2.8). PAC structures MUST contain one buffer of this |
// | | type for Kerberos ticket-granting service (TGS) requests, and none otherwise. |
// | | Additional ticket checksum buffers MUST be ignored.<7> |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000011 (17) | PAC Attributes indicates that the buffer contains attribute bits for the PAC |
// | | (section 2.14). PAC structures SHOULD NOT contain more than one buffer of this |
// | | type. Additional attribute buffers MUST be ignored.<8> |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000012 (18) | PAC Requestor indicates that the buffer contains the SID of principal that |
// | | requested the PAC (section 2.15). PAC structures MUST contain one buffer of this |
// | | type.<9> |
// +-----------------+----------------------------------------------------------------------------------+
// | 0x00000013 (19) | Extended KDC (privilege server) checksum (section 2.8). PAC structures MUST |
// | | contain one buffer of this type for Kerberos ticket-granting service (TGS) |
// | | requests, and none otherwise. Additional Extended KDC checksum buffers MUST be |
// | | ignored.<10> |
// +-----------------+----------------------------------------------------------------------------------+
Type uint32 `idl:"name:ulType" json:"type"`
// cbBufferSize (4 bytes): A 32-bit unsigned integer in little-endian format that contains
// the size, in bytes, of the buffer in the PAC located at Offset.
BufferLength uint32 `idl:"name:cbBufferSize" json:"buffer_length"`
// Offset (8 bytes): A 64-bit unsigned integer in little-endian format that contains
// the offset to the beginning of the buffer, in bytes, from the beginning of the PACTYPE
// structure (section 2.3). The data offset MUST be a multiple of eight. The following
// sections specify the format of each type of element.
Offset uint64 `idl:"name:Offset" json:"offset"`
}
func (o *PACInfoBuffer) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *PACInfoBuffer) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(8); err != nil {
return err
}
if err := w.WriteData(o.Type); err != nil {
return err
}
if err := w.WriteData(o.BufferLength); err != nil {
return err
}
if err := w.WriteData(o.Offset); err != nil {
return err
}
return nil
}
func (o *PACInfoBuffer) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(8); err != nil {
return err
}
if err := w.ReadData(&o.Type); err != nil {
return err
}
if err := w.ReadData(&o.BufferLength); err != nil {
return err
}
if err := w.ReadData(&o.Offset); err != nil {
return err
}
return nil
}
// CypherBlock structure represents CYPHER_BLOCK RPC structure.
type CypherBlock struct {
Data []byte `idl:"name:data" json:"data"`
}
func (o *CypherBlock) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *CypherBlock) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= 8 {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < 8; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *CypherBlock) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
o.Data = make([]byte, 8)
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}
// UserSessionKey structure represents USER_SESSION_KEY RPC structure.
type UserSessionKey struct {
Data []*CypherBlock `idl:"name:data" json:"data"`
}
func (o *UserSessionKey) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *UserSessionKey) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= 2 {
break
}
if o.Data[i1] != nil {
if err := o.Data[i1].MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&CypherBlock{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
}
for i1 := len(o.Data); uint64(i1) < 2; i1++ {
if err := (&CypherBlock{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *UserSessionKey) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
o.Data = make([]*CypherBlock, 2)
for i1 := range o.Data {
i1 := i1
if o.Data[i1] == nil {
o.Data[i1] = &CypherBlock{}
}
if err := o.Data[i1].UnmarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
// KerberosValidationInfo structure represents KERB_VALIDATION_INFO RPC structure.
//
// The KERB_VALIDATION_INFO structure defines the user's logon and authorization information
// provided by the DC. A pointer to the KERB_VALIDATION_INFO structure is serialized
// into an array of bytes and then placed after the Buffers array of the topmost PACTYPE
// structure (section 2.3), at the offset specified in the Offset field of the corresponding
// PAC_INFO_BUFFER structure (section 2.4) in the Buffers array. The ulType field of
// the corresponding PAC_INFO_BUFFER structure is set to 0x00000001.
//
// The KERB_VALIDATION_INFO structure is a subset of the NETLOGON_VALIDATION_SAM_INFO4
// structure ([MS-NRPC] section 2.2.1.4.13). It is a subset due to historical reasons
// and to the use of Active Directory to generate this information. NTLM uses the NETLOGON_VALIDATION_SAM_INFO4
// structure in the context of the server to domain controller exchange, as defined
// in [MS-APDS] section 3.1. Consequently, the KERB_VALIDATION_INFO structure includes
// NTLM-specific fields. Fields that are common to the KERB_VALIDATION_INFO and the
// NETLOGON_VALIDATION_SAM_INFO4 structures, and which are specific to the NTLM authentication
// operation, are not used with [MS-KILE] authentication. The KERB_VALIDATION_INFO structure
// is marshaled by RPC [MS-RPCE].
//
// The KERB_VALIDATION_INFO structure is defined as follows.
type KerberosValidationInfo struct {
// LogonTime: A FILETIME structure that contains the user account's lastLogon attribute
// ([MS-ADA1] section 2.351) value.
LogonTime *dtyp.Filetime `idl:"name:LogonTime" json:"logon_time"`
// LogoffTime: A FILETIME structure that contains the time the client's logon session
// is set to expire. If the session is set not to expire, the dwHighDateTime member
// is set to 0x7FFFFFFF and the dwLowDateTime member set to 0xFFFFFFFF. A recipient
// of the PAC SHOULD<11> use this value as an indicator of when to warn the user that
// the allowed time is due to expire.
LogoffTime *dtyp.Filetime `idl:"name:LogoffTime" json:"logoff_time"`
// KickOffTime: A FILETIME structure that contains LogoffTime minus the user account's
// forceLogoff attribute ([MS-ADA1] section 2.233) value. If the client is not to be
// forcibly logged off, the dwHighDateTime member is set to 0x7FFFFFFF and the dwLowDateTime
// member set to 0xFFFFFFFF. The Kerberos service ticket end time is a replacement for
// KickOffTime. The service ticket lifetime SHOULD NOT<12> be set longer than the KickOffTime
// of an account. A recipient of the PAC uses this value as the indicator of when the
// client is to be forcibly disconnected.
KickOffTime *dtyp.Filetime `idl:"name:KickOffTime" json:"kick_off_time"`
// PasswordLastSet: A FILETIME structure that contains the user account's pwdLastSet
// attribute ([MS-ADA3] section 2.175) value. If the password was never set, this structure
// MUST have the dwHighDateTime member set to 0x00000000 and the dwLowDateTime member
// set to 0x00000000.
PasswordLastSet *dtyp.Filetime `idl:"name:PasswordLastSet" json:"password_last_set"`
// PasswordCanChange: A FILETIME structure that contains the time at which the client's
// password is allowed to change. If there is no restriction on when the client can
// change the password, this member MUST be set to zero.
PasswordCanChange *dtyp.Filetime `idl:"name:PasswordCanChange" json:"password_can_change"`
// PasswordMustChange: A FILETIME structure that contains the time at which the client's
// password expires. If the password will not expire, this structure MUST have the dwHighDateTime
// member set to 0x7FFFFFFF and the dwLowDateTime member set to 0xFFFFFFFF.
PasswordMustChange *dtyp.Filetime `idl:"name:PasswordMustChange" json:"password_must_change"`
// EffectiveName: An RPC_UNICODE_STRING structure that contains the user account's samAccountName
// attribute ([MS-ADA3] section 2.222) value.
EffectiveName *dtyp.UnicodeString `idl:"name:EffectiveName" json:"effective_name"`
// FullName: An RPC_UNICODE_STRING structure that contains the user account's full name
// for interactive logon and is set to zero for network logon. If FullName is omitted,
// this member MUST contain an RPC_UNICODE_STRING structure with the Length member set
// to zero.
FullName *dtyp.UnicodeString `idl:"name:FullName" json:"full_name"`
// LogonScript: An RPC_UNICODE_STRING structure that contains the user account's scriptPath
// attribute ([MS-ADA3] section 2.232) value for interactive logon and is set to zero
// for network logon. If no LogonScript is configured for the user, this member MUST
// contain an RPC_UNICODE_STRING structure with the Length member set to zero.
LogonScript *dtyp.UnicodeString `idl:"name:LogonScript" json:"logon_script"`
// ProfilePath: An RPC_UNICODE_STRING structure that contains the user account's profilePath
// attribute ([MS-ADA3] section 2.167) value for interactive logon and is set to zero
// for network logon. If no ProfilePath is configured for the user, this member MUST
// contain an RPC_UNICODE_STRING structure with the Length member set to zero.
ProfilePath *dtyp.UnicodeString `idl:"name:ProfilePath" json:"profile_path"`
// HomeDirectory: An RPC_UNICODE_STRING structure that contains the user account's HomeDirectory
// attribute ([MS-ADA1] section 2.295) value for interactive logon and is set to zero
// for network logon. If no HomeDirectory is configured for the user, this member MUST
// contain an RPC_UNICODE_STRING structure with the Length member set to zero.
HomeDirectory *dtyp.UnicodeString `idl:"name:HomeDirectory" json:"home_directory"`
// HomeDirectoryDrive: An RPC_UNICODE_STRING structure that contains the user account's
// HomeDrive attribute ([MS-ADA1] section 2.296) value for interactive logon and is
// set to zero for network logon. This member MUST be populated if HomeDirectory contains
// a UNC path. If no HomeDirectoryDrive is configured for the user, this member MUST
// contain an RPC_UNICODE_STRING structure with the Length member set to zero.
HomeDirectoryDrive *dtyp.UnicodeString `idl:"name:HomeDirectoryDrive" json:"home_directory_drive"`
// LogonCount: A 16-bit unsigned integer that contains the user account's LogonCount
// attribute ([MS-ADA1] section 2.375) value.
LogonCount uint16 `idl:"name:LogonCount" json:"logon_count"`
// BadPasswordCount: A 16-bit unsigned integer that contains the user account's badPwdCount
// attribute ([MS-ADA1] section 2.83) value for interactive logon and is set to zero
// for network logon.
BadPasswordCount uint16 `idl:"name:BadPasswordCount" json:"bad_password_count"`
// UserId: A 32-bit unsigned integer that contains the RID of the account. If the UserId
// member equals 0x00000000, the first group SID in this member is the SID for this
// account.
UserID uint32 `idl:"name:UserId" json:"user_id"`
// PrimaryGroupId: A 32-bit unsigned integer that contains the RID for the primary group
// to which this account belongs.
PrimaryGroupID uint32 `idl:"name:PrimaryGroupId" json:"primary_group_id"`
// GroupCount: A 32-bit unsigned integer that contains the number of groups within the
// account domain to which the account belongs.
GroupCount uint32 `idl:"name:GroupCount" json:"group_count"`
// GroupIds: A pointer to a list of GROUP_MEMBERSHIP (section 2.2.2) structures that
// contains the groups to which the account belongs in the account domain. The number
// of groups in this list MUST be equal to GroupCount.
GroupIDs []*GroupMembership `idl:"name:GroupIds;size_is:(GroupCount)" json:"group_ids"`
// UserFlags: A 32-bit unsigned integer that contains a set of bit flags that describe
// the user's logon information.
//
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 3 | 1 |
// | | | | | | | | | | | 0 | | | | | | | | | | 0 | | | | | | | | | | 0 | |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | L | K | J | I | H | G | F | E | D | 0 | C | 0 | B | A |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
//
// The following flags are set only when this structure is created as the result of
// an NTLM authentication, as specified in [MS-NLMP]. These flags MUST be zero for any
// other authentication protocol, such as [MS-KILE] authentication.
//
// +-------+----------------------------------------------------------------------------------+
// | | |
// | VALUE | DESCRIPTION |
// | | |