aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-03-08 22:12:17 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-03-08 22:12:17 +0000
commit326f96d599a7b7906c6c857f895ef344212eab21 (patch)
tree19b7b4140a01937ae2ed3743c390a597c69de091 /src/protocol.c
parent7cc016c601bc731b1cc6a46c09d21cb41b16b105 (diff)
downloadrspamd-326f96d599a7b7906c6c857f895ef344212eab21.tar.gz
rspamd-326f96d599a7b7906c6c857f895ef344212eab21.zip
Add Log header to prevent logging of a task.
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c20
1 files changed, 18 insertions, 2 deletions
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);