From: Stephan Bosch Date: Sun, 7 Oct 2018 17:47:59 +0000 (+0200) Subject: lmtp: Use the path in the server recipient object rather than the lmtp recipient. X-Git-Tag: 2.3.9~1212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f82d4d1b8181249f89cc1d4ef15a67d3fd52391;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Use the path in the server recipient object rather than the lmtp recipient. It is recorded reliably on a pool from the start now. --- diff --git a/src/lmtp/lmtp-common.c b/src/lmtp/lmtp-common.c index 58678e56c6..ca126795ea 100644 --- a/src/lmtp/lmtp-common.c +++ b/src/lmtp/lmtp-common.c @@ -14,7 +14,6 @@ void lmtp_recipient_init(struct lmtp_recipient *lrcpt, lrcpt->type = type; lrcpt->rcpt_cmd = cmd; lrcpt->rcpt = rcpt; - lrcpt->path = rcpt->path; } void lmtp_recipient_finish(struct lmtp_recipient *lrcpt) diff --git a/src/lmtp/lmtp-common.h b/src/lmtp/lmtp-common.h index 92adcdf6ff..ae893cfb45 100644 --- a/src/lmtp/lmtp-common.h +++ b/src/lmtp/lmtp-common.h @@ -17,7 +17,6 @@ struct lmtp_recipient { struct smtp_server_recipient *rcpt; enum lmtp_recipient_type type; - struct smtp_address *path; struct smtp_server_cmd_ctx *rcpt_cmd; unsigned int index; }; diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c index 29d6715062..f0d6721a98 100644 --- a/src/lmtp/lmtp-local.c +++ b/src/lmtp/lmtp-local.c @@ -127,7 +127,8 @@ lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *llrcpt, struct smtp_server_cmd_ctx *cmd, const char *error) { - struct smtp_address *address = llrcpt->rcpt.path; + struct smtp_server_recipient *rcpt = llrcpt->rcpt.rcpt; + struct smtp_address *address = rcpt->path; unsigned int rcpt_idx = llrcpt->rcpt.index; struct lda_settings *lda_set = mail_storage_service_user_get_set(llrcpt->service_user)[2]; @@ -158,9 +159,11 @@ lmtp_local_rcpt_fail_all(struct lmtp_local *local, llrcpts = array_get(&local->rcpt_to, &count); for (i = 0; i < count; i++) { + struct smtp_server_recipient *rcpt = llrcpts[i]->rcpt.rcpt; + smtp_server_reply_index(cmd, llrcpts[i]->rcpt.index, status, enh_code, "<%s> %s", - smtp_address_encode(llrcpts[i]->rcpt.rcpt->path), msg); + smtp_address_encode(rcpt->path), msg); } } @@ -172,8 +175,9 @@ static int lmtp_local_rcpt_check_quota(struct lmtp_local_recipient *llrcpt) { struct client *client = llrcpt->rcpt.client; + struct smtp_server_recipient *rcpt = llrcpt->rcpt.rcpt; struct smtp_server_cmd_ctx *cmd = llrcpt->rcpt.rcpt_cmd; - struct smtp_address *address = llrcpt->rcpt.path; + struct smtp_address *address = rcpt->path; struct mail_user *user; struct mail_namespace *ns; struct mailbox *box; @@ -269,7 +273,8 @@ lmtp_local_rcpt_anvil_cb(const char *reply, void *context) (struct lmtp_local_recipient *)context; struct smtp_server_cmd_ctx *cmd = llrcpt->rcpt.rcpt_cmd; struct client *client = llrcpt->rcpt.client; - struct smtp_address *address = llrcpt->rcpt.path; + struct smtp_server_recipient *rcpt = llrcpt->rcpt.rcpt; + struct smtp_address *address = rcpt->path; const struct mail_storage_service_input *input; unsigned int parallel_count = 0; diff --git a/src/lmtp/lmtp-proxy.c b/src/lmtp/lmtp-proxy.c index 505f17981d..c2ac67f316 100644 --- a/src/lmtp/lmtp-proxy.c +++ b/src/lmtp/lmtp-proxy.c @@ -56,6 +56,8 @@ struct lmtp_proxy_recipient { struct lmtp_recipient rcpt; struct lmtp_proxy_connection *conn; + struct smtp_address *address; + bool rcpt_to_failed:1; bool data_reply_received:1; }; @@ -569,7 +571,7 @@ int lmtp_proxy_rcpt(struct client *client, lprcpt = p_new(rcpt->pool, struct lmtp_proxy_recipient, 1); lmtp_recipient_init(&lprcpt->rcpt, client, LMTP_RECIPIENT_TYPE_PROXY, cmd, rcpt); - lprcpt->rcpt.path = smtp_address_clone(rcpt->pool, address); + lprcpt->address = smtp_address_clone(rcpt->pool, address); lprcpt->conn = conn; smtp_server_recipient_add_hook( @@ -595,7 +597,7 @@ lmtp_proxy_data_cb(const struct smtp_reply *proxy_reply, struct lmtp_proxy *proxy = conn->proxy; struct smtp_server_cmd_ctx *cmd = proxy->pending_data_cmd; struct smtp_server_transaction *trans = proxy->trans; - struct smtp_address *address = lprcpt->rcpt.path; + struct smtp_address *address = lprcpt->address; const struct smtp_client_transaction_times *times = smtp_client_transaction_get_times(conn->lmtp_trans); unsigned int rcpt_index = lprcpt->rcpt.index;