]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: old-set-parser - Use net_str2hostport() to check if host:port syntax was...
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 13 Apr 2022 11:36:12 +0000 (14:36 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 14 Apr 2022 11:10:37 +0000 (11:10 +0000)
src/config/old-set-parser.c

index 59e033c7efdef26778c0ce23eda256319a6f6fe8..477d63b7a94eb4146f39693652c4511788303c63 100644 (file)
@@ -362,17 +362,16 @@ config_apply_auth_set(struct config_parser_context *ctx,
 static bool listen_has_port(const char *str)
 {
        const char *const *addrs;
+       const char *host ATTR_UNUSED;
+       in_port_t port ATTR_UNUSED;
 
        if (strchr(str, ':') == NULL)
                return FALSE;
 
        addrs = t_strsplit_spaces(str, ", ");
        for (; *addrs != NULL; addrs++) {
-               if (strcmp(*addrs, "*") != 0 &&
-                   strcmp(*addrs, "::") != 0 &&
-                   strcmp(*addrs, "[::]") != 0 &&
-                   !is_ipv4_address(*addrs) &&
-                   !is_ipv6_address(*addrs))
+               if (net_str2hostport(*addrs, 0, &host, &port) == 0 &&
+                   port > 0)
                        return TRUE;
        }
        return FALSE;