From: Aki Tuomi Date: Sat, 11 Mar 2017 17:20:30 +0000 (+0200) Subject: doveadm: Do not crash doveadm-server if input file missing X-Git-Tag: 2.3.0.rc1~1934 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb0484f2d26a985e42688597e455cf49578ab2a1;p=thirdparty%2Fdovecot%2Fcore.git 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. --- 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 {