Mercurial > dovecot > core-2.2
changeset 21749:ddf64cb23295
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.
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Sat, 11 Mar 2017 19:20:30 +0200 |
parents | 1d329b71c6d8 |
children | 2ce0a606fd23 |
files | src/doveadm/doveadm-mail.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/doveadm-mail.c Thu Mar 16 09:36:23 2017 +0200 +++ b/src/doveadm/doveadm-mail.c Sat Mar 11 19:20:30 2017 +0200 @@ -227,6 +227,11 @@ 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 {