From: Timo Sirainen Date: Tue, 9 Mar 2010 17:36:09 +0000 (+0200) Subject: config: Don't parse IPv6 address in listen setting as obsolete host:port. X-Git-Tag: 2.0.beta4~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=417d2a64eba7d8c395b6c8a18d845f7ff2471637;p=thirdparty%2Fdovecot%2Fcore.git config: Don't parse IPv6 address in listen setting as obsolete host:port. --HG-- branch : HEAD --- diff --git a/src/config/old-set-parser.c b/src/config/old-set-parser.c index b6cda5a556..63d51e5a50 100644 --- a/src/config/old-set-parser.c +++ b/src/config/old-set-parser.c @@ -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++);