]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Don't parse IPv6 address in listen setting as obsolete host:port.
authorTimo Sirainen <tss@iki.fi>
Tue, 9 Mar 2010 17:36:09 +0000 (19:36 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 9 Mar 2010 17:36:09 +0000 (19:36 +0200)
--HG--
branch : HEAD

src/config/old-set-parser.c

index b6cda5a556f360581fc690965d2cc0986b2cddb3..63d51e5a506887358dbe5a3e0308cb91fbeb12f2 100644 (file)
@@ -195,6 +195,16 @@ config_apply_auth_set(struct config_parser_context *ctx,
                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 @@ old_settings_handle_proto(struct config_parser_context *ctx,
 
        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++);