File: negotiate_message.go

package info (click to toggle)
golang-github-azure-go-ntlmssp 0.0~git20160412.e0b63eb-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 108 kB
  • ctags: 90
  • sloc: makefile: 5
file content (31 lines) | stat: -rw-r--r-- 652 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
package ntlmssp

import (
	"bytes"
	"encoding/binary"
)

type negotiateMessageFields struct {
	messageHeader
	NegotiateFlags negotiateFlags
}

//NewNegotiateMessage creates a new NEGOTIATE message with the
//flags that this package supports.
func NewNegotiateMessage() []byte {
	m := negotiateMessageFields{
		messageHeader: newMessageHeader(1),
	}

	m.NegotiateFlags = negotiateFlagNTLMSSPREQUESTTARGET |
		negotiateFlagNTLMSSPNEGOTIATENTLM |
		negotiateFlagNTLMSSPNEGOTIATEALWAYSSIGN |
		negotiateFlagNTLMSSPNEGOTIATEUNICODE

	b := bytes.Buffer{}
	err := binary.Write(&b, binary.LittleEndian, &m)
	if err != nil {
		panic(err)
	}
	return b.Bytes()
}