aboutsummaryrefslogtreecommitdiff
path: root/irc
diff options
context:
space:
mode:
authorAshish SHUKLA <ashish@FreeBSD.org>2010-08-08 16:41:53 +0000
committerAshish SHUKLA <ashish@FreeBSD.org>2010-08-08 16:41:53 +0000
commit512cb7f96d83a20abc33212d05f37af211dd1a1a (patch)
tree47c46d43816aa63b8f951afbd588518c71657601 /irc
parentd0fac5adb21ab7ea402e6657205a2829cd56deae (diff)
downloadports-512cb7f96d83a20abc33212d05f37af211dd1a1a.tar.gz
ports-512cb7f96d83a20abc33212d05f37af211dd1a1a.zip
Notes
Diffstat (limited to 'irc')
-rw-r--r--irc/bitlbee-otr/Makefile2
-rw-r--r--irc/bitlbee-otr/files/patch-lib_proxy.c135
2 files changed, 136 insertions, 1 deletions
diff --git a/irc/bitlbee-otr/Makefile b/irc/bitlbee-otr/Makefile
index c532232a85e8..bfd2eb3c92d5 100644
--- a/irc/bitlbee-otr/Makefile
+++ b/irc/bitlbee-otr/Makefile
@@ -7,7 +7,7 @@
PORTNAME= bitlbee-otr
PORTVERSION= 1.2.8
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= irc
MASTER_SITES= http://fbsd.zlonet.ru/distfiles/ \
http://wahjava.users.sourceforge.net/
diff --git a/irc/bitlbee-otr/files/patch-lib_proxy.c b/irc/bitlbee-otr/files/patch-lib_proxy.c
new file mode 100644
index 000000000000..b67dc5a0a10b
--- /dev/null
+++ b/irc/bitlbee-otr/files/patch-lib_proxy.c
@@ -0,0 +1,135 @@
+
+$FreeBSD$
+
+--- lib/proxy.c.orig
++++ lib/proxy.c
+@@ -57,27 +57,6 @@
+ gint inpa;
+ };
+
+-
+-
+-static struct sockaddr_in *gaim_gethostbyname(const char *host, int port)
+-{
+- static struct sockaddr_in sin;
+-
+- if (!inet_aton(host, &sin.sin_addr)) {
+- struct hostent *hp;
+- if (!(hp = gethostbyname(host))) {
+- return NULL;
+- }
+- memset(&sin, 0, sizeof(struct sockaddr_in));
+- memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length);
+- sin.sin_family = hp->h_addrtype;
+- } else
+- sin.sin_family = AF_INET;
+- sin.sin_port = htons(port);
+-
+- return &sin;
+-}
+-
+ static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition cond)
+ {
+ struct PHB *phb = data;
+@@ -110,47 +89,71 @@
+ return FALSE;
+ }
+
+-static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb)
++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;
++ int ret;
++ char port[6];
++ struct addrinfo hints;
++ struct addrinfo* result;
+
+- if (!(sin = gaim_gethostbyname(host, port))) {
+- g_free(phb);
+- return -1;
+- }
++ g_snprintf(port, sizeof(port), "%d", port_);
+
+- if ((fd = socket(sin->sin_family, SOCK_STREAM, 0)) < 0) {
+- g_free(phb);
+- return -1;
+- }
++ memset(&hints, 0, sizeof(struct addrinfo));
++ hints.ai_family = AF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV;
+
+- sock_make_nonblocking(fd);
++ if (!(ret = getaddrinfo(host, port, &hints, &result)))
++ {
++ struct addrinfo* rp;
++
++ for (rp = result; rp; rp = rp->ai_next)
++ {
++ if ((fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) < 0) {
++ event_debug( "socket failed: %d\n", errno);
++ continue;
++ }
++
++ 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( global.conf->iface_out )
++ if (connect(fd, rp->ai_addr, rp->ai_addrlen) < 0 && !sockerr_again()) {
++ event_debug( "connect failed: %s\n", strerror(errno));
++ closesocket(fd);
++ fd = -1;
++ continue;
++ } else {
++ phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
++ phb->fd = fd;
++
++ break;
++ }
++ }
++
++ freeaddrinfo(result);
++ }
++ else
+ {
+- 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("gai(): %s\n", gai_strerror(ret));
+ }
+
+- event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd);
+-
+- if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0 && !sockerr_again()) {
+- closesocket(fd);
++ if(fd < 0)
+ g_free(phb);
+-
+- return -1;
+- } else {
+- phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
+- phb->fd = fd;
+-
+- return fd;
+- }
++
++ return fd;
+ }
+
+