dovecot-2.2: lib: net_gethostbyname() now supports [ipv6] style ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 19 11:05:35 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/c5c34c02fda3
changeset: 19312:c5c34c02fda3
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 19 14:05:26 2015 +0300
description:
lib: net_gethostbyname() now supports [ipv6] style bracketed addresses.

diffstat:

 src/lib/net.c |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r 5876ca2d63fb -r c5c34c02fda3 src/lib/net.c
--- a/src/lib/net.c	Mon Oct 19 14:04:46 2015 +0300
+++ b/src/lib/net.c	Mon Oct 19 14:05:26 2015 +0300
@@ -628,6 +628,7 @@
 #ifdef HAVE_IPV6
 	union sockaddr_union *so;
 	struct addrinfo hints, *ai, *origai;
+	struct ip_addr ip;
 	int host_error;
 #else
 	struct hostent *hp;
@@ -638,6 +639,14 @@
         *ips_count = 0;
 
 #ifdef HAVE_IPV6
+	/* support [ipv6] style addresses here so they work globally */
+	if (addr[0] == '[' && net_addr2ip(addr, &ip) == 0) {
+		*ips_count = 1;
+		*ips = t_new(struct ip_addr, 1);
+		**ips = ip;
+		return 0;
+	}
+
 	memset(&hints, 0, sizeof(struct addrinfo));
 	hints.ai_socktype = SOCK_STREAM;
 


More information about the dovecot-cvs mailing list