diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-27 13:39:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-27 13:39:26 +0000 |
commit | 6176ad586b6c312b49d70c2917e38b1d851bda92 (patch) | |
tree | 3a4594057890d4ed2ab663ef73bb3d571c362df4 /src | |
parent | 2b9068e5f79b444977c007eff37c9749d1e3b3bb (diff) | |
download | rspamd-6176ad586b6c312b49d70c2917e38b1d851bda92.tar.gz rspamd-6176ad586b6c312b49d70c2917e38b1d851bda92.zip |
[Feature] Add ignore_received option
In this mode rspamd ignores data from the first received (it might be
produced by some third party and not our MTA)
Diffstat (limited to 'src')
-rw-r--r-- | src/libmime/message.c | 5 | ||||
-rw-r--r-- | src/libserver/cfg_file.h | 1 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.c | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c index 0daa5d880..a843f3836 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1690,7 +1690,7 @@ rspamd_message_parse (struct rspamd_task *task) if (i == 0) { gboolean need_recv_correction = FALSE; - if (recv->real_ip == NULL) { + if (recv->real_ip == NULL || task->cfg->ignore_received) { need_recv_correction = TRUE; } else if (!(task->flags & RSPAMD_TASK_FLAG_NO_IP) && task->from_addr) { @@ -1731,7 +1731,8 @@ rspamd_message_parse (struct rspamd_task *task) } /* Extract data from received header if we were not given IP */ - if (task->received->len > 0 && (task->flags & RSPAMD_TASK_FLAG_NO_IP)) { + if (task->received->len > 0 && (task->flags & RSPAMD_TASK_FLAG_NO_IP) && + !task->cfg->ignore_received) { recv = g_ptr_array_index (task->received, 0); if (recv->real_ip) { if (!rspamd_parse_inet_address (&task->from_addr, diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 17ca4f863..2ed82930b 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -246,6 +246,7 @@ struct rspamd_config { gboolean allow_raw_input; /**< scan messages with invalid mime */ gboolean disable_hyperscan; /**< disable hyperscan usage */ gboolean enable_shutdown_workaround; /**< enable workaround for legacy SA clients (exim) */ + gboolean ignore_received; /**< Ignore data from the first received header */ gsize max_diff; /**< maximum diff size for text parts */ gsize max_cores_size; /**< maximum size occupied by rspamd core files */ diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index 83b3dcada..b5f5b0763 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1675,6 +1675,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg) G_STRUCT_OFFSET (struct rspamd_config, enable_shutdown_workaround), 0, "Enable workaround for legacy clients"); + rspamd_rcl_add_default_handler (sub, + "ignore_received", + rspamd_rcl_parse_struct_boolean, + G_STRUCT_OFFSET (struct rspamd_config, ignore_received), + 0, + "Ignore data from the first received header"); /* New DNS configuration */ ssub = rspamd_rcl_add_section_doc (&sub->subsections, "dns", NULL, NULL, UCL_OBJECT, FALSE, TRUE, |