dovecot-2.0: config: Don't parse IPv6 address in listen setting ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 9 19:36:11 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/bed9f7593c0e
changeset: 10883:bed9f7593c0e
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 09 19:36:09 2010 +0200
description:
config: Don't parse IPv6 address in listen setting as obsolete host:port.

diffstat:

 src/config/old-set-parser.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 3ebd6a4ad55a -r bed9f7593c0e src/config/old-set-parser.c
--- a/src/config/old-set-parser.c	Tue Mar 09 16:54:08 2010 +0200
+++ b/src/config/old-set-parser.c	Tue Mar 09 19:36:09 2010 +0200
@@ -195,6 +195,16 @@
 		t_strdup_printf("service/auth/%s=%s", key,value), NULL);
 }
 
+static bool listen_has_port(const char *str)
+{
+	const char *p;
+
+	if ((p = strchr(str, ':')) == NULL)
+		return FALSE;
+
+	return !is_ipv6_address(str);
+}
+
 static bool
 old_settings_handle_proto(struct config_parser_context *ctx,
 			  const char *key, const char *value)
@@ -210,14 +220,14 @@
 
 	if (strcmp(key, "ssl_listen") == 0 ||
 	    (strcmp(key, "listen") == 0 &&
-	     (strstr(value, ":") != NULL || !root))) {
+	     (listen_has_port(value) || !root))) {
 		const char *ssl = strcmp(key, "ssl_listen") == 0 ? "s" : "";
 
 		if (*value == '\0') {
 			/* default */
 			return TRUE;
 		}
-		p = strstr(value, ":");
+		p = strchr(value, ':');
 		if (p != NULL) {
 			obsolete(ctx, "%s=..:port has been replaced by service { inet_listener { port } }", key);
 			value = t_strdup_until(value, p++);


More information about the dovecot-cvs mailing list