]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Make sure IP address parsing works in DIRECTOR-ADD/REMOVE
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Oct 2016 17:16:57 +0000 (20:16 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 25 Oct 2016 18:01:22 +0000 (21:01 +0300)
We were passing the entire string through to net_addr2ip(). It seems that
inet_aton() stops at whitespace though, so this wasn't actually causing
errors at least on Linux.

src/director/doveadm-connection.c

index 5a29e6e2180d19fcab9f980c4f4b3c376f054fad..926f4ebce48a940d7ae4a1414e50e6b7c871e79c 100644 (file)
@@ -203,7 +203,7 @@ doveadm_cmd_director_add(struct doveadm_connection *conn, const char *line)
 
        args = t_strsplit_tab(line);
        if (args[0] == NULL ||
-           net_addr2ip(line, &ip) < 0 ||
+           net_addr2ip(args[0], &ip) < 0 ||
            (args[1] != NULL && net_str2port(args[1], &port) < 0)) {
                i_error("doveadm sent invalid DIRECTOR-ADD parameters");
                return -1;
@@ -227,7 +227,7 @@ doveadm_cmd_director_remove(struct doveadm_connection *conn, const char *line)
 
        args = t_strsplit_tab(line);
        if (args[0] == NULL ||
-           net_addr2ip(line, &ip) < 0 ||
+           net_addr2ip(args[0], &ip) < 0 ||
            (args[1] != NULL && net_str2port(args[1], &port) < 0)) {
                i_error("doveadm sent invalid DIRECTOR-REMOVE parameters");
                return -1;