From b61ab6363a7685524f60ab27d94c68a15b4fa4dd Mon Sep 17 00:00:00 2001 From: Julien Froment Date: Tue, 12 Sep 2023 09:58:34 -0400 Subject: [PATCH] Fix processing of exp macro --- Gemfile.lock | 2 +- lib/spf/model.rb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 779b30b..927f2be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - spf (0.1) + spf (0.1.1) ruby-ip (~> 0.9.1) GEM diff --git a/lib/spf/model.rb b/lib/spf/model.rb index dc61859..bdd4f7f 100644 --- a/lib/spf/model.rb +++ b/lib/spf/model.rb @@ -745,19 +745,18 @@ def params def process(server, request, result) begin - exp_domain = @domain_spec.new({:server => server, :request => request}) + exp_domain = @domain_spec.text txt_packet = server.dns_lookup(exp_domain, 'TXT') - txt_rrs = txt_packet.answer.select {|x| x.type == 'TXT'}.map {|x| x.answer} - unless text_rrs.length > 0 + unless txt_packet.length > 0 server.throw_result(:permerror, request, "No authority explanation string available at domain '#{exp_domain}'") # RFC 4408, 6.2/4 end - unless text_rrs.length == 1 + unless txt_packet.length == 1 server.throw_result(:permerror, request, "Redundant authority explanation strings found at domain '#{exp_domain}'") # RFC 4408, 6.2/4 end explanation = SPF::MacroString.new( - :text => txt_rrs[0].char_str_list.join(''), + :text => txt_packet[0].strings.join(''), :server => server, :request => request, :is_explanation => true