From 2a82f0c2f55c812497ed639e528318193a7b5fef Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 12 Feb 2019 16:12:39 +0000 Subject: [PATCH] [Minor] History_redis: Use generic function to obfuscate subject --- src/plugins/lua/history_redis.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index 5b46d0ffe..c18ea736c 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -19,7 +19,6 @@ if confighelp then end local redis_params -local hash = require 'rspamd_cryptobox_hash' local settings = { key_prefix = 'rs_history', -- default key name @@ -208,14 +207,7 @@ local function handle_history_request(task, conn, from, to, reset) collectgarbage() t1 = rspamd_util:get_ticks() fun.each(function(e) - if e.subject and not rspamd_util.is_valid_utf8(e.subject) then - e.subject = '???' - elseif settings.subject_privacy then - local hash_alg = settings.subject_privacy_alg - local subject_hash = hash.create_specific(hash_alg, e.subject) - e.subject = settings.subject_privacy_prefix .. ':' .. - subject_hash:hex():sub(1,settings.subject_privacy_length) - end + e.subject = lua_util.maybe_obfuscate_subject(e.subject, settings) end, data) reply.rows = data conn:send_ucl(reply) -- 2.39.5