]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Add lmtp_add_received_header bool setting.
authorBjørnar Ness <bjornar.ness@gmail.com>
Wed, 11 Apr 2018 20:27:04 +0000 (22:27 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 5 Jul 2019 11:27:03 +0000 (11:27 +0000)
Add the ability to prevent dovecot/lmtp from adding received header. This is
useful if one needs to use LMTP, but does not want additional received headers
because:

1) Dovecot does not have correct information to add to the headers, and causes
   misleading/incorrect information
2) Does not want to expose internal information

The default value is true, which is equal to the current behavior.

src/lmtp/lmtp-commands.c
src/lmtp/lmtp-settings.c
src/lmtp/lmtp-settings.h

index f45bffd93b62190d6202ef6214333bcce66e3ee8..4bac980ab9e3139cf8caa180395ddc376ac009cf 100644 (file)
@@ -114,7 +114,8 @@ cmd_data_create_added_headers(struct client *client,
 
        /* headers for local and proxied messages */
        proxy_offset = str_len(str);
-       smtp_server_transaction_write_trace_record(str, trans);
+       if (client->lmtp_set->lmtp_add_received_header)
+               smtp_server_transaction_write_trace_record(str, trans);
 
        client->state.added_headers_local =
                p_strdup(client->state_pool, str_c(str));
index 04f725aa833d80244f698fd6fa39b6bfb6f29b3a..8c7036c5e3df2f9c7a3091824c6c37c3984797ff 100644 (file)
@@ -62,6 +62,7 @@ static const struct setting_define lmtp_setting_defines[] = {
        DEF(SET_BOOL, lmtp_proxy),
        DEF(SET_BOOL, lmtp_save_to_detail_mailbox),
        DEF(SET_BOOL, lmtp_rcpt_check_quota),
+       DEF(SET_BOOL, lmtp_add_received_header),
        DEF(SET_UINT, lmtp_user_concurrency_limit),
        DEF(SET_ENUM, lmtp_hdr_delivery_address),
        DEF(SET_STR_VARS, lmtp_rawlog_dir),
@@ -80,6 +81,7 @@ static const struct lmtp_settings lmtp_default_settings = {
        .lmtp_proxy = FALSE,
        .lmtp_save_to_detail_mailbox = FALSE,
        .lmtp_rcpt_check_quota = FALSE,
+       .lmtp_add_received_header = TRUE,
        .lmtp_user_concurrency_limit = 0,
        .lmtp_hdr_delivery_address = "final:none:original",
        .lmtp_rawlog_dir = "",
index 59cf8ac1fe42b58188e0e782f66e16f58935b035..aae84ca71af0c22eb15d6ad54d9e29a22ce3df4a 100644 (file)
@@ -17,6 +17,7 @@ struct lmtp_settings {
        bool lmtp_proxy;
        bool lmtp_save_to_detail_mailbox;
        bool lmtp_rcpt_check_quota;
+       bool lmtp_add_received_header;
        unsigned int lmtp_user_concurrency_limit;
        const char *lmtp_hdr_delivery_address;
        const char *lmtp_rawlog_dir;