commit 2a82f0c: [Minor] History_redis: Use generic function to obfuscate subject

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 12 16:28:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-12 16:12:39 +0000
URL: https://github.com/rspamd/rspamd/commit/2a82f0c2f55c812497ed639e528318193a7b5fef

[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)


More information about the Commits mailing list