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.2.29.rc1~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f7bf1862d6228a04277497ba7a46d7c5072b682;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 b9383fb126..50e6e57f9a 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 {