From: Vsevolod Stakhov Date: Wed, 21 Nov 2018 17:36:09 +0000 (+0000) Subject: [Minor] Oops, save content if file X-Git-Tag: 1.8.3~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea0ebd9d56238426959c782a57e089adfa3f948b;p=thirdparty%2Frspamd.git [Minor] Oops, save content if file --- diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index d9bcfa9a38..d7dfa0fafb 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -135,7 +135,7 @@ local function clamav_config(opts) scan_image_mime = false; default_port = 3310, log_clean = false, - timeout = 15.0, + timeout = 15.0, -- FIXME: this will break task_timeout! retransmits = 2, cache_expire = 3600, -- expire redis in one hour message = default_message, @@ -174,7 +174,7 @@ local function fprot_config(opts) scan_text_mime = false; scan_image_mime = false; default_port = 10200, - timeout = 15.0, + timeout = 15.0, -- FIXME: this will break task_timeout! log_clean = false, retransmits = 2, cache_expire = 3600, -- expire redis in one hour @@ -258,8 +258,8 @@ local function savapi_config(opts) default_port = 4444, -- note: You must set ListenAddress in savapi.conf product_id = 0, log_clean = false, - timeout = 15.0, - retransmits = 2, + timeout = 15.0, -- FIXME: this will break task_timeout! + retransmits = 1, -- FIXME: useless, for local files cache_expire = 3600, -- expire redis in one hour message = default_message, tmpdir = '/tmp', @@ -567,7 +567,6 @@ local function sophos_check(task, content, digest, rule) local function sophos_callback(err, data, conn) if err then - -- set current upstream to fail because an error occurred upstream:fail() @@ -676,6 +675,13 @@ local function savapi_check(task, content, digest, rule) return end + if type(content) == 'string' then + -- Create rspamd_text + local rspamd_text = require "rspamd_text" + content = rspamd_text.fromstring(content) + end + content:save_in_file(message_fd) + -- Ensure cleanup task:get_mempool():add_destructor(function() os.remove(fname)