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