github.com/jcmturner/gokrb5/v8@v8.4.4/pac/device_info.go (about)

     1  package pac
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  
     7  	"github.com/jcmturner/rpc/v2/mstypes"
     8  	"github.com/jcmturner/rpc/v2/ndr"
     9  )
    10  
    11  // DeviceInfo implements https://msdn.microsoft.com/en-us/library/hh536402.aspx
    12  type DeviceInfo struct {
    13  	UserID            uint32                          // 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.
    14  	PrimaryGroupID    uint32                          // A 32-bit unsigned integer that contains the RID for the primary group to which this account belongs.
    15  	AccountDomainID   mstypes.RPCSID                  `ndr:"pointer"` // A SID structure that contains the SID for the domain of the account.This member is used in conjunction with the UserId, and GroupIds members to create the user and group SIDs for the client.
    16  	AccountGroupCount uint32                          // A 32-bit unsigned integer that contains the number of groups within the account domain to which the account belongs
    17  	AccountGroupIDs   []mstypes.GroupMembership       `ndr:"pointer,conformant"` // 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.
    18  	SIDCount          uint32                          // A 32-bit unsigned integer that contains the total number of SIDs present in the ExtraSids member.
    19  	ExtraSIDs         []mstypes.KerbSidAndAttributes  `ndr:"pointer,conformant"` // A pointer to a list of KERB_SID_AND_ATTRIBUTES structures that contain a list of SIDs corresponding to groups not in domains. If the UserId member equals 0x00000000, the first group SID in this member is the SID for this account.
    20  	DomainGroupCount  uint32                          // A 32-bit unsigned integer that contains the number of domains with groups to which the account belongs.
    21  	DomainGroup       []mstypes.DomainGroupMembership `ndr:"pointer,conformant"` // A pointer to a list of DOMAIN_GROUP_MEMBERSHIP structures (section 2.2.3) that contains the domains to which the account belongs to a group. The number of sets in this list MUST be equal to DomainCount.
    22  }
    23  
    24  // Unmarshal bytes into the DeviceInfo struct
    25  func (k *DeviceInfo) Unmarshal(b []byte) (err error) {
    26  	dec := ndr.NewDecoder(bytes.NewReader(b))
    27  	err = dec.Decode(k)
    28  	if err != nil {
    29  		err = fmt.Errorf("error unmarshaling DeviceInfo: %v", err)
    30  	}
    31  	return
    32  }