]> source.dussan.org Git - rspamd.git/commitdiff
Parse IP from the first received header if not specified by protocol.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Mar 2015 10:57:59 +0000 (10:57 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Mar 2015 10:57:59 +0000 (10:57 +0000)
src/libmime/message.c

index 15a59978da4bbda52c5ed489645c2e194fee55d7..f8ae255549c422a6e7563b381a1315d428187464 100644 (file)
@@ -1600,6 +1600,20 @@ process_message (struct rspamd_task *task)
                /* Restore normal order */
                task->received = g_list_reverse (task->received);
 
+               /* Extract data from received header if we were not given IP */
+               if (task->received && (task->flags & RSPAMD_TASK_FLAG_NO_IP)) {
+                       recv = task->received->data;
+                       if (recv->real_ip) {
+                               if (!rspamd_parse_inet_address (&task->from_addr, recv->real_ip)) {
+                                       msg_warn ("cannot get IP from received header: '%s'",
+                                                       recv->real_ip);
+                               }
+                       }
+                       if (recv->real_hostname) {
+                               task->hostname = recv->real_hostname;
+                       }
+               }
+
                /* free the parser (and the stream) */
                g_object_unref (parser);
        }