From: Stephan Bosch Date: Mon, 31 Aug 2020 13:29:03 +0000 (+0200) Subject: lib-smtp: smtp-server-recipient - Recipient event should be using the transaction... X-Git-Tag: 2.3.13~234 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d9f3124dab3f91ecc8f28a3faedccab9d267fad;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: smtp-server-recipient - Recipient event should be using the transaction event as parent. 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. --- diff --git a/src/lib-smtp/smtp-server-recipient.c b/src/lib-smtp/smtp-server-recipient.c index 3076530136..6f2add1ed5 100644 --- a/src/lib-smtp/smtp-server-recipient.c +++ b/src/lib-smtp/smtp-server-recipient.c @@ -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); }