client_info.go 1021 B

12345678910111213141516171819202122232425262728293031
  1. package pac
  2. import (
  3. "bytes"
  4. "github.com/jcmturner/rpc/v2/mstypes"
  5. )
  6. // ClientInfo implements https://msdn.microsoft.com/en-us/library/cc237951.aspx
  7. type ClientInfo struct {
  8. ClientID mstypes.FileTime // A FILETIME structure in little-endian format that contains the Kerberos initial ticket-granting ticket TGT authentication time
  9. NameLength uint16 // An unsigned 16-bit integer in little-endian format that specifies the length, in bytes, of the Name field.
  10. Name string // An array of 16-bit Unicode characters in little-endian format that contains the client's account name.
  11. }
  12. // Unmarshal bytes into the ClientInfo struct
  13. func (k *ClientInfo) Unmarshal(b []byte) (err error) {
  14. //The PAC_CLIENT_INFO structure is a simple structure that is not NDR-encoded.
  15. r := mstypes.NewReader(bytes.NewReader(b))
  16. k.ClientID, err = r.FileTime()
  17. if err != nil {
  18. return
  19. }
  20. k.NameLength, err = r.Uint16()
  21. if err != nil {
  22. return
  23. }
  24. k.Name, err = r.UTF16String(int(k.NameLength))
  25. return
  26. }