File: pac_info_buffer.go

package info (click to toggle)
golang-gopkg-jcmturner-gokrb5.v5 5.3.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, bullseye-backports, sid
  • size: 1,168 kB
  • sloc: makefile: 2
file content (39 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (2)
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
package pac

import (
	"encoding/binary"

	"gopkg.in/jcmturner/rpc.v0/ndr"
)

const (
	ulTypeKerbValidationInfo     = 1
	ulTypeCredentials            = 2
	ulTypePACServerSignatureData = 6
	ulTypePACKDCSignatureData    = 7
	ulTypePACClientInfo          = 10
	ulTypeS4UDelegationInfo      = 11
	ulTypeUPNDNSInfo             = 12
	ulTypePACClientClaimsInfo    = 13
	ulTypePACDeviceInfo          = 14
	ulTypePACDeviceClaimsInfo    = 15
)

// InfoBuffer implements the PAC Info Buffer: https://msdn.microsoft.com/en-us/library/cc237954.aspx
type InfoBuffer struct {
	ULType       uint32
	CBBufferSize uint32
	Offset       uint64
}

// ReadPACInfoBuffer reads a InfoBuffer from the byte slice.
func ReadPACInfoBuffer(b *[]byte, p *int, e *binary.ByteOrder) InfoBuffer {
	u := ndr.ReadUint32(b, p, e)
	s := ndr.ReadUint32(b, p, e)
	o := ndr.ReadUint64(b, p, e)
	return InfoBuffer{
		ULType:       u,
		CBBufferSize: s,
		Offset:       o,
	}
}