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
This commit is contained in:
rofl0r authored and Michael Adam committed 2018-05-29 21:59:11 +02:00
1 parent 0aad2f5b92
commit c651664720
1 file changed
+1 -1
+1 -1
View File
@@ -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;
}
}