Skip to content

Commit

Permalink
lmtp: Use the path in the server recipient object rather than the lmt…
Browse files Browse the repository at this point in the history
…p recipient.

It is recorded reliably on a pool from the start now.
  • Loading branch information
stephanbosch authored and villesavolainen committed Feb 12, 2019
1 parent 5c39ef5 commit 5eea7de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/lmtp/lmtp-common.c
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/lmtp/lmtp-common.h
Expand Up @@ -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;
};
Expand Down
13 changes: 9 additions & 4 deletions src/lmtp/lmtp-local.c
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 4 additions & 2 deletions src/lmtp/lmtp-proxy.c
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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(
Expand All @@ -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;
Expand Down

0 comments on commit 5eea7de

Please sign in to comment.