]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Add globbing support
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Jan 2016 17:40:57 +0000 (17:40 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Jan 2016 17:40:57 +0000 (17:40 +0000)
src/plugins/lua/spamassassin.lua

index 45be259df44e955068963e8062a5d04ce5157d7a..89ff0853e50ad467b5fd3a32b75b3118eb67970b 100644 (file)
@@ -1292,23 +1292,31 @@ if type(section) == "table" then
     else
       if type(fn) == 'table' then
         for k, elt in ipairs(fn) do
-          f = io.open(elt, "r")
+          local files = util.glob(elt)
+
+          for i,matched in ipairs(files) do
+            f = io.open(matched, "r")
+            if f then
+              process_sa_conf(f)
+              has_rules = true
+            else
+              rspamd_logger.errx(rspamd_config, "cannot open %s", matched)
+            end
+          end
+        end
+      else
+        -- assume string
+        local files = util.glob(fn)
+
+        for i,matched in ipairs(files) do
+          f = io.open(matched, "r")
           if f then
             process_sa_conf(f)
             has_rules = true
           else
-            rspamd_logger.errx(rspamd_config, "cannot open %s", elt)
+            rspamd_logger.errx(rspamd_config, "cannot open %s", matched)
           end
         end
-      else
-        -- assume string
-        f = io.open(fn, "r")
-        if f then
-          process_sa_conf(f)
-          has_rules = true
-        else
-          rspamd_logger.errx(rspamd_config, "cannot open %s", fn)
-        end
       end
     end
   end