gsocks5proxy: Fix SOCKS5 username/password authentication

It was checking for the main SOCKS5 version number, rather than the
subnegotiation version number. The username/password authentication
protocol is described in https://tools.ietf.org/html/rfc1929.

Spotted and diagnosed by lovetox.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1986
This commit is contained in:
Philip Withnall 2020-02-27 12:16:41 +00:00
parent 67610c7c0f
commit 423b2bbc95

View File

@ -229,7 +229,7 @@ set_auth_msg (guint8 *msg,
static gboolean static gboolean
check_auth_status (const guint8 *data, GError **error) check_auth_status (const guint8 *data, GError **error)
{ {
if (data[0] != SOCKS5_VERSION if (data[0] != SOCKS5_AUTH_VERSION
|| data[1] != SOCKS5_REP_SUCCEEDED) || data[1] != SOCKS5_REP_SUCCEEDED)
{ {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PROXY_AUTH_FAILED, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PROXY_AUTH_FAILED,