From 521c0460fe705f32ea6899c8b1f101043fe0898c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 17 Jan 2017 15:22:44 +0200 Subject: [PATCH] doveadm direcor add: Don't accept number as a valid hostname. 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/doveadm/doveadm-director.c b/src/doveadm/doveadm-director.c index fb7d96fbc4..42c472759d 100644 --- a/src/doveadm/doveadm-director.c +++ b/src/doveadm/doveadm-director.c @@ -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) {