From 42f28ab8e374137fe3f5d25424489d879d4724f8 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 21 Jun 2017 19:06:17 -0700 Subject: Updating server dependancies (#6712) --- vendor/github.com/go-ldap/ldap/Makefile | 12 +------- vendor/github.com/go-ldap/ldap/atomic_value.go | 13 --------- .../github.com/go-ldap/ldap/atomic_value_go13.go | 28 ------------------ vendor/github.com/go-ldap/ldap/conn.go | 33 ++++++++-------------- vendor/github.com/go-ldap/ldap/conn_test.go | 6 +++- vendor/github.com/go-ldap/ldap/error.go | 7 ----- vendor/github.com/go-ldap/ldap/example_test.go | 2 +- 7 files changed, 18 insertions(+), 83 deletions(-) delete mode 100644 vendor/github.com/go-ldap/ldap/atomic_value.go delete mode 100644 vendor/github.com/go-ldap/ldap/atomic_value_go13.go (limited to 'vendor/github.com/go-ldap') diff --git a/vendor/github.com/go-ldap/ldap/Makefile b/vendor/github.com/go-ldap/ldap/Makefile index f7899f59a..c1fc96657 100644 --- a/vendor/github.com/go-ldap/ldap/Makefile +++ b/vendor/github.com/go-ldap/ldap/Makefile @@ -1,15 +1,5 @@ .PHONY: default install build test quicktest fmt vet lint -GO_VERSION := $(shell go version | cut -d' ' -f3 | cut -d. -f2) - -# Only use the `-race` flag on newer versions of Go -IS_OLD_GO := $(shell test $(GO_VERSION) -le 2 && echo true) -ifeq ($(IS_OLD_GO),true) - RACE_FLAG := -else - RACE_FLAG := -race -endif - default: fmt vet lint build quicktest install: @@ -19,7 +9,7 @@ build: go build -v ./... test: - go test -v $(RACE_FLAG) -cover ./... + go test -v -cover ./... quicktest: go test ./... diff --git a/vendor/github.com/go-ldap/ldap/atomic_value.go b/vendor/github.com/go-ldap/ldap/atomic_value.go deleted file mode 100644 index bccf7573e..000000000 --- a/vendor/github.com/go-ldap/ldap/atomic_value.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build go1.4 - -package ldap - -import ( - "sync/atomic" -) - -// For compilers that support it, we just use the underlying sync/atomic.Value -// type. -type atomicValue struct { - atomic.Value -} diff --git a/vendor/github.com/go-ldap/ldap/atomic_value_go13.go b/vendor/github.com/go-ldap/ldap/atomic_value_go13.go deleted file mode 100644 index 04920bb26..000000000 --- a/vendor/github.com/go-ldap/ldap/atomic_value_go13.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build !go1.4 - -package ldap - -import ( - "sync" -) - -// This is a helper type that emulates the use of the "sync/atomic.Value" -// struct that's available in Go 1.4 and up. -type atomicValue struct { - value interface{} - lock sync.RWMutex -} - -func (av *atomicValue) Store(val interface{}) { - av.lock.Lock() - av.value = val - av.lock.Unlock() -} - -func (av *atomicValue) Load() interface{} { - av.lock.RLock() - ret := av.value - av.lock.RUnlock() - - return ret -} diff --git a/vendor/github.com/go-ldap/ldap/conn.go b/vendor/github.com/go-ldap/ldap/conn.go index e701a9b66..b5bd99adb 100644 --- a/vendor/github.com/go-ldap/ldap/conn.go +++ b/vendor/github.com/go-ldap/ldap/conn.go @@ -11,7 +11,6 @@ import ( "log" "net" "sync" - "sync/atomic" "time" "gopkg.in/asn1-ber.v1" @@ -83,8 +82,8 @@ const ( type Conn struct { conn net.Conn isTLS bool - closeCount uint32 - closeErr atomicValue + isClosing bool + closeErr error isStartingTLS bool Debug debugging chanConfirm chan bool @@ -159,20 +158,10 @@ func (l *Conn) Start() { l.wgClose.Add(1) } -// isClosing returns whether or not we're currently closing. -func (l *Conn) isClosing() bool { - return atomic.LoadUint32(&l.closeCount) > 0 -} - -// setClosing sets the closing value to true -func (l *Conn) setClosing() { - atomic.AddUint32(&l.closeCount, 1) -} - // Close closes the connection. func (l *Conn) Close() { l.once.Do(func() { - l.setClosing() + l.isClosing = true l.wgSender.Wait() l.Debug.Printf("Sending quit message and waiting for confirmation") @@ -269,7 +258,7 @@ func (l *Conn) sendMessage(packet *ber.Packet) (*messageContext, error) { } func (l *Conn) sendMessageWithFlags(packet *ber.Packet, flags sendMessageFlags) (*messageContext, error) { - if l.isClosing() { + if l.isClosing { return nil, NewError(ErrorNetwork, errors.New("ldap: connection closed")) } l.messageMutex.Lock() @@ -308,7 +297,7 @@ func (l *Conn) sendMessageWithFlags(packet *ber.Packet, flags sendMessageFlags) func (l *Conn) finishMessage(msgCtx *messageContext) { close(msgCtx.done) - if l.isClosing() { + if l.isClosing { return } @@ -327,7 +316,7 @@ func (l *Conn) finishMessage(msgCtx *messageContext) { } func (l *Conn) sendProcessMessage(message *messagePacket) bool { - if l.isClosing() { + if l.isClosing { return false } l.wgSender.Add(1) @@ -344,8 +333,8 @@ func (l *Conn) processMessages() { for messageID, msgCtx := range l.messageContexts { // If we are closing due to an error, inform anyone who // is waiting about the error. - if l.isClosing() && l.closeErr.Load() != nil { - msgCtx.sendResponse(&PacketResponse{Error: l.closeErr.Load().(error)}) + if l.isClosing && l.closeErr != nil { + msgCtx.sendResponse(&PacketResponse{Error: l.closeErr}) } l.Debug.Printf("Closing channel for MessageID %d", messageID) close(msgCtx.responses) @@ -408,7 +397,7 @@ func (l *Conn) processMessages() { if msgCtx, ok := l.messageContexts[message.MessageID]; ok { msgCtx.sendResponse(&PacketResponse{message.Packet, nil}) } else { - log.Printf("Received unexpected message %d, %v", message.MessageID, l.isClosing()) + log.Printf("Received unexpected message %d, %v", message.MessageID, l.isClosing) ber.PrintPacket(message.Packet) } case MessageTimeout: @@ -450,8 +439,8 @@ func (l *Conn) reader() { packet, err := ber.ReadPacket(l.conn) if err != nil { // A read error is expected here if we are closing the connection... - if !l.isClosing() { - l.closeErr.Store(fmt.Errorf("unable to read LDAP response packet: %s", err)) + if !l.isClosing { + l.closeErr = fmt.Errorf("unable to read LDAP response packet: %s", err) l.Debug.Printf("reader error: %s", err.Error()) } return diff --git a/vendor/github.com/go-ldap/ldap/conn_test.go b/vendor/github.com/go-ldap/ldap/conn_test.go index 30554d23c..10766bbd4 100644 --- a/vendor/github.com/go-ldap/ldap/conn_test.go +++ b/vendor/github.com/go-ldap/ldap/conn_test.go @@ -60,7 +60,7 @@ func TestUnresponsiveConnection(t *testing.T) { // TestFinishMessage tests that we do not enter deadlock when a goroutine makes // a request but does not handle all responses from the server. -func TestFinishMessage(t *testing.T) { +func TestConn(t *testing.T) { ptc := newPacketTranslatorConn() defer ptc.Close() @@ -174,12 +174,16 @@ func testSendUnhandledResponsesAndFinish(t *testing.T, ptc *packetTranslatorConn } func runWithTimeout(t *testing.T, timeout time.Duration, f func()) { + runtime.Gosched() + done := make(chan struct{}) go func() { f() close(done) }() + runtime.Gosched() + select { case <-done: // Success! case <-time.After(timeout): diff --git a/vendor/github.com/go-ldap/ldap/error.go b/vendor/github.com/go-ldap/ldap/error.go index 4cccb537f..ff697873d 100644 --- a/vendor/github.com/go-ldap/ldap/error.go +++ b/vendor/github.com/go-ldap/ldap/error.go @@ -97,13 +97,6 @@ var LDAPResultCodeMap = map[uint8]string{ LDAPResultObjectClassModsProhibited: "Object Class Mods Prohibited", LDAPResultAffectsMultipleDSAs: "Affects Multiple DSAs", LDAPResultOther: "Other", - - ErrorNetwork: "Network Error", - ErrorFilterCompile: "Filter Compile Error", - ErrorFilterDecompile: "Filter Decompile Error", - ErrorDebugging: "Debugging Error", - ErrorUnexpectedMessage: "Unexpected Message", - ErrorUnexpectedResponse: "Unexpected Response", } func getLDAPResultCode(packet *ber.Packet) (code uint8, description string) { diff --git a/vendor/github.com/go-ldap/ldap/example_test.go b/vendor/github.com/go-ldap/ldap/example_test.go index 821189bd6..b018a9664 100644 --- a/vendor/github.com/go-ldap/ldap/example_test.go +++ b/vendor/github.com/go-ldap/ldap/example_test.go @@ -193,7 +193,7 @@ func Example_userAuthentication() { searchRequest := ldap.NewSearchRequest( "dc=example,dc=com", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, - fmt.Sprintf("(&(objectClass=organizationalPerson)(uid=%s))", username), + fmt.Sprintf("(&(objectClass=organizationalPerson)&(uid=%s))", username), []string{"dn"}, nil, ) -- cgit v1.2.3-1-g7c22