From 5cee7273085f0f2e23a3cd0c8c5b7501238a6817 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Sat, 10 Oct 2015 22:31:25 +0200 Subject: [PATCH] Fix socks authentication --- proxy/socks/socks.go | 2 +- proxy/socks/socks_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/socks/socks.go b/proxy/socks/socks.go index b09db9845..85f65577d 100644 --- a/proxy/socks/socks.go +++ b/proxy/socks/socks.go @@ -103,7 +103,7 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W return err } status := byte(0) - if server.config.HasAccount(upRequest.Username(), upRequest.Password()) { + if !server.config.HasAccount(upRequest.Username(), upRequest.Password()) { status = byte(0xFF) } upResponse := protocol.NewSocks5UserPassResponse(status) diff --git a/proxy/socks/socks_test.go b/proxy/socks/socks_test.go index 200770d3c..8ed4325c5 100644 --- a/proxy/socks/socks_test.go +++ b/proxy/socks/socks_test.go @@ -83,7 +83,7 @@ func TestSocksTcpConnectWithUserPass(t *testing.T) { InboundConfigValue: &mocks.ConnectionConfig{ ProtocolValue: "socks", SettingsValue: &json.SocksConfig{ - AuthMethod: "noauth", + AuthMethod: "password", Accounts: []json.SocksAccount{ json.SocksAccount{ Username: "userx",