]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Lua_maps: Fix adjustments for the map type in the complex map definitions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 13 Mar 2021 11:00:47 +0000 (11:00 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 13 Mar 2021 11:00:47 +0000 (11:00 +0000)
lualib/lua_maps.lua

index 77aa298e5e7ec2d4343a0c905d62601f43f4f61e..a3dc88053b45bc08538e5a764d5615c0ea31c8b3 100644 (file)
@@ -153,6 +153,20 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
     end
 
     if opt[1] then
+      -- Adjust each element if needed
+      local adjusted
+      for i,source in ipairs(opt) do
+        local nsrc,ntype = maybe_adjust_type(source, mtype)
+
+        if mtype ~= ntype then
+          if not adjusted then
+            mtype = ntype
+          end
+          adjusted = true
+        end
+        opt[i] = nsrc
+      end
+
       if mtype == 'radix' then
 
         if string.find(opt[1], '^%d') then