]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Add no-ip flag for task structure.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Mar 2015 10:48:12 +0000 (10:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Mar 2015 10:48:12 +0000 (10:48 +0000)
src/libserver/protocol.c
src/libserver/task.h

index 3c6dd41a942df61b4e571d4a3ea6c0e3a5917d67..b879db7ff99a6ede6f762215cef4d0619ff5b94a 100644 (file)
@@ -232,7 +232,7 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
        struct rspamd_http_message *msg)
 {
        gchar *headern, *tmp;
-       gboolean res = TRUE, validh, fl;
+       gboolean res = TRUE, validh, fl, has_ip = FALSE;
        struct rspamd_http_header *h;
 
        LL_FOREACH (msg->headers, h)
@@ -331,6 +331,7 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
                                        return FALSE;
                                }
                                debug_task ("read IP header, value: %s", tmp);
+                               has_ip = TRUE;
                        }
                        else {
                                debug_task ("wrong header: %s", headern);
@@ -413,6 +414,10 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
                task->hostname = rspamd_mempool_strdup (task->task_pool, "unknown");
        }
 
+       if (!has_ip) {
+               task->flags |= RSPAMD_TASK_FLAG_NO_IP;
+       }
+
        return TRUE;
 }
 
index 21df26535f80e0978272508553315e44e1e3ca79..5cec573e7499d4da3f63ea8d99cb8085f1ef8315 100644 (file)
@@ -59,6 +59,7 @@ enum rspamd_metric_action {
 #define RSPAMD_TASK_FLAG_SPAMC (1 << 5)
 #define RSPAMD_TASK_FLAG_PASS_ALL (1 << 6)
 #define RSPAMD_TASK_FLAG_NO_LOG (1 << 7)
+#define RSPAMD_TASK_FLAG_NO_IP (1 << 8)
 
 #define RSPAMD_TASK_IS_SKIPPED(task) (((task)->flags & RSPAMD_TASK_FLAG_SKIP))
 #define RSPAMD_TASK_IS_JSON(task) (((task)->flags & RSPAMD_TASK_FLAG_JSON))
@@ -88,7 +89,7 @@ struct rspamd_task {
        enum rspamd_command cmd;                                    /**< command                                                                                */
        struct custom_command *custom_cmd;                          /**< custom command if any                                                  */
        gint sock;                                                  /**< socket descriptor                                                              */
-       gint flags;
+       guint flags;
 
        gchar *helo;                                                    /**< helo header value                                                          */
        gchar *queue_id;                                                /**< queue id if specified                                                      */