aboutsummaryrefslogtreecommitdiff
path: root/libsylph/socks.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/socks.c')
-rw-r--r--libsylph/socks.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libsylph/socks.c b/libsylph/socks.c
index b4746a15..b725ba74 100644
--- a/libsylph/socks.c
+++ b/libsylph/socks.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2010 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2014 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -129,6 +129,13 @@ gint socks4_connect(SockInfo *sock, const gchar *hostname, gushort port)
return -1;
}
+ /* replace sock->hostname with endpoint */
+ if (sock->hostname != hostname) {
+ g_free(sock->hostname);
+ sock->hostname = g_strdup(hostname);
+ sock->port = port;
+ }
+
debug_print("socks4_connect: SOCKS4 connection to %s:%u successful.\n", hostname, port);
return 0;
@@ -247,6 +254,13 @@ gint socks5_connect(SockInfo *sock, const gchar *hostname, gushort port,
}
}
+ /* replace sock->hostname with endpoint */
+ if (sock->hostname != hostname) {
+ g_free(sock->hostname);
+ sock->hostname = g_strdup(hostname);
+ sock->port = port;
+ }
+
debug_print("socks5_connect: SOCKS5 connection to %s:%u successful.\n", hostname, port);
return 0;