diff options
author | Sven Moritz Hallberg <pesco@khjk.org> | 2008-07-17 01:22:52 +0200 |
---|---|---|
committer | Sven Moritz Hallberg <pesco@khjk.org> | 2008-07-17 01:22:52 +0200 |
commit | 6738a676c7a3895988de4bd9eacfe8fa0ef73cc3 (patch) | |
tree | d95d913484cf79ff4a3c6d920a4d9b92ecd66de9 /lib/proxy.c | |
parent | 9730d7250bb9e938ca00b72efdd8e8b3c03b2753 (diff) | |
parent | 6a78c0eed44820a2fefe1e96516e335eddc9c70b (diff) |
merge in latest trunk
Diffstat (limited to 'lib/proxy.c')
-rw-r--r-- | lib/proxy.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/proxy.c b/lib/proxy.c index 0e1c8f07..91493557 100644 --- a/lib/proxy.c +++ b/lib/proxy.c @@ -113,6 +113,7 @@ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb) { struct sockaddr_in *sin; + struct sockaddr_in me; int fd = -1; if (!(sin = gaim_gethostbyname(host, port))) { @@ -127,6 +128,16 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB sock_make_nonblocking(fd); + if( global.conf->iface_out ) + { + me.sin_family = AF_INET; + me.sin_port = 0; + me.sin_addr.s_addr = inet_addr( global.conf->iface_out ); + + if( bind( fd, (struct sockaddr *) &me, sizeof( me ) ) != 0 ) + event_debug( "bind( %d, \"%s\" ) failure\n", fd, global.conf->iface_out ); + } + event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd); if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0 && !sockerr_again()) { @@ -529,7 +540,7 @@ int proxy_connect(const char *host, int port, b_event_handler func, gpointer dat { struct PHB *phb; - if (!host || !port || (port == -1) || !func || strlen(host) > 128) { + if (!host || port <= 0 || !func || strlen(host) > 128) { return -1; } @@ -537,7 +548,7 @@ int proxy_connect(const char *host, int port, b_event_handler func, gpointer dat phb->func = func; phb->data = data; - if ((proxytype == PROXY_NONE) || strlen(proxyhost) > 0 || !proxyport || (proxyport == -1)) + if (proxytype == PROXY_NONE || !proxyhost[0] || proxyport <= 0) return proxy_connect_none(host, port, phb); else if (proxytype == PROXY_HTTP) return proxy_connect_http(host, port, phb); |