From: Stephan Bosch Date: Sun, 17 Sep 2017 09:13:17 +0000 (+0200) Subject: lmtp: Moved client_open_raw_mail() from commands.c to lmtp-local.c. X-Git-Tag: 2.3.0.rc1~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3d554ca3408b7ea692f6f0b9ef5e6579e345627;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Moved client_open_raw_mail() from commands.c to lmtp-local.c. --- diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index adc0d3875f..040299c029 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -572,36 +572,6 @@ static struct istream *client_get_input(struct client *client) return cinput; } -static int client_open_raw_mail(struct client *client, struct istream *input) -{ - static const char *wanted_headers[] = { - "From", "To", "Message-ID", "Subject", "Return-Path", - NULL - }; - struct mailbox *box; - struct mailbox_transaction_context *trans; - struct mailbox_header_lookup_ctx *headers_ctx; - enum mail_error error; - - if (raw_mailbox_alloc_stream(client->raw_mail_user, input, - (time_t)-1, smtp_address_encode(client->state.mail_from), - &box) < 0) { - i_error("Can't open delivery mail as raw: %s", - mailbox_get_last_internal_error(box, &error)); - mailbox_free(&box); - client_rcpt_fail_all(client); - return -1; - } - - trans = mailbox_transaction_begin(box, 0, __func__); - - headers_ctx = mailbox_header_lookup_init(box, wanted_headers); - client->state.raw_mail = mail_alloc(trans, 0, headers_ctx); - mailbox_header_lookup_unref(&headers_ctx); - mail_set_seq(client->state.raw_mail, 1); - return 0; -} - static void client_input_data_write_local(struct client *client, struct istream *input) { diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c index 2d5156989f..a8d49be38b 100644 --- a/src/lmtp/lmtp-local.c +++ b/src/lmtp/lmtp-local.c @@ -13,6 +13,7 @@ #include "mail-namespace.h" #include "mail-deliver.h" #include "mail-autoexpunge.h" +#include "index/raw/raw-storage.h" #include "master-service.h" #include "smtp-address.h" #include "smtp-submit-settings.h" @@ -50,7 +51,8 @@ client_send_line_overquota(struct client *client, smtp_address_encode(rcpt->address), error); } -void client_rcpt_fail_all(struct client *client) +static void +client_rcpt_fail_all(struct client *client) { struct mail_recipient *const *rcptp; @@ -371,3 +373,33 @@ uid_t client_deliver_to_rcpts(struct client *client, } return first_uid; } + +int client_open_raw_mail(struct client *client, struct istream *input) +{ + static const char *wanted_headers[] = { + "From", "To", "Message-ID", "Subject", "Return-Path", + NULL + }; + struct mailbox *box; + struct mailbox_transaction_context *trans; + struct mailbox_header_lookup_ctx *headers_ctx; + enum mail_error error; + + if (raw_mailbox_alloc_stream(client->raw_mail_user, input, + (time_t)-1, smtp_address_encode(client->state.mail_from), + &box) < 0) { + i_error("Can't open delivery mail as raw: %s", + mailbox_get_last_internal_error(box, &error)); + mailbox_free(&box); + client_rcpt_fail_all(client); + return -1; + } + + trans = mailbox_transaction_begin(box, 0, __func__); + + headers_ctx = mailbox_header_lookup_init(box, wanted_headers); + client->state.raw_mail = mail_alloc(trans, 0, headers_ctx); + mailbox_header_lookup_unref(&headers_ctx); + mail_set_seq(client->state.raw_mail, 1); + return 0; +} diff --git a/src/lmtp/lmtp-local.h b/src/lmtp/lmtp-local.h index 245d55f19f..c23b913c71 100644 --- a/src/lmtp/lmtp-local.h +++ b/src/lmtp/lmtp-local.h @@ -7,8 +7,6 @@ struct mail_deliver_session; void client_rcpt_anvil_disconnect(const struct mail_recipient *rcpt); -void client_rcpt_fail_all(struct client *client); - bool cmd_rcpt_finish(struct client *client, struct mail_recipient *rcpt); void rcpt_anvil_lookup_callback(const char *reply, void *context); @@ -16,4 +14,6 @@ void rcpt_anvil_lookup_callback(const char *reply, void *context); uid_t client_deliver_to_rcpts(struct client *client, struct mail_deliver_session *session); +int client_open_raw_mail(struct client *client, struct istream *input); + #endif