1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-17 23:06:30 -05:00

disable socks 4 when auth is required.

This commit is contained in:
Darien Raymond 2018-02-23 13:55:56 +01:00
parent 16c6a5f078
commit 768e30c37b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -49,6 +49,11 @@ func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol
version := buffer.Byte(0) version := buffer.Byte(0)
if version == socks4Version { if version == socks4Version {
if s.config.AuthType == AuthType_PASSWORD {
writeSocks4Response(writer, socks4RequestRejected, net.AnyIP, net.Port(0))
return nil, newError("socks 4 is not allowed when auth is required.")
}
if err := buffer.AppendSupplier(buf.ReadFullFrom(reader, 6)); err != nil { if err := buffer.AppendSupplier(buf.ReadFullFrom(reader, 6)); err != nil {
return nil, newError("insufficient header").Base(err) return nil, newError("insufficient header").Base(err)
} }