diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..8433d36 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,91 @@ +version: 2.1 + +orbs: + win: circleci/windows@1.0.0 + +workflows: + workflow: + jobs: + - go-test: + name: Go 1.14 + docker-image: circleci/golang:1.14 + - go-test: + name: Go 1.13 + docker-image: circleci/golang:1.13 + - go-test: + name: Go 1.12 + docker-image: circleci/golang:1.12 + - go-test: + name: Go 1.11 + docker-image: circleci/golang:1.11 + - go-test: + name: Go 1.10 + docker-image: circleci/golang:1.10 + - go-test: + name: Go 1.9 + docker-image: circleci/golang:1.9 + - go-test: + name: Go 1.8 + docker-image: circleci/golang:1.8 + - go-test-windows: + name: Windows + +jobs: + go-test: + parameters: + docker-image: + type: string + + docker: + - image: <> + environment: + CIRCLE_TEST_REPORTS: /tmp/circle-reports + CIRCLE_ARTIFACTS: /tmp/circle-artifacts + COMMON_GO_PACKAGES: > + github.com/jstemmer/go-junit-report + + working_directory: /go/src/github.com/launchdarkly/go-ntlmssp + + steps: + - checkout + - run: go get -u $COMMON_GO_PACKAGES + - run: go get -t . + + - run: + name: Run tests + command: | + mkdir -p $CIRCLE_TEST_REPORTS + mkdir -p $CIRCLE_ARTIFACTS + trap "go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml" EXIT + go test -v -race | tee $CIRCLE_ARTIFACTS/report.txt + + - store_test_results: + path: /tmp/circle-reports + + - store_artifacts: + path: /tmp/circle-artifacts + + go-test-windows: + executor: + name: win/vs2019 + shell: powershell.exe + + environment: + GOPATH: C:\Users\VssAdministrator\go + PACKAGE_PATH: github.com/launchdarkly/go-ntlmssp + + steps: + - checkout + - run: go version + - run: + name: move source + command: | + go env GOPATH + mkdir ${env:GOPATH}\src\${env:PACKAGE_PATH} + mv * ${env:GOPATH}\src\${env:PACKAGE_PATH} + - run: + name: build and test + command: | + cd ${env:GOPATH}\src\${env:PACKAGE_PATH} + go get -t . + go test -v -race ./... diff --git a/README.md b/README.md index 55cdcef..5bb7d5f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # go-ntlmssp Golang package that provides NTLM/Negotiate authentication over HTTP -[![GoDoc](https://godoc.org/github.com/Azure/go-ntlmssp?status.svg)](https://godoc.org/github.com/Azure/go-ntlmssp) [![Build Status](https://travis-ci.org/Azure/go-ntlmssp.svg?branch=dev)](https://travis-ci.org/Azure/go-ntlmssp) +[![GoDoc](https://godoc.org/github.com/launchdarkly/go-ntlmssp?status.svg)](https://godoc.org/github.com/launchdarkly/go-ntlmssp) [![Circle CI](https://circleci.com/gh/launchdarkly/go-ntlmssp.svg?style=svg)](https://circleci.com/gh/launchdarkly/go-ntlmssp) + +This is a fork of [github.com/Azure/go-ntlmssp](https://github.com/Azure/go-ntlmssp), with minor changes for use in the [LaunchDarkly Go SDK](https://github.com/launchdarkly/go-server-sdk). Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx Implementation hints from http://davenport.sourceforge.net/ntlm.html diff --git a/nlmp_test.go b/nlmp_test.go index b025ccc..22db2dd 100644 --- a/nlmp_test.go +++ b/nlmp_test.go @@ -25,21 +25,21 @@ func TestUsernameDomainWorkstation(t *testing.T) { xb []byte }{ {username, "", username, "", []byte{ - 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x82, 0x88, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f}}, {domain + "\\" + username, "", username, domain, []byte{ - 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, + 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x92, 0x88, 0xa0, 0x08, 0x00, 0x08, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0x59, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e}}, {domain + "\\" + username, workstation, username, domain, []byte{ - 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x30, + 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xb2, 0x88, 0xa0, 0x08, 0x00, 0x08, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x30, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0x59, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x4d, 0x59, 0x50, 0x43}}, {username, workstation, username, "", []byte{ - 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x20, + 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xa2, 0x88, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0x59, 0x50, 0x43}}, @@ -48,10 +48,10 @@ func TestUsernameDomainWorkstation(t *testing.T) { for _, table := range tables { tuser, tdomain := GetDomain(table.u) if tuser != table.xu { - t.Fatalf("username not correct, expected %v got %v", tuser, table.xu) + t.Fatalf("username not correct, expected %v got %v", table.xu, tuser) } if tdomain != table.xd { - t.Fatalf("domain not correct, expected %v got %v", tdomain, table.xd) + t.Fatalf("domain not correct, expected %v got %v", table.xd, tdomain) } tb, err := NewNegotiateMessage(tdomain, table.w) @@ -60,7 +60,7 @@ func TestUsernameDomainWorkstation(t *testing.T) { } if !bytes.Equal(tb, table.xb) { - t.Fatalf("negotiate message bytes not correct, expected %v got %v", tb, table.xb) + t.Fatalf("negotiate message bytes not correct, expected %v got %v", table.xb, tb) } }