From bcccbed56dbad7d7de7c9129ddd9f0f0550a68a5 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 9 Jun 2020 11:00:57 -0700 Subject: [PATCH 1/6] add fork explanation to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 55cdcef..092efcd 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ 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) +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 From 7b9f3e3dc3849d544d5a1d9d80c7000cb3936b3d Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 9 Jun 2020 11:10:30 -0700 Subject: [PATCH 2/6] add CircleCI config --- .circleci/config.yml | 89 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..47a60cb --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,89 @@ +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-test-helpers + + steps: + - checkout + - run: go get -u $COMMON_GO_PACKAGES + + - 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-test-helpers + + 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 test -v -race ./... diff --git a/README.md b/README.md index 092efcd..5bb7d5f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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). From 30c6b592654079bf67283e297cc6cad1e6fae8c0 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 9 Jun 2020 11:12:03 -0700 Subject: [PATCH 3/6] add go get step --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47a60cb..20e5e65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,7 @@ jobs: steps: - checkout - run: go get -u $COMMON_GO_PACKAGES + - run: go get -t . - run: name: Run tests @@ -86,4 +87,5 @@ jobs: name: build and test command: | cd ${env:GOPATH}\src\${env:PACKAGE_PATH} + go get -t . go test -v -race ./... From 8deb8dc7e5c6acc66316655075984632f858f050 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 9 Jun 2020 11:20:01 -0700 Subject: [PATCH 4/6] change unit test expectation to match current encoding behavior --- nlmp_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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) } } From 1f3f29dec2b38f5ab690e477dc65e9eeee8c6b16 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 9 Jun 2020 11:32:04 -0700 Subject: [PATCH 5/6] fix copy-paste error --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 20e5e65..3752227 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ jobs: COMMON_GO_PACKAGES: > github.com/jstemmer/go-junit-report - working_directory: /go/src/github.com/launchdarkly/go-test-helpers + working_directory: /go/src/github.com/launchdarkly/go-ntlmssp steps: - checkout From 28c7ea45cdc6e33162582069a61819e7c2c3297d Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 9 Jun 2020 11:32:56 -0700 Subject: [PATCH 6/6] fix copy-paste error again --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3752227..8433d36 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ jobs: environment: GOPATH: C:\Users\VssAdministrator\go - PACKAGE_PATH: github.com/launchdarkly/go-test-helpers + PACKAGE_PATH: github.com/launchdarkly/go-ntlmssp steps: - checkout