]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fail upstreams in antivirus module 1460/head
authorAndrew Lewis <nerf@judo.za.org>
Tue, 28 Feb 2017 13:29:02 +0000 (15:29 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 28 Feb 2017 13:29:02 +0000 (15:29 +0200)
src/plugins/lua/antivirus.lua

index ae0cd6b1448d87986cf7e054a6d197fc9eb8d636..c7664f6d1880d8ffa2b2eb2c6472060b816d9ad1 100644 (file)
@@ -321,12 +321,14 @@ local function fprot_check(task, rule)
             })
           else
             rspamd_logger.errx(task, 'failed to scan, maximum retransmits exceed')
+            upstream:fail()
           end
         else
           rspamd_logger.errx(task, 'failed to scan: %s', err)
+          upstream:fail()
         end
       else
-
+        upstream:ok()
         data = tostring(data)
         local found = (string.sub(data, 1, 1) == '1')
         local cached = 'OK'
@@ -385,12 +387,14 @@ local function clamav_check(task, rule)
             })
           else
             rspamd_logger.errx(task, 'failed to scan, maximum retransmits exceed')
+            upstream:fail()
           end
         else
           rspamd_logger.errx(task, 'failed to scan: %s', err)
+          upstream:fail()
         end
       else
-
+        upstream:ok()
         data = tostring(data)
         local s = string.find(data, ' FOUND')
         local cached = 'OK'
@@ -448,12 +452,14 @@ local function sophos_check(task, rule)
             })
           else
             rspamd_logger.errx(task, 'failed to scan, maximum retransmits exceed')
+            upstream:fail()
           end
         else
           rspamd_logger.errx(task, 'failed to scan: %s', err)
+          upstream:fail()
         end
       else
-
+        upstream:ok()
         data = tostring(data)
         local vname = string.match(data, 'VIRUS (%S+) ')
         if vname then
@@ -567,12 +573,14 @@ local function savapi_check(task, rule)
             })
           else
             rspamd_logger.errx(task, 'failed to scan, maximum retransmits exceed')
+            upstream:fail()
           end
         else
           rspamd_logger.errx(task, 'failed to scan: %s', err)
+          upstream:fail()
         end
       else
-
+        upstream:ok()
         local result = tostring(data)
 
         -- 100 SAVAPI:4.0 greeting