[dovecot-cvs] dovecot/src/master main.c,1.80.2.14,1.80.2.15

tss at dovecot.org tss at dovecot.org
Thu Dec 28 19:59:38 UTC 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv6537

Modified Files:
      Tag: branch_1_0
	main.c 
Log Message:
If ssl_disable=yes, don't bother resolving ssl_listen. Also if listen or
ssl_listen resolving fails, log if it was listen or ssl_listen setting that
caused the error.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.80.2.14
retrieving revision 1.80.2.15
diff -u -d -r1.80.2.14 -r1.80.2.15
--- main.c	28 Dec 2006 15:06:28 -0000	1.80.2.14
+++ main.c	28 Dec 2006 19:59:35 -0000	1.80.2.15
@@ -248,7 +248,8 @@
 		i_warning("waitpid() failed: %m");
 }
 
-static void resolve_ip(const char *name, struct ip_addr *ip, unsigned int *port)
+static void resolve_ip(const char *set_name, const char *name,
+		       struct ip_addr *ip, unsigned int *port)
 {
 	struct ip_addr *ip_list;
 	const char *p;
@@ -263,16 +264,19 @@
 	if (name[0] == '[') {
 		/* IPv6 address */
 		p = strchr(name, ']');
-		if (p == NULL)
-			i_fatal("Missing ']' in address %s", name);
-
+		if (p == NULL) {
+			i_fatal("%s: Missing ']' in address %s",
+				set_name, name);
+		}
 		name = t_strdup_until(name+1, p);
 
 		p++;
 		if (*p == '\0')
 			p = NULL;
-		else if (*p != ':')
-			i_fatal("Invalid data after ']' in address %s", name);
+		else if (*p != ':') {
+			i_fatal("%s: Invalid data after ']' in address %s",
+				set_name, name);
+		}
 	} else {
 		p = strrchr(name, ':');
 		if (p != NULL)
@@ -280,8 +284,10 @@
 	}
 
 	if (p != NULL) {
-		if (!is_numeric(p+1, '\0'))
-			i_fatal("Invalid port in address %s", name);
+		if (!is_numeric(p+1, '\0')) {
+			i_fatal("%s: Invalid port in address %s",
+				set_name, name);
+		}
 		*port = atoi(p+1);
 	}
 
@@ -300,12 +306,12 @@
 	/* Return the first IP if there happens to be multiple. */
 	ret = net_gethostbyname(name, &ip_list, &ips_count);
 	if (ret != 0) {
-		i_fatal("Can't resolve address %s: %s",
-			name, net_gethosterror(ret));
+		i_fatal("%s: Can't resolve address %s: %s",
+			set_name, name, net_gethosterror(ret));
 	}
 
 	if (ips_count < 1)
-		i_fatal("No IPs for address: %s", name);
+		i_fatal("%s: No IPs for address: %s", set_name, name);
 
 	*ip = ip_list[0];
 }
@@ -358,8 +364,11 @@
 #endif
 
 	/* resolve */
-	resolve_ip(set->listen, &set->listen_ip, &set->listen_port);
-	resolve_ip(set->ssl_listen, &set->ssl_listen_ip, &set->ssl_listen_port);
+	resolve_ip("listen", set->listen, &set->listen_ip, &set->listen_port);
+	if (!set->ssl_disable) {
+		resolve_ip("ssl_listen", set->ssl_listen, &set->ssl_listen_ip,
+			   &set->ssl_listen_port);
+	}
 
 	/* if ssl_listen wasn't explicitly set in the config file,
 	   use the non-ssl IP settings for the ssl listener, too. */



More information about the dovecot-cvs mailing list