Skip to content

Commit

Permalink
lib-smtp: server: Fix double decrement of RCPT pending counter upon e…
Browse files Browse the repository at this point in the history
…rror.

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)
  • Loading branch information
stephanbosch committed Mar 4, 2018
1 parent 293f69e commit 8f3829c
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/lib-smtp/smtp-server-cmd-rcpt.c
Expand Up @@ -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;
Expand Down

0 comments on commit 8f3829c

Please sign in to comment.