diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-15 17:34:35 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-15 17:34:35 +0100 |
commit | 2ac0ad45badeb5e0d2c4d6ebbafdbd46bd491ac5 (patch) | |
tree | 91dcc1c75b4b07de38a3c7dab39de9f12aed68ac /src/plugins/lua | |
parent | 4fd256c6140dfa68ffef719cb4c3913a94f24403 (diff) | |
download | rspamd-2ac0ad45badeb5e0d2c4d6ebbafdbd46bd491ac5.tar.gz rspamd-2ac0ad45badeb5e0d2c4d6ebbafdbd46bd491ac5.zip |
Use tld when checking for DMARC policy.
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/dmarc.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index 94ef119a5..27c5ecad3 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -30,7 +30,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. local rspamd_regexp = require "rspamd_regexp" local rspamd_logger = require "rspamd_logger" local rspamd_redis = require "rspamd_redis" +local rspamd_url = require "rspamd_url" local upstream_list = require "rspamd_upstream_list" + --local dumper = require 'pl.pretty'.dump local symbols = { @@ -191,10 +193,12 @@ local function dmarc_callback(task) end if from and from[1]['domain'] and not from[2] then - -- XXX: use tld list here and generate top level domain - local dmarc_domain = '_dmarc.' .. from[1]['domain'] - task:get_resolver():resolve_txt(task:get_session(), task:get_mempool(), - dmarc_domain, dmarc_dns_cb) + local url_from = rspamd_url.create(task:get_mempool(), from[1]['domain']) + if url_from then + local dmarc_domain = '_dmarc.' .. url_from:get_tld() + task:get_resolver():resolve_txt(task:get_session(), task:get_mempool(), + dmarc_domain, dmarc_dns_cb) + end end end |