Skip to content

Commit

Permalink
Check PTR against FQDN (including dot at the end) (closes #28)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Apr 3, 2024
1 parent 29b47c7 commit 3378f96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/spf/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ records:
spf: ptr.test.org v=spf1 ptr:test.org -all
mx: mx.test.org 10.0.0.1,10.0.0.2,10.0.0.3,10.0.0.4,10.0.0.5,10.0.0.6,10.0.0.7,10.0.0.8,10.0.0.9,10.0.0.10,10.0.0.11
ptr: 10.0.0.1 h1.test.org
ptr: 10.0.0.11 h1.test.org, h2.test.org, h3.test.org, h4.test.org, h5.test.org, h6.test.org, h7.test.org, h8.test.org, h9.test.org, h10.test.org, h11.test.org
ptr: 10.0.0.11 h1.test.org, h2.test.org., h3.test.org., h4.test.org, h5.test.org, h6.test.org, h7.test.org, h8.test.org, h9.test.org, h10.test.org, h11.test.org
a: h1.test.org 10.0.0.1
a: h11.test.org 10.0.0.11
tests:
Expand Down
5 changes: 4 additions & 1 deletion src/spf/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ impl Resolver {
self.ip_matches(record, ip, u32::MAX, u128::MAX).await
{
matches = record == &target_addr
|| record.ends_with(&target_sub_addr);
|| record
.strip_suffix('.')
.unwrap_or(record.as_str())
.ends_with(&target_sub_addr);
if matches {
break;
}
Expand Down

0 comments on commit 3378f96

Please sign in to comment.