From b00ecb1d7afd1f0ae60d2215f33161e535931eb4 Mon Sep 17 00:00:00 2001 From: iseki Date: Wed, 14 Dec 2022 02:01:33 +0800 Subject: [PATCH] socks: SOCKS5 proxy with empty password should be allowed The behavior is accepted widely, and I found no reason to deny it. Fixes #57285 --- internal/socks/socks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/socks/socks.go b/internal/socks/socks.go index 97db2340ec..84fcc32b63 100644 --- a/internal/socks/socks.go +++ b/internal/socks/socks.go @@ -289,7 +289,7 @@ func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, case AuthMethodNotRequired: return nil case AuthMethodUsernamePassword: - if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) == 0 || len(up.Password) > 255 { + if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) > 255 { return errors.New("invalid username/password") } b := []byte{authUsernamePasswordVersion}