diff options
author | cebka@lenovo-laptop <cebka@lenovo-laptop> | 2010-01-28 21:13:14 +0300 |
---|---|---|
committer | cebka@lenovo-laptop <cebka@lenovo-laptop> | 2010-01-28 21:13:14 +0300 |
commit | d99af160393f8a34466ac869c6d4fdb6f00bf318 (patch) | |
tree | 54f193d015db88fe47d2d12739b8f11e9bedcf15 /src/protocol.c | |
parent | abdd0d3b1c21cefa2719799fdfa2ca27726741df (diff) | |
download | rspamd-d99af160393f8a34466ac869c6d4fdb6f00bf318.tar.gz rspamd-d99af160393f8a34466ac869c6d4fdb6f00bf318.zip |
* Write part's hashes to log for messages identify
Diffstat (limited to 'src/protocol.c')
-rw-r--r-- | src/protocol.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/protocol.c b/src/protocol.c index 0cba93b21..feb577368 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -27,6 +27,7 @@ #include "util.h" #include "cfg_file.h" #include "settings.h" +#include "message.h" /* Max line size as it is defined in rfc2822 */ #define OUTBUFSIZ 1000 @@ -405,6 +406,28 @@ struct metric_callback_data { }; static void +write_hashes_to_log (struct worker_task *task, char *logbuf, int offset, int size) +{ + GList *cur; + struct mime_text_part *text_part; + + cur = task->text_parts; + + while (cur && offset < size) { + text_part = cur->data; + if (text_part->fuzzy) { + if (cur->next != NULL) { + offset += snprintf (logbuf + offset, size - offset, " part: %Xd,", text_part->fuzzy->h); + } + else { + offset += snprintf (logbuf + offset, size - offset, " part: %Xd", text_part->fuzzy->h); + } + } + cur = g_list_next (cur); + } +} + +static void show_url_header (struct worker_task *task) { int r = 0; @@ -673,6 +696,8 @@ write_check_reply (struct worker_task *task) /* URL stat */ show_url_header (task); } + + write_hashes_to_log (task, logbuf, cd.log_offset, cd.log_size); msg_info ("%s", logbuf); rspamd_dispatcher_write (task->dispatcher, CRLF, sizeof (CRLF) - 1, FALSE, TRUE); @@ -724,6 +749,7 @@ write_process_reply (struct worker_task *task) g_hash_table_foreach (task->results, show_metric_result, &cd); /* URL stat */ } + write_hashes_to_log (task, logbuf, cd.log_offset, cd.log_size); msg_info ("%s", logbuf); outmsg = g_mime_object_to_string (GMIME_OBJECT (task->message)); |