]> source.dussan.org Git - rspamd.git/commitdiff
Add Log header to prevent logging of a task.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 8 Mar 2014 22:12:17 +0000 (22:12 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 8 Mar 2014 22:12:17 +0000 (22:12 +0000)
src/main.h
src/protocol.c
src/rdns

index 338c09f455b2624165141c8733afe24fee010317..b47379c0333581b92f7d196fd29ca04cab9f47b6 100644 (file)
@@ -248,6 +248,7 @@ struct worker_task {
        guint32 scan_milliseconds;                                                                      /**< how much milliseconds passed                                       */
        gboolean view_checked;
        gboolean pass_all_filters;                                                                      /**< pass task throught every rule                                      */
+       gboolean no_log;                                                                                        /**< do not log or write this task to the history       */
        guint32 parser_recursion;                                                                       /**< for avoiding recursion stack overflow                      */
        gboolean (*fin_callback)(void *arg);                                            /**< calback for filters finalizing                                     */
        void *fin_arg;                                                                                          /**< argument for fin callback                                          */
index 1a831aa25e6a33efb696031add44740e1b8aaf27..8466482124803e26edfd7b1d1a8ff0234b924bd4 100644 (file)
@@ -94,6 +94,7 @@
 #define JSON_HEADER "Json"
 #define HOSTNAME_HEADER "Hostname"
 #define DELIVER_TO_HEADER "Deliver-To"
+#define NO_LOG_HEADER "Log"
 
 static GList                   *custom_commands = NULL;
 
@@ -382,6 +383,17 @@ rspamd_protocol_handle_headers (struct worker_task *task, struct rspamd_http_mes
                                res = FALSE;
                        }
                        break;
+               case 'l':
+               case 'L':
+                       if (g_ascii_strcasecmp (headern, NO_LOG_HEADER) == 0) {
+                               if (g_ascii_strcasecmp (h->value->str, "no") == 0) {
+                                       task->no_log = TRUE;
+                               }
+                       }
+                       else {
+                               res = FALSE;
+                       }
+                       break;
                default:
                        debug_task ("wrong header: %s", headern);
                        res = FALSE;
@@ -667,7 +679,9 @@ write_check_reply (struct rspamd_http_message *msg, struct worker_task *task)
                rspamd_printf_gstring (logbuf, "user: %s, ", task->user);
        }
 
-       rspamd_roll_history_update (task->worker->srv->history, task);
+       if (!task->no_log) {
+               rspamd_roll_history_update (task->worker->srv->history, task);
+       }
        g_hash_table_iter_init (&hiter, task->results);
 
        /* Convert results to an ucl object */
@@ -690,7 +704,9 @@ write_check_reply (struct rspamd_http_message *msg, struct worker_task *task)
        top = ucl_object_insert_key (top, ucl_object_fromstring (task->message_id), "message-id", 0, false);
 
        write_hashes_to_log (task, logbuf);
-       msg_info ("%v", logbuf);
+       if (!task->no_log) {
+               msg_info ("%v", logbuf);
+       }
        g_string_free (logbuf, TRUE);
 
        msg->body = g_string_sized_new (BUFSIZ);
index 5ca36d831ef871fbc7b76846b554a875c1ef5a87..38f3dc889752939835591ee1d29495c00117f41e 160000 (submodule)
--- a/src/rdns
+++ b/src/rdns
@@ -1 +1 @@
-Subproject commit 5ca36d831ef871fbc7b76846b554a875c1ef5a87
+Subproject commit 38f3dc889752939835591ee1d29495c00117f41e