From: Vsevolod Stakhov Date: Tue, 16 Aug 2016 16:03:07 +0000 (+0100) Subject: [Feature] Log URLs encrypted if we have log encryption pubkey X-Git-Tag: 1.3.4~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95492aa853706b30d32c04bdbf6fc79b90de41e4;p=thirdparty%2Frspamd.git [Feature] Log URLs encrypted if we have log encryption pubkey --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 201142c17d..0ecc76ec66 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -692,7 +692,7 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) len = task->from_envelope->addr_len; } - msg_info_task ("<%s> %s: %*s; ip: %s; URL: %*s", + msg_info_task_encrypted ("<%s> %s: %*s; ip: %s; URL: %*s", task->message_id, has_user ? "user" : "from", len, user_field, diff --git a/src/libutil/logger.c b/src/libutil/logger.c index a57eacfa67..0b90fb9690 100644 --- a/src/libutil/logger.c +++ b/src/libutil/logger.c @@ -497,7 +497,7 @@ rspamd_common_logv (rspamd_logger_t *rspamd_log, gint level_flags, const gchar *fmt, va_list args) { gchar logbuf[RSPAMD_LOGBUF_SIZE], *end; - gint level = level_flags & (RSPAMD_LOG_LEVEL_MASK|G_LOG_LEVEL_MASK); + gint level = level_flags & (RSPAMD_LOG_LEVEL_MASK & G_LOG_LEVEL_MASK); if (rspamd_log == NULL) { rspamd_log = default_logger; diff --git a/src/libutil/logger.h b/src/libutil/logger.h index d84c64b901..f3ba9da28b 100644 --- a/src/libutil/logger.h +++ b/src/libutil/logger.h @@ -192,6 +192,22 @@ const guint64* rspamd_log_counters (rspamd_logger_t *logger); task->task_pool->tag.tagname, task->task_pool->tag.uid, \ G_STRFUNC, \ __VA_ARGS__) +#define msg_err_task_encrypted(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL|RSPAMD_LOG_ENCRYPTED, \ + task->task_pool->tag.tagname, task->task_pool->tag.uid, \ + G_STRFUNC, \ + __VA_ARGS__) +#define msg_warn_task_encrypted(...) rspamd_default_log_function (G_LOG_LEVEL_WARNING|RSPAMD_LOG_ENCRYPTED, \ + task->task_pool->tag.tagname, task->task_pool->tag.uid, \ + G_STRFUNC, \ + __VA_ARGS__) +#define msg_info_task_encrypted(...) rspamd_default_log_function (G_LOG_LEVEL_INFO|RSPAMD_LOG_ENCRYPTED, \ + task->task_pool->tag.tagname, task->task_pool->tag.uid, \ + G_STRFUNC, \ + __VA_ARGS__) +#define msg_debug_task_encrypted(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG|RSPAMD_LOG_ENCRYPTED, \ + task->task_pool->tag.tagname, task->task_pool->tag.uid, \ + G_STRFUNC, \ + __VA_ARGS__) /* Check for NULL pointer first */ #define msg_err_task_check(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \ task ? task->task_pool->tag.tagname : NULL, task ? task->task_pool->tag.uid : NULL, \