From 37c8503032dadd92a080cfcd09ad971eed65ca77 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 11 Nov 2020 15:08:01 +0000 Subject: [PATCH] [Minor] Use rspamd_parsers directly --- rules/misc.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rules/misc.lua b/rules/misc.lua index 870952c94..a0b46f0fb 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -19,6 +19,7 @@ limitations under the License. local E = {} local fun = require "fun" local util = require "rspamd_util" +local rspamd_parsers = require "rspamd_parsers" local rspamd_regexp = require "rspamd_regexp" local rspamd_lua_utils = require "lua_util" @@ -65,7 +66,7 @@ local date_id = rspamd_config:register_symbol({ return end - local dm, err = util.parse_smtp_date(date_time) + local dm, err = rspamd_parsers.parse_smtp_date(date_time) if err then task:insert_result('INVALID_DATE', 1.0) return @@ -540,7 +541,7 @@ local check_from_display_name = rspamd_config:register_symbol{ local from = task:get_from(2) if not (from and from[1] and from[1].name) then return false end -- See if we can parse an email address from the name - local parsed = util.parse_mail_address(from[1].name, task:get_mempool()) + local parsed = rspamd_parsers.parse_mail_address(from[1].name, task:get_mempool()) if not parsed then return false end if not (parsed[1] and parsed[1]['addr']) then return false end -- Make sure we did not mistake e.g. @ for an email address @@ -621,7 +622,7 @@ rspamd_config.SPOOF_REPLYTO = { end if not found_fromdom then return false end -- Parse Reply-To header - local parsed = ((util.parse_mail_address(rt, task:get_mempool()) or E)[1] or E).domain + local parsed = ((rspamd_parsers.parse_mail_address(rt, task:get_mempool()) or E)[1] or E).domain if not parsed then return false end -- Reply-To domain must be different to From domain if not util.strequal_caseless(parsed, from[1].domain) then -- 2.39.5