summaryrefslogtreecommitdiff
path: root/chat
diff options
context:
space:
mode:
authorveego <veego>2003-01-12 17:53:19 +0000
committerveego <veego>2003-01-12 17:53:19 +0000
commit2977e8260b1e05107d7ec5c3be42ca1d7717dcea (patch)
tree2d6bfb7e19117296b9595c01c2ae4f226c0855e0 /chat
parent871657ae93e26ee38929a761f383d69eb8c92782 (diff)
downloadpkgsrc-2977e8260b1e05107d7ec5c3be42ca1d7717dcea.tar.gz
Add patches from the irssi CVS repository:
2002-11-29 13:38 Timo Sirainen <tss@iki.fi> * src/core/network.c: If bind() fails when connecting, don't fallback to default address. Should make it easier to notice invalid settings or figure out why it's not working.. 2002-11-28 23:43 Timo Sirainen <tss@iki.fi> * src/core/network.c: net_gethostbyaddr() was pretty much broken.
Diffstat (limited to 'chat')
-rw-r--r--chat/irssi/patches/patch-ad103
1 files changed, 103 insertions, 0 deletions
diff --git a/chat/irssi/patches/patch-ad b/chat/irssi/patches/patch-ad
new file mode 100644
index 00000000000..c09d84f4431
--- /dev/null
+++ b/chat/irssi/patches/patch-ad
@@ -0,0 +1,103 @@
+$NetBSD: patch-ad,v 1.3 2003/01/12 17:53:19 veego Exp $
+
+Index: src/core/network.c
+===================================================================
+RCS file: /home/cvs/irssi/src/core/network.c,v
+retrieving revision 1.42
+retrieving revision 1.44
+diff -c -r1.42 -r1.44
+*** network.c 26 Aug 2002 19:05:14 -0000 1.42
+--- network.c 29 Nov 2002 13:38:21 -0000 1.44
+***************
+*** 201,210 ****
+ /* set our own address */
+ if (my_ip != NULL) {
+ sin_set_ip(&so, my_ip);
+! if (bind(handle, &so.sa, SIZEOF_SOCKADDR(so)) == -1) {
+ /* failed, set it back to INADDR_ANY */
+! sin_set_ip(&so, NULL);
+! bind(handle, &so.sa, SIZEOF_SOCKADDR(so));
+ }
+ }
+
+--- 201,213 ----
+ /* set our own address */
+ if (my_ip != NULL) {
+ sin_set_ip(&so, my_ip);
+! if (bind(handle, &so.sa, SIZEOF_SOCKADDR(so)) < 0) {
+ /* failed, set it back to INADDR_ANY */
+! int old_errno = errno;
+!
+! close(handle);
+! errno = old_errno;
+! return NULL;
+ }
+ }
+
+***************
+*** 466,498 ****
+ int net_gethostbyaddr(IPADDR *ip, char **name)
+ {
+ #ifdef HAVE_IPV6
+! struct addrinfo req, *ai;
+ int host_error;
+ #else
+ struct hostent *hp;
+ #endif
+- char ipname[MAX_IP_LEN];
+
+ g_return_val_if_fail(ip != NULL, -1);
+ g_return_val_if_fail(name != NULL, -1);
+
+- net_ip2host(ip, ipname);
+-
+ *name = NULL;
+ #ifdef HAVE_IPV6
+! memset(&req, 0, sizeof(struct addrinfo));
+! req.ai_socktype = SOCK_STREAM;
+! req.ai_flags = AI_CANONNAME;
+
+ /* save error to host_error for later use */
+! host_error = getaddrinfo(ipname, NULL, &req, &ai);
+! if (host_error != 0)
+! return host_error;
+! *name = g_strdup(ai->ai_canonname);
+
+! freeaddrinfo(ai);
+ #else
+! hp = gethostbyaddr(ipname, strlen(ipname), AF_INET);
+ if (hp == NULL) return -1;
+
+ *name = g_strdup(hp->h_name);
+--- 469,499 ----
+ int net_gethostbyaddr(IPADDR *ip, char **name)
+ {
+ #ifdef HAVE_IPV6
+! union sockaddr_union so;
+ int host_error;
++ char hostname[NI_MAXHOST];
+ #else
+ struct hostent *hp;
+ #endif
+
+ g_return_val_if_fail(ip != NULL, -1);
+ g_return_val_if_fail(name != NULL, -1);
+
+ *name = NULL;
+ #ifdef HAVE_IPV6
+! memset(&so, 0, sizeof(so));
+! sin_set_ip(&so, ip);
+
+ /* save error to host_error for later use */
+! host_error = getnameinfo((struct sockaddr *) &so, sizeof(so),
+! hostname, sizeof(hostname), NULL, 0, 0);
+! if (host_error != 0)
+! return host_error;
+
+! *name = g_strdup(hostname);
+ #else
+! if (ip->family != AF_INET) return -1;
+! hp = gethostbyaddr(&ip->ip, 4, AF_INET);
+ if (hp == NULL) return -1;
+
+ *name = g_strdup(hp->h_name);