aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_util.lua
diff options
context:
space:
mode:
authorAnton Yuzhaninov <citrin+git@citrin.ru>2019-07-01 17:33:24 +0100
committerAnton Yuzhaninov <citrin+git@citrin.ru>2019-07-01 17:33:24 +0100
commitbab9c14b048bee2b33b8f2aa9d5ce4215f0413f7 (patch)
tree3b62738c386c3c858cad3bc3889ea07127d5d7b2 /lualib/lua_util.lua
parent978f87970bab21475efb4e8922d85af0b6446172 (diff)
downloadrspamd-bab9c14b048bee2b33b8f2aa9d5ce4215f0413f7.tar.gz
rspamd-bab9c14b048bee2b33b8f2aa9d5ce4215f0413f7.zip
[Minor] Allow to disable hash trimming in maybe_obfuscate_string
Don't trim hash if <prefix>_privacy_length is zero.
Diffstat (limited to 'lualib/lua_util.lua')
-rw-r--r--lualib/lua_util.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index d1d43564d..e8dc57429 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -943,7 +943,7 @@ end
-- * <prefix>_privacy = false - subject privacy is off
-- * <prefix>_privacy_alg = 'blake2' - default hash-algorithm to obfuscate subject
-- * <prefix>_privacy_prefix = 'obf' - prefix to show it's obfuscated
--- * <prefix>_privacy_length = 16 - cut the length of the hash
+-- * <prefix>_privacy_length = 16 - cut the length of the hash; if 0 or fasle full hash is returned
-- @return obfuscated or validated subject
--]]
@@ -958,7 +958,7 @@ exports.maybe_obfuscate_string = function(subject, settings, prefix)
local subject_hash = hash.create_specific(hash_alg, subject)
local strip_len = settings[prefix .. '_privacy_length']
- if strip_len then
+ if strip_len and strip_len > 0 then
subject = subject_hash:hex():sub(1, strip_len)
else
subject = subject_hash:hex()