From 74938dc4283fcca7795cd2bc981f0b81e6bf7446 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sun, 8 Jan 2017 23:19:03 +0100 Subject: [PATCH] write back error status when authentication timeout --- proxy/socks/protocol.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/proxy/socks/protocol.go b/proxy/socks/protocol.go index b5452f9d..bf61910a 100644 --- a/proxy/socks/protocol.go +++ b/proxy/socks/protocol.go @@ -105,10 +105,7 @@ func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol if expectedAuth == authPassword { username, password, err := readUsernamePassword(reader) - if err != nil { - return nil, errors.Base(err).Message("Socks|Server: Failed to read username or password.") - } - if !s.config.HasAccount(username, password) { + if err != nil || !s.config.HasAccount(username, password) { writeSocks5AuthenticationResponse(writer, 0xFF) return nil, errors.Base(err).Message("Socks|Server: Invalid username or password.") }