]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-client-transaction - Prevent logging a spurious abort event for an...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 21 Jun 2025 14:34:03 +0000 (16:34 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sun, 29 Jun 2025 17:22:15 +0000 (17:22 +0000)
src/lib-smtp/smtp-client-private.h
src/lib-smtp/smtp-client-transaction.c

index 7d58c7875f54d222fe5d7b55c681a378700e572b..f226ac2ee8df83cac2c4237a0a3ea42e5feb16a6 100644 (file)
@@ -91,6 +91,7 @@ struct smtp_client_transaction_rcpt {
        bool external_pool:1;
        bool queued:1;
        bool finished:1;
+       bool discarded:1;
 };
 
 struct smtp_client_transaction {
index 0112021f3c6e600aaedfd05cbf3032e1ff6e8b53..eb5ed75ed7d30a97b13438cef6f490c10b1ef9b7 100644 (file)
@@ -223,7 +223,7 @@ smtp_client_transaction_rcpt_free(
                trans->rcpts_count--;
        }
 
-       if (!rcpt->finished) {
+       if (!rcpt->finished && !rcpt->discarded) {
                struct smtp_reply failure;
 
                trans->rcpts_aborted++;
@@ -247,6 +247,19 @@ smtp_client_transaction_rcpt_free(
        }
 }
 
+static void
+smtp_client_transaction_rcpt_discard(
+       struct smtp_client_transaction_rcpt **_rcpt)
+{
+       struct smtp_client_transaction_rcpt *rcpt = *_rcpt;
+
+       if (rcpt == NULL)
+               return;
+
+       rcpt->discarded = TRUE;
+       smtp_client_transaction_rcpt_free(_rcpt);
+}
+
 static void
 smtp_client_transaction_rcpt_approved(
        struct smtp_client_transaction_rcpt **_rcpt)
@@ -285,8 +298,8 @@ smtp_client_transaction_rcpt_approved(
                rcpt->event = prcpt->event;
                event_ref(rcpt->event);
 
-               /* Free the old object, thereby removing it from the queue */
-               smtp_client_transaction_rcpt_free(&prcpt);
+               /* Discard the old object, thereby removing it from the queue */
+               smtp_client_transaction_rcpt_discard(&prcpt);
        }
 
        /* Recipient is approved */