struct smtp_proxy_data proxy_data;
struct smtp_address *user;
struct smtp_client_transaction_rcpt *relay_rcpt;
+ struct smtp_params_rcpt *rcpt_params = &rcpt->params;
pool_t auth_pool;
int ret;
if (client->proxy == NULL)
client->proxy = lmtp_proxy_init(client, trans);
+ /* Add an ORCPT parameter when passdb changed the username (and
+ therefore the RCPT address changed) and there is no ORCPT parameter
+ yet. */
+ if (!smtp_params_rcpt_has_orcpt(rcpt_params) &&
+ !smtp_address_equals(address, rcpt->path)) {
+ pool_t pool = pool_datastack_create();
+ rcpt_params = p_new(pool, struct smtp_params_rcpt, 1);
+ smtp_params_rcpt_copy(pool, rcpt_params, &rcpt->params);
+ smtp_params_rcpt_set_orcpt(rcpt_params, pool, rcpt->path);
+ }
+
conn = lmtp_proxy_get_connection(client->proxy, &set);
pool_unref(&auth_pool);
lmtp_proxy_rcpt_approved, lprcpt);
relay_rcpt = smtp_client_transaction_add_pool_rcpt(
- conn->lmtp_trans, rcpt->pool, address, &rcpt->params,
+ conn->lmtp_trans, rcpt->pool, address, rcpt_params,
lmtp_proxy_rcpt_cb, lprcpt);
smtp_client_transaction_rcpt_set_data_callback(
relay_rcpt, lmtp_proxy_data_cb, lprcpt);