bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschsmtp_server_transaction_create(struct smtp_server_connection *conn,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* create new transaction */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch pool = pool_alloconly_create("smtp server transaction", 512);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch trans = p_new(pool, struct smtp_server_transaction, 1);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* generate transaction ID */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch str_truncate(id, str_len(id)-2); /* drop trailing "==" */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch trans->mail_from = smtp_address_clone(trans->pool, mail_from);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch smtp_params_mail_copy(pool, &trans->params, params);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid smtp_server_transaction_free(struct smtp_server_transaction **_trans)
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch struct smtp_server_transaction *trans = *_trans;
499ca6dc5d746fd7a7efc6d497deede89553669fStephan Bosch if (smtp_address_equals(drcpt->path, rcpt->path) &&
499ca6dc5d746fd7a7efc6d497deede89553669fStephan Bosch smtp_params_rcpt_equals(&drcpt->params, &rcpt->params))
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschsmtp_server_transaction_add_rcpt(struct smtp_server_transaction *trans,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch rcpt = p_new(trans->pool, struct smtp_server_recipient, 1);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch rcpt->path = smtp_address_clone(trans->pool, rcpt_to);
5d5ad796fc34170333bb52c05614425a0dd7e182Stephan Bosch smtp_params_rcpt_copy(trans->pool, &rcpt->params, params);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch p_array_init(&trans->rcpt_to, trans->pool, 8);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschbool smtp_server_transaction_has_rcpt(struct smtp_server_transaction *trans)
6d76b99eb61df1cbe13cf76d0aac81507cbd1d21Stephan Boschsmtp_server_transaction_rcpt_count(struct smtp_server_transaction *trans)
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid smtp_server_transaction_fail_data(struct smtp_server_transaction *trans,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch for (i = 0; i < count; i++) {
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid smtp_server_transaction_write_trace_record(string_t *str,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch struct smtp_server_connection *conn = trans->conn;
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch const struct smtp_server_helo_data *helo_data = &conn->helo;
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch rcpt_to = smtp_address_encode(rcpts[0]->path);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* (using) */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch secstr = smtp_server_connection_get_security_string(conn);
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* by, with */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch str_append(str, smtp_server_connection_get_protocol_name(conn));
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* (envelope-from) */