]> source.dussan.org Git - rspamd.git/commitdiff
Skip good hostname check for undefined hostnames 529/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 17 Feb 2016 11:43:09 +0000 (14:43 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Wed, 17 Feb 2016 11:43:09 +0000 (14:43 +0300)
2016-02-17 13:00:50 #58424(normal) <a41bdc>; task; lua_metric_symbol_callback: call to (ONCE_RECEIVED) failed: /usr/local/share/rspamd/lua/once_received.lua:82: bad argument #1 to 'lower' (string expected, got nil); trace: [1]:{[C]:-1 - lower [C]}; [2]:{/usr/local/share/rspamd/lua/once_received.lua:82 - <unknown> [Lua]};

src/plugins/lua/once_received.lua

index eac93b89e5706226a143d7a109319bc944f5d44e..7d5d5edbb1b19b7616c3cf273711231de947a83b 100644 (file)
@@ -79,13 +79,15 @@ local function check_quantity_received (task)
       return
     end
 
-    local hn = string.lower(r['real_hostname'])
-    -- Check for good hostname
-    if hn and good_hosts then
-      for _,gh in ipairs(good_hosts) do
-        if string.find(hn, gh) then
-          ret = false
-          break
+    if r['real_hostname'] then
+      local hn = string.lower(r['real_hostname'])
+      -- Check for good hostname
+      if hn and good_hosts then
+        for _,gh in ipairs(good_hosts) do
+          if string.find(hn, gh) then
+            ret = false
+            break
+          end
         end
       end
     end