From bb0484f2d26a985e42688597e455cf49578ab2a1 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Sat, 11 Mar 2017 19:20:30 +0200 Subject: [PATCH] doveadm: Do not crash doveadm-server if input file missing save commands expects valid input file for it to work, if we are not running for cli, and input file is not provided, provide EINVAL error to caller via i_stream_error. --- src/doveadm/doveadm-mail.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/doveadm/doveadm-mail.c b/src/doveadm/doveadm-mail.c index db64d4a3ac..4a597b91d3 100644 --- a/src/doveadm/doveadm-mail.c +++ b/src/doveadm/doveadm-mail.c @@ -227,6 +227,11 @@ void doveadm_mail_get_input(struct doveadm_mail_cmd_context *ctx) if (ctx->cmd_input != NULL) return; + if (!ctx->cli && ctx->conn == NULL) { + ctx->cmd_input = i_stream_create_error_str(EINVAL, "Input stream missing (provide with file parameter)"); + return; + } + if (ctx->conn != NULL) inputs[0] = i_stream_create_dot(ctx->conn->input, FALSE); else { -- 2.47.3