mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-06 00:01:35 +00:00
A socks inbound with a username checked it on SOCKS5 TCP and nowhere else. SOCKS4 has no password, and was accepted anyway, so any client could skip the check by speaking the older protocol. The UDP relay answered datagrams from any address. And a username with no password panicked on the right username, which a release build turns into an abort. With a username set, SOCKS4 is now refused, and the relay drops datagrams from any IP address without an open, authenticated UDP ASSOCIATE connection, as RFC 1928 asks; the association ends with that connection. It is open before the reply goes out, since a client may send its first datagram the moment it reads the reply. A username without a password means an empty password, and a password without a username is a configuration error instead of silently turning authentication off. The UDP check is by IP address, since a client's sending port is not known in advance; the docs say what that leaves open.