Parcourir la source

Merge pull request #4924 from fatalbanana/cmae_scores

[Minor] Cloudmark scores_symbols: convert keys to numeric values
pull/4925/head
Vsevolod Stakhov il y a 1 mois
Parent
révision
5dce4c98e6
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 18 ajouts et 0 suppressions
  1. 18
    0
      lualib/lua_scanners/cloudmark.lua

+ 18
- 0
lualib/lua_scanners/cloudmark.lua Voir le fichier

@@ -89,6 +89,20 @@ local function cloudmark_preload(rule, cfg, ev_base, _)
})
end

local function numerify(d)
local l = {}
for k in pairs(d) do
table.insert(l, k)
end
for _, k in ipairs(l) do
local new_key = tonumber(k)
if new_key then
d[new_key] = d[k]
d[k] = nil
end
end
end

local function cloudmark_config(opts)

local cloudmark_conf = {
@@ -116,6 +130,10 @@ local function cloudmark_config(opts)

cloudmark_conf = lua_util.override_defaults(cloudmark_conf, opts)

if type(cloudmark_conf.scores_symbols) == 'table' then
numerify(cloudmark_conf.scores_symbols)
end

if not cloudmark_conf.prefix then
cloudmark_conf.prefix = 'rs_' .. cloudmark_conf.name .. '_'
end

Chargement…
Annuler
Enregistrer