Skip to content

Commit

Permalink
Fix spurious error message in SPF exists parser.
Browse files Browse the repository at this point in the history
Like the `mx` parser, the `exists` token parser in `Test-SpfRecord`
also suffered from the same bug when *not* running in recursive
mode.  This has been corrected.
  • Loading branch information
rhymeswithmogul committed Dec 7, 2023
1 parent 7844afd commit 981377b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- **FIX** `Test-DaneRecords` now correctly checks DANE records for domains without MX records.
- **FIX** The DMARC `fo` token is now parsed correctly when multiple values are present.
- **FIX** The DMARC `rf` token is now parsed correctly.
- **FIX** The SPF `mx` token parser no longer generates a spurious error when not counting DNS lookups.
- **FIX** The SPF `exists` and `mx` token parsers no longer generate a spurious error when *not* counting DNS lookups.
- **FIX** IntelliSense's handling of `Test-SpfRecord` has been improved by hiding some internal-use-only parameters.
- **FIX** Cleaned up `Test-DaneRecords`' output.
- **FIX** Miscellaneous code cleanup to improve future maintenance.
Expand Down
2 changes: 1 addition & 1 deletion MailPolicyExplainer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Many bugs were fixed, too:
- The DMARC `fo` token is now parsed correctly when multiple values are present.
- The DMARC `rf` token is now parsed correctly.
- The IntelliSense handling of `Test-SpfRecord` has been improved by hiding some internal-use-only parameters.
- The SPF `mx` token parser no longer generates a spurious error when not counting DNS lookups.
- The SPF `exists` and `mx` token parsers no longer generate a spurious error when not counting DNS lookups.
- Cleaned up the output of `Test-DaneRecords` a little.
- Miscellaneous code cleanup.
'
Expand Down
5 changes: 4 additions & 1 deletion src/MailPolicyExplainer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,10 @@ Function Test-SpfRecord
#region Check exists tokens
ElseIf ($token -Match "^[\+\-\?\~]?exists:.*")
{
$DnsLookups.Value++
If ($CountDnsLookups) {
$DnsLookups.Value++
}

If ($token -Match "^\+?exists:.*") {
Write-GoodNews "${RecordType}: Accept mail if $($token -Replace '\+' -Replace 'exists:') resolves to an A record.$(Write-DnsLookups $DnsLookups -Enabled:$CountDnsLookups)"
}
Expand Down

0 comments on commit 981377b

Please sign in to comment.