]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Do not crash doveadm-server if input file missing
authorAki Tuomi <aki.tuomi@dovecot.fi>
Sat, 11 Mar 2017 17:20:30 +0000 (19:20 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 16 Mar 2017 17:49:09 +0000 (19:49 +0200)
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

index b9383fb126b780c11fd8d705d066afb36b068b4b..50e6e57f9ac985b3ba03be7848be486366b2d65b 100644 (file)
@@ -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 {