Debian Codegraph @

pac/device_claims.go

raw symbols SCIP
1 package pac
2
3 import (
4 "fmt"
5
6 "gopkg.in/jcmturner/gokrb5.v5/mstypes"
7 "gopkg.in/jcmturner/rpc.v0/ndr"
8 )
9
10 // DeviceClaimsInfo implements https://msdn.microsoft.com/en-us/library/hh554226.aspx
11 type DeviceClaimsInfo struct {
12 Claims mstypes.ClaimsSetMetadata
13 }
14
15 // Unmarshal bytes into the DeviceClaimsInfo struct
16 func (k *DeviceClaimsInfo) Unmarshal(b []byte) error {
17 ch, _, p, err := ndr.ReadHeaders(&b)
18 if err != nil {
19 return fmt.Errorf("error parsing byte stream headers of DEVICE_CLAIMS_INFO: %v", err)
20 }
21 e := &ch.Endianness
22 //The next 4 bytes are an RPC unique pointer referent. We just skip these
23 p += 4
24
25 k.Claims, err = mstypes.ReadClaimsSetMetadata(&b, &p, e)
26 if err != nil {
27 return err
28 }
29
30 //Check that there is only zero padding left
31 if len(b) >= p {
32 for _, v := range b[p:] {
33 if v != 0 {
34 return ndr.Malformed{EText: "non-zero padding left over at end of data stream"}
35 }
36 }
37 }
38 return nil
39 }