Debian Codegraph @

pac/s4u_delegation_info.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 // S4UDelegationInfo implements https://msdn.microsoft.com/en-us/library/cc237944.aspx
11 type S4UDelegationInfo struct {
12 S4U2proxyTarget mstypes.RPCUnicodeString // The name of the principal to whom the application can forward the ticket.
13 TransitedListSize uint32
14 S4UTransitedServices []mstypes.RPCUnicodeString // List of all services that have been delegated through by this client and subsequent services or servers.. Size is value of TransitedListSize
15 }
16
17 // Unmarshal bytes into the S4UDelegationInfo struct
18 func (k *S4UDelegationInfo) Unmarshal(b []byte) error {
19 ch, _, p, err := ndr.ReadHeaders(&b)
20 if err != nil {
21 return fmt.Errorf("error parsing byte stream headers: %v", err)
22 }
23 e := &ch.Endianness
24
25 //The next 4 bytes are an RPC unique pointer referent. We just skip these
26 p += 4
27
28 k.S4U2proxyTarget, err = mstypes.ReadRPCUnicodeString(&b, &p, e)
29 if err != nil {
30 return err
31 }
32 k.TransitedListSize = ndr.ReadUint32(&b, &p, e)
33 if k.TransitedListSize > 0 {
34 ts := make([]mstypes.RPCUnicodeString, k.TransitedListSize, k.TransitedListSize)
35 for i := range ts {
36 ts[i], err = mstypes.ReadRPCUnicodeString(&b, &p, e)
37 if err != nil {
38 return err
39 }
40 }
41 for i := range ts {
42 ts[i].UnmarshalString(&b, &p, e)
43 }
44 k.S4UTransitedServices = ts
45 }
46
47 //Check that there is only zero padding left
48 for _, v := range b[p:] {
49 if v != 0 {
50 return ndr.Malformed{EText: "non-zero padding left over at end of data stream"}
51 }
52 }
53
54 return nil
55 }