[evolution-data-server/camel-socks-proxy-master] Don't try SOCKS4 on IPv6 addresses; it doesn't handle them.
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/camel-socks-proxy-master] Don't try SOCKS4 on IPv6 addresses; it doesn't handle them.
- Date: Wed, 28 Jul 2010 21:43:15 +0000 (UTC)
commit 048008fb547eec8c1846831989a6f2e16d823830
Author: Federico Mena Quintero <federico novell com>
Date: Thu Jul 22 17:01:18 2010 -0500
Don't try SOCKS4 on IPv6 addresses; it doesn't handle them.
Signed-off-by: Federico Mena Quintero <federico novell com>
camel/camel-tcp-stream-raw.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index a423af9..a807183 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -676,11 +676,12 @@ connect_to_socks4_proxy (CamelTcpStreamRaw *raw, const gchar *proxy_host, gint p
gchar reply[8];
gint save_errno;
+ g_assert (connect_addr->ai_addr->sa_family == AF_INET); /* FMQ: check for AF_INET in the caller */
+
fd = connect_to_proxy (raw, proxy_host, proxy_port, error);
if (!fd)
goto error;
- g_assert (connect_addr->ai_addr->sa_family == AF_INET); /* FMQ: check for AF_INET in the caller */
sin = (struct sockaddr_in *) connect_addr->ai_addr;
request[0] = 0x04; /* SOCKS4 */
@@ -1040,9 +1041,11 @@ tcp_stream_raw_connect (CamelTcpStream *stream,
ai = addr;
while (ai) {
- if (proxy_host)
- priv->sockfd = connect_to_socks4_proxy (raw, proxy_host, proxy_port, ai, error);
- else
+ if (proxy_host) {
+ /* SOCKS4 only does IPv4 */
+ if (ai->ai_addr->sa_family == AF_INET)
+ priv->sockfd = connect_to_socks4_proxy (raw, proxy_host, proxy_port, ai, error);
+ } else
priv->sockfd = socket_connect (ai, error);
if (priv->sockfd) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]