]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow for matching hostnames in multimap (#773)
authorAndrew Lewis <nerf@judo.za.org>
Sun, 31 Jul 2016 13:30:05 +0000 (15:30 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Sun, 31 Jul 2016 13:43:15 +0000 (15:43 +0200)
src/plugins/lua/multimap.lua

index 222cf3f0608796a0b32796c5c8e90ba7fbe2858a..56ea68214f6643d227bc0b2702cfef9e304bd0b7 100644 (file)
@@ -486,6 +486,9 @@ local function multimap_callback(task, rule)
     end
   elseif rt == 'content' then
     match_content(rule)
+  elseif rt == 'hostname' then
+    local hostname = task:get_hostname()
+    match_rule(rule, hostname)
   end
 end
 
@@ -559,7 +562,8 @@ local function add_multimap_rule(key, newrule)
         or newrule['type'] == 'from'
         or newrule['type'] == 'filename'
         or newrule['type'] == 'url'
-        or newrule['type'] == 'content' then
+        or newrule['type'] == 'content'
+        or newrule['type'] == 'hostname' then
         if newrule['regexp'] then
           newrule['hash'] = rspamd_config:add_map ({
             url = newrule['map'],