diff options
-rw-r--r-- | src/main.h | 1 | ||||
-rw-r--r-- | src/protocol.c | 20 | ||||
m--------- | src/rdns | 0 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/main.h b/src/main.h index 338c09f45..b47379c03 100644 --- a/src/main.h +++ b/src/main.h @@ -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 */ diff --git a/src/protocol.c b/src/protocol.c index 1a831aa25..846648212 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -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); diff --git a/src/rdns b/src/rdns -Subproject 5ca36d831ef871fbc7b76846b554a875c1ef5a8 +Subproject 38f3dc889752939835591ee1d29495c00117f41 |