]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-client-command - Generate multiple callbacks when required in smtp_cli...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Thu, 19 Jun 2025 23:48:48 +0000 (01:48 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sun, 29 Jun 2025 17:22:15 +0000 (17:22 +0000)
This requirement applies to the LTMP DATA command when more than a single
recipient is approved.

This caused a crash in the LMTP service occurring when the proxy client
connection was lost during the DATA command while more than a single RCPT
command was expected earlier. This situation caused an early free/dangling
pointer for the DATA command struct, subsequently causing a crash at
deinitialization of the proxy.

src/lib-smtp/smtp-client-command.c

index 5b763a7a10cccf30273b08af75be983681afad98..66d5bb5c246c190c3a781c6bd27597d1c3893375 100644 (file)
@@ -341,8 +341,10 @@ void smtp_client_command_fail_reply(struct smtp_client_command **_cmd,
                }
                e_debug(e->event(), "Failed: %s", smtp_reply_log(reply));
 
-               if (callback != NULL)
-                       (void)callback(reply, context);
+               if (callback != NULL) {
+                       while (cmd->replies_seen++ < cmd->replies_expected)
+                               (void)callback(reply, context);
+               }
        }
 
        tmp_cmd = cmd;