Fix: panic of socks5 client missing authentication

This commit is contained in:
Dreamacro 2020-06-03 18:49:20 +08:00
parent fb0289bb4c
commit 147a7ce779

View file

@ -229,6 +229,10 @@ func ClientHandshake(rw io.ReadWriter, addr Addr, command Command, user *User) (
} }
if buf[1] == 2 { if buf[1] == 2 {
if user == nil {
return nil, ErrAuth
}
// password protocol version // password protocol version
authMsg := &bytes.Buffer{} authMsg := &bytes.Buffer{}
authMsg.WriteByte(1) authMsg.WriteByte(1)