From: Andrew Lewis Date: Tue, 28 Feb 2017 13:29:02 +0000 (+0200) Subject: [Minor] Fail upstreams in antivirus module X-Git-Tag: 1.5.0~10^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1460%2Fhead;p=rspamd.git [Minor] Fail upstreams in antivirus module --- diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index ae0cd6b14..c7664f6d1 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -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