]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm direcor add: Don't accept number as a valid hostname.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 17 Jan 2017 13:22:44 +0000 (15:22 +0200)
committerGitLab <gitlab@git.dovecot.net>
Tue, 17 Jan 2017 17:35:45 +0000 (19:35 +0200)
This is usually a mistake. For example "doveadm director add -t host 100"
shouldn't be adding a new IP 100 (0.0.0.100)

src/doveadm/doveadm-director.c

index fb7d96fbc4ea5ea821734c5819a28b40c7d0470f..42c472759db549a2b363e7829540d6216a3b3036 100644 (file)
@@ -469,6 +469,13 @@ cmd_director_add_or_update(struct doveadm_cmd_context *cctx, bool update)
                director_cmd_help(cctx->cmd);
                return;
        }
+       if (str_to_uint(host, &i) == 0) {
+               /* host is a number. this would translate to an IP address,
+                  which is probably a mistake. */
+               i_error("Invalid host '%s'", host);
+               director_cmd_help(cctx->cmd);
+               return;
+       }
 
        host = ctx->host;
        if (ctx->tag == NULL) {