From: cebka@lenovo-laptop Date: Thu, 28 Jan 2010 18:13:14 +0000 (+0300) Subject: * Write part's hashes to log for messages identify X-Git-Tag: 0.3.0~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d99af160393f8a34466ac869c6d4fdb6f00bf318;p=thirdparty%2Frspamd.git * Write part's hashes to log for messages identify --- diff --git a/src/protocol.c b/src/protocol.c index 0cba93b213..feb5773680 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 @@ -404,6 +405,28 @@ struct metric_callback_data { int log_size; }; +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) { @@ -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));