1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

socks: Fix incorrect port numbers in failed connect messages

This commit is contained in:
Jay Satiro 2015-10-27 02:39:00 -04:00
parent ea2c959db4
commit e2f430c74a

View File

@ -300,8 +300,8 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
", request rejected or failed.", ", request rejected or failed.",
(unsigned char)socksreq[4], (unsigned char)socksreq[5], (unsigned char)socksreq[4], (unsigned char)socksreq[5],
(unsigned char)socksreq[6], (unsigned char)socksreq[7], (unsigned char)socksreq[6], (unsigned char)socksreq[7],
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
case 92: case 92:
failf(data, failf(data,
@ -310,8 +310,8 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
"identd on the client.", "identd on the client.",
(unsigned char)socksreq[4], (unsigned char)socksreq[5], (unsigned char)socksreq[4], (unsigned char)socksreq[5],
(unsigned char)socksreq[6], (unsigned char)socksreq[7], (unsigned char)socksreq[6], (unsigned char)socksreq[7],
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
case 93: case 93:
failf(data, failf(data,
@ -320,8 +320,8 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
"report different user-ids.", "report different user-ids.",
(unsigned char)socksreq[4], (unsigned char)socksreq[5], (unsigned char)socksreq[4], (unsigned char)socksreq[5],
(unsigned char)socksreq[6], (unsigned char)socksreq[7], (unsigned char)socksreq[6], (unsigned char)socksreq[7],
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
default: default:
failf(data, failf(data,
@ -329,8 +329,8 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
", Unknown.", ", Unknown.",
(unsigned char)socksreq[4], (unsigned char)socksreq[5], (unsigned char)socksreq[4], (unsigned char)socksreq[5],
(unsigned char)socksreq[6], (unsigned char)socksreq[7], (unsigned char)socksreq[6], (unsigned char)socksreq[7],
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
} }
@ -674,15 +674,15 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
"Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)", "Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)",
(unsigned char)socksreq[4], (unsigned char)socksreq[5], (unsigned char)socksreq[4], (unsigned char)socksreq[5],
(unsigned char)socksreq[6], (unsigned char)socksreq[7], (unsigned char)socksreq[6], (unsigned char)socksreq[7],
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
} }
else if(socksreq[3] == 3) { else if(socksreq[3] == 3) {
failf(data, failf(data,
"Can't complete SOCKS5 connection to %s:%d. (%d)", "Can't complete SOCKS5 connection to %s:%d. (%d)",
hostname, hostname,
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
} }
else if(socksreq[3] == 4) { else if(socksreq[3] == 4) {
failf(data, failf(data,
@ -696,8 +696,8 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
(unsigned char)socksreq[14], (unsigned char)socksreq[15], (unsigned char)socksreq[14], (unsigned char)socksreq[15],
(unsigned char)socksreq[16], (unsigned char)socksreq[17], (unsigned char)socksreq[16], (unsigned char)socksreq[17],
(unsigned char)socksreq[18], (unsigned char)socksreq[19], (unsigned char)socksreq[18], (unsigned char)socksreq[19],
((socksreq[8] << 8) | socksreq[9]), (((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
socksreq[1]); (unsigned char)socksreq[1]);
} }
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }