]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] History_redis: Use generic function to obfuscate subject
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Feb 2019 16:12:39 +0000 (16:12 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Feb 2019 16:12:39 +0000 (16:12 +0000)
src/plugins/lua/history_redis.lua

index 5b46d0ffe1cd3526fb3e1354b004d0f91651e8da..c18ea736cb97be876674dcc9d3d4f8c24c5e1682 100644 (file)
@@ -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)