From c651664720d1fc21aeb36ca8dbb625a874af1d97 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Tue, 29 May 2018 19:17:41 +0100 Subject: [PATCH] fix socks5 upstream user/pass subnegotiation check RFC 1929 specifies that the user/pass auth subnegotation repurposes the version field for the version of that specification, which is 1, not 5. however there's quite a good deal of software out there which got it wrong and replies with version 5 to a successful authentication, so let's just accept both forms - other socks5 client programs like curl do the same. closes #172 --- src/reqs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reqs.c b/src/reqs.c index 202f77f..bbdcc74 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -1350,7 +1350,7 @@ connect_to_upstream_proxy(struct conn_s *connptr, struct request_s *request) if(2 != safe_read(connptr->server_fd, in, 2)) return -1; - if(in[0] != 5 || in[1] != 0) { + if(in[1] != 0 || !(in[0] == 5 || in[0] == 1)) { return -1; } }