]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add ignore_received option
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 27 Feb 2016 13:39:26 +0000 (13:39 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 27 Feb 2016 13:39:26 +0000 (13:39 +0000)
In this mode rspamd ignores data from the first received (it might be
produced by some third party and not our MTA)

src/libmime/message.c
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c

index 0daa5d880c2bdf6e635fdcd674fc91db04eb61a5..a843f3836631dfc7811cf7d9018ffca484e07052 100644 (file)
@@ -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,
index 17ca4f86397ca368bef31ce05fe260458b875acd..2ed82930bc2fb5753c6fd570fa64161d3ee3cf2a 100644 (file)
@@ -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                 */
index 83b3dcadab998627db277a80cf6605147ac2958f..b5f5b0763153366b0578e27785d5bb13a61ac5b8 100644 (file)
@@ -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,