]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-recipient - Recipient event should be using the transaction...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 31 Aug 2020 13:29:03 +0000 (15:29 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 10 Sep 2020 12:43:56 +0000 (12:43 +0000)
The connection event is only used as event parent when the MAIL command failed
in pipeline or when the recipient is destroyed prematurely. The log prefix of
the transaction event is dropped, so that the connection event log prefix is
used in either case. Therefore, the main visible effect of this commit is that
the transaction event fields are available in the recipient event when there is
a transaction, the log messages will not change.

src/lib-smtp/smtp-server-recipient.c

index 30765301360b89c145c7f58bb45d65fc65b0c416..6f2add1ed50eecb7d5ef6b5ad6cc17b7cc47dc2f 100644 (file)
@@ -29,7 +29,15 @@ smtp_server_recipient_create_event(struct smtp_server_recipient_private *prcpt)
        if (rcpt->event != NULL)
                return;
 
-       rcpt->event = event_create(conn->event);
+       if (conn->state.trans == NULL) {
+               /* Use connection event directly if there is no transaction */
+               rcpt->event = event_create(conn->event);
+       } else {
+               /* Use transaction event, but drop its log prefix so that the
+                  connection event prefix remains. */
+               rcpt->event = event_create(conn->state.trans->event);
+               event_drop_parent_log_prefixes(rcpt->event, 1);
+       }
        smtp_server_recipient_update_event(prcpt);
 }