Skip to content

Commit

Permalink
lmtp: Use the recipient index in the server recipient object rather t…
Browse files Browse the repository at this point in the history
…han the lmtp recipient.
  • Loading branch information
stephanbosch committed Oct 11, 2018
1 parent 32ea743 commit 42f96ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/lmtp/lmtp-common.c
Expand Up @@ -18,7 +18,6 @@ void lmtp_recipient_init(struct lmtp_recipient *lrcpt,

void lmtp_recipient_finish(struct lmtp_recipient *lrcpt)
{
lrcpt->index = lrcpt->rcpt->index;
lrcpt->rcpt_cmd = NULL;
}

Expand Down
1 change: 0 additions & 1 deletion src/lmtp/lmtp-common.h
Expand Up @@ -18,7 +18,6 @@ struct lmtp_recipient {
enum lmtp_recipient_type type;

struct smtp_server_cmd_ctx *rcpt_cmd;
unsigned int index;
};

void lmtp_recipient_init(struct lmtp_recipient *lrcpt,
Expand Down
13 changes: 8 additions & 5 deletions src/lmtp/lmtp-local.c
Expand Up @@ -129,7 +129,7 @@ lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *llrcpt,
{
struct smtp_server_recipient *rcpt = llrcpt->rcpt.rcpt;
struct smtp_address *address = rcpt->path;
unsigned int rcpt_idx = llrcpt->rcpt.index;
unsigned int rcpt_idx = rcpt->index;
struct lda_settings *lda_set =
mail_storage_service_user_get_set(llrcpt->service_user)[2];

Expand Down Expand Up @@ -161,7 +161,7 @@ lmtp_local_rcpt_fail_all(struct lmtp_local *local,
for (i = 0; i < count; i++) {
struct smtp_server_recipient *rcpt = llrcpts[i]->rcpt.rcpt;

smtp_server_reply_index(cmd, llrcpts[i]->rcpt.index,
smtp_server_reply_index(cmd, rcpt->index,
status, enh_code, "<%s> %s",
smtp_address_encode(rcpt->path), msg);
}
Expand Down Expand Up @@ -441,7 +441,7 @@ lmtp_local_deliver(struct lmtp_local *local,
struct client *client = local->client;
struct smtp_server_recipient *rcpt = llrcpt->rcpt.rcpt;
struct smtp_address *rcpt_to = rcpt->path;
unsigned int rcpt_idx = llrcpt->rcpt.index;
unsigned int rcpt_idx = rcpt->index;
struct mail_storage_service_user *service_user = llrcpt->service_user;
struct mail_deliver_context dctx;
struct mail_user *rcpt_user;
Expand Down Expand Up @@ -628,11 +628,14 @@ lmtp_local_deliver_to_rcpts(struct lmtp_local *local,
llrcpts = array_get(&local->rcpt_to, &count);
for (i = 0; i < count; i++) {
struct lmtp_local_recipient *llrcpt = llrcpts[i];
struct smtp_server_recipient *rcpt = llrcpt->rcpt.rcpt;

if (llrcpt->duplicate != NULL) {
struct smtp_server_recipient *drcpt =
llrcpt->duplicate->rcpt.rcpt;
/* don't deliver more than once to the same recipient */
smtp_server_reply_submit_duplicate(cmd,
llrcpt->rcpt.index, llrcpt->duplicate->rcpt.index);
smtp_server_reply_submit_duplicate(cmd, rcpt->index,
drcpt->index);
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion src/lmtp/lmtp-proxy.c
Expand Up @@ -594,13 +594,14 @@ lmtp_proxy_data_cb(const struct smtp_reply *proxy_reply,
struct lmtp_proxy_recipient *lprcpt)
{
struct lmtp_proxy_connection *conn = lprcpt->conn;
struct smtp_server_recipient *rcpt = lprcpt->rcpt.rcpt;
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->address;
const struct smtp_client_transaction_times *times =
smtp_client_transaction_get_times(conn->lmtp_trans);
unsigned int rcpt_index = lprcpt->rcpt.index;
unsigned int rcpt_index = rcpt->index;
struct smtp_reply reply;
string_t *msg;

Expand Down

0 comments on commit 42f96ee

Please sign in to comment.