]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Stop expecting hostname to be "unknown" 1908/head
authorAndrew Lewis <nerf@judo.za.org>
Tue, 7 Nov 2017 16:44:09 +0000 (18:44 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 7 Nov 2017 16:44:09 +0000 (18:44 +0200)
src/plugins/lua/dcc.lua
src/plugins/lua/greylist.lua
src/plugins/lua/hfilter.lua
src/plugins/lua/multimap.lua
src/plugins/lua/once_received.lua

index 7995699b266b039903bd634f2791fe82219c9635..503dcce7cd6c05c05d52b62bcbc0a7f0562f25aa 100644 (file)
@@ -45,7 +45,7 @@ local function check_dcc (task)
     client = client_ip:to_string()
   end
   local client_host = task:get_hostname()
-  if client_host and client_host ~= 'unknown' then
+  if client_host then
     client = client .. "\r" .. client_host
   end
 
@@ -140,4 +140,4 @@ if opts and opts['host'] then
   })
 else
   logger.infox('DCC module not configured');
-end
\ No newline at end of file
+end
index 76d95acb2e42e56579aa645e8188749d74101c59..32338f7d550855e94dd848c2b8d212f0c55a0a42 100644 (file)
@@ -284,7 +284,7 @@ local function greylist_set(task)
   -- Third and second level domains whitelist
   if not is_whitelisted and whitelist_domains_map then
     local hostname = task:get_hostname()
-    if hostname and hostname ~= 'unknown' then
+    if hostname then
       local domain = rspamd_util.get_tld(hostname)
       if whitelist_domains_map:get_key(hostname) or (domain and whitelist_domains_map:get_key(domain)) then
         is_whitelisted = 'meta'
index ca77dddc45a89d254cac8ca965805079b1b38689..a564c1c4458dc5b07cf4cf114aaa4feed78f4f41 100644 (file)
@@ -307,7 +307,7 @@ local function check_host(task, host, symbol_suffix, eq_ip, eq_host)
   end
 
   if check_fqdn(host) then
-    if eq_host == '' or eq_host ~= 'unknown' or eq_host ~= host then
+    if eq_host == '' or eq_host ~= host then
       task:get_resolver():resolve('a', {
         task=task,
         name = host,
@@ -462,17 +462,15 @@ local function hfilter(task)
   if config['hostname_enabled'] then
     if hostname then
       -- Check regexp HOSTNAME
-      if hostname == 'unknown' then
-        task:insert_result('HFILTER_HOSTNAME_UNKNOWN', 1.00)
-      else
-        local weights = checks_hellohost_map:get_key(hostname)
-        for _,weight in ipairs(weights or {}) do
-          weight = tonumber(weight) or 0
-          if weight > weight_hostname then
-            weight_hostname = weight
-          end
+      local weights = checks_hellohost_map:get_key(hostname)
+      for _,weight in ipairs(weights or {}) do
+        weight = tonumber(weight) or 0
+        if weight > weight_hostname then
+          weight_hostname = weight
         end
       end
+    else
+      task:insert_result('HFILTER_HOSTNAME_UNKNOWN', 1.00)
     end
   end
 
index 6b27f5ff8c295efbd9abbe750384cf0a25e8fa8b..407a943bc4482939783187449e622aaa4a2a7092 100644 (file)
@@ -756,7 +756,7 @@ local function multimap_callback(task, rule)
     end,
     hostname = function()
       local hostname = task:get_hostname()
-      if hostname and hostname ~= 'unknown' then
+      if hostname then
         match_hostname(rule, hostname)
       end
     end,
index e6dd444364453ac1fb353c4c6f4cb8f2f3b791df..d8fae5cf1f63260f80b12494a328a8f832e93fa1 100644 (file)
@@ -90,7 +90,7 @@ local function check_quantity_received (task)
 
   local hn = task:get_hostname()
   -- Here we don't care about received
-  if (not hn or hn == 'unknown') and task_ip and task_ip:is_valid() then
+  if (not hn) and task_ip and task_ip:is_valid() then
     task:get_resolver():resolve_ptr({task = task,
       name = task_ip:to_string(),
       callback = recv_dns_cb,