]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: server: Fix double decrement of RCPT pending counter upon error.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 4 Mar 2018 22:35:53 +0000 (23:35 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Mar 2018 04:18:19 +0000 (06:18 +0200)
The pending counter was sometimes decremented twice in specific error
conditions, leading to an assert panic in the DATA command. This was caused by
some dead code. If the MAIL command failed in a pipeline before the RCPT command,
the assert was triggered.

Panic was:

Panic: file smtp-server-cmd-data.c: line 354 (cmd_data_start): assertion failed: (conn->state.pending_mail_cmds == 0 && conn->state.pending_rcpt_cmds == 0)

src/lib-smtp/smtp-server-cmd-rcpt.c

index cac03c83c7782365f6111b11220a54c8e3b088f5..2cdcc14535fc9a02edf84b947a4ee070061ec3a3 100644 (file)
@@ -16,14 +16,9 @@ static bool
 cmd_rcpt_check_state(struct smtp_server_cmd_ctx *cmd)
 {
        struct smtp_server_connection *conn = cmd->conn;
-       struct smtp_server_command *command = cmd->cmd;
        struct smtp_server_transaction *trans = conn->state.trans;
 
        if (conn->state.pending_mail_cmds == 0 && trans == NULL) {
-               if (command->hook_replied != NULL) {
-                       conn->state.pending_rcpt_cmds--;
-                       command->hook_replied = NULL;
-               }
                smtp_server_reply(cmd,
                        503, "5.5.0", "MAIL needed first");
                return FALSE;