aboutsummaryrefslogtreecommitdiff
path: root/libsylph/socks.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2014-02-28 09:09:39 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2014-02-28 09:09:39 +0000
commiteec2055b585608a68c3a6073143c2a49bb1dfff7 (patch)
tree625e0ee7afa0e06a7197a7f11326363e632133a6 /libsylph/socks.c
parent91282f23c547f0ddd35382d3a4b58db36fc007d7 (diff)
validate SSL certificate hostname (#167).
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3321 ee746299-78ed-0310-b773-934348b2243d
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;