github.com/psiphon-labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/upstreamproxy/go-ntlm/ntlm/negotiate_flags_test.go (about)

     1  //Copyright 2013 Thomson Reuters Global Resources. BSD License please see License file for more information
     2  
     3  package ntlm
     4  
     5  import (
     6  	"encoding/binary"
     7  	"encoding/hex"
     8  	"testing"
     9  )
    10  
    11  func TestFlags(t *testing.T) {
    12  	// Sample value from 4.2.2 NTLM v1 Authentication
    13  	bytes, _ := hex.DecodeString("338202e2")
    14  
    15  	flags := uint32(0)
    16  	flags = NTLMSSP_NEGOTIATE_KEY_EXCH.Set(flags)
    17  	flags = NTLMSSP_NEGOTIATE_56.Set(flags)
    18  	flags = NTLMSSP_NEGOTIATE_128.Set(flags)
    19  	flags = NTLMSSP_NEGOTIATE_VERSION.Set(flags)
    20  	flags = NTLMSSP_TARGET_TYPE_SERVER.Set(flags)
    21  	flags = NTLMSSP_NEGOTIATE_ALWAYS_SIGN.Set(flags)
    22  	flags = NTLMSSP_NEGOTIATE_NTLM.Set(flags)
    23  	flags = NTLMSSP_NEGOTIATE_SEAL.Set(flags)
    24  	flags = NTLMSSP_NEGOTIATE_SIGN.Set(flags)
    25  	flags = NTLM_NEGOTIATE_OEM.Set(flags)
    26  	flags = NTLMSSP_NEGOTIATE_UNICODE.Set(flags)
    27  
    28  	if flags != binary.LittleEndian.Uint32(bytes) {
    29  		t.Error("NTLM Flags are not correct")
    30  	}
    31  }