commit 9472330754c7ae216e84b5f74595b07f48dc38b2
parent 1c069e3069d795a0a845d1f35b23c8a1250bce74
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Thu, 6 Sep 2018 23:13:41 +0200
Show correct address:port in SOCKS5 proxy connection failure message.
The address and port contained in the server response
are what the proxy server has bound locally for the
connection, not the destination address and port.
Diffstat:
1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/src/common/proxy.c b/src/common/proxy.c
@@ -254,25 +254,8 @@ gint socks5_connect(SockInfo *sock, const gchar *hostname, gushort port,
return -1;
}
if (socks_req[1] != 0) {
- if (socks_req[3] == 1) { /* IPv4 address */
- g_warning("socks5_connect: SOCKS5 connection to %u.%u.%u.%u:%u failed. (%u)", socks_req[4], socks_req[5], socks_req[6], socks_req[7], ntohs(*(gushort *)(socks_req + 8)), socks_req[1]);
- } else if (socks_req[3] == 3) { /* Domain name */
- gint hnlen = socks_req[4];
- gchar *hn = malloc(hnlen + 1);
- hn[hnlen] = '\0';
- memcpy(hn, &socks_req[5], hnlen);
- g_warning("socks5_connect: SOCKS5 connection to %s:%u failed. (%u)",
- hn, ntohs(*(gushort *)(socks_req + 5 + hnlen)), socks_req[1]);
- g_free(hn);
- } else if (socks_req[3] == 4) { /* IPv6 address */
- gint hnlen = 16;
- gchar *hn = malloc(hnlen + 1);
- hn[hnlen] = '\0';
- memcpy(hn, &socks_req[4], hnlen);
- g_warning("socks5_connect: SOCKS5 connection to IPv6 %s:%u failed. (%u)",
- hn, ntohs(*(gushort *)(socks_req + 5 + hnlen)), socks_req[1]);
- g_free(hn);
- }
+ g_warning("socks5_connect: SOCKS5 connection to %s:%u failed. (%u)",
+ hostname, port, socks_req[1]);
return -1;
}