dovecot-2.2: lib: net_addr2ip() sets the family now only after a...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 29 15:45:00 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/4903ab967807
changeset: 18500:4903ab967807
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 29 17:35:18 2015 +0200
description:
lib: net_addr2ip() sets the family now only after address is successfully converted.

diffstat:

 src/lib/net.c |  5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 46065d7276ab -r 4903ab967807 src/lib/net.c
--- a/src/lib/net.c	Wed Apr 29 17:19:34 2015 +0200
+++ b/src/lib/net.c	Wed Apr 29 17:35:18 2015 +0200
@@ -919,7 +919,6 @@
 
 	if (strchr(addr, ':') != NULL) {
 		/* IPv6 */
-		ip->family = AF_INET6;
 #ifdef HAVE_IPV6
 		T_BEGIN {
 			if (addr[0] == '[') {
@@ -935,13 +934,13 @@
 #else
 		ip->u.ip4.s_addr = 0;
 #endif
+		ip->family = AF_INET6;
  	} else {
 		/* IPv4 */
-		ip->family = AF_INET;
 		if (inet_aton(addr, &ip->u.ip4) == 0)
 			return -1;
+		ip->family = AF_INET;
 	}
-
 	return 0;
 }
 


More information about the dovecot-cvs mailing list