diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-11 15:08:01 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-11 15:08:01 +0000 |
commit | 37c8503032dadd92a080cfcd09ad971eed65ca77 (patch) | |
tree | 71ce63133bf8d0bf37fcfc8ea730ba3c7f60c80b /rules | |
parent | fa15fa29ca5a89e95d5cf90009668814b0032cf9 (diff) | |
download | rspamd-37c8503032dadd92a080cfcd09ad971eed65ca77.tar.gz rspamd-37c8503032dadd92a080cfcd09ad971eed65ca77.zip |
[Minor] Use rspamd_parsers directly
Diffstat (limited to 'rules')
-rw-r--r-- | rules/misc.lua | 7 |
1 files 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. <something>@<name> 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 |