Skip to content

Commit

Permalink
Merge pull request #2 from skyblaster/MTA-STS
Browse files Browse the repository at this point in the history
Fix compare function on PowerShell 5.1.
  • Loading branch information
rhymeswithmogul committed Mar 30, 2024
2 parents ed87edc + 0300a9c commit 3fe2812
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- **NEW** `Test-DkimRecord` will print the full DKIM TXT record to the verbose stream. Thanks to [Jason Berry](https://github.com/skyblaster) for writing [the pull request](https://github.com/rhymeswithmogul/MailPolicyExplainer/pull/1)!
- **FIX** DNSSEC results are shown even when records are not found, to show proof of non-existence (unless DNSSEC validation is disabled).
- **FIX** The SPF qualifier is no longer prepended to IPv4 addresses.
- **FIX** A bug caused Windows PowerShell 5.1 not to parse MTA-STS policy file line endings properly. Thanks to [Jason Berry](https://github.com/skyblaster) for reporting this and writing [another pull request](https://github.com/rhymeswithmogul/MailPolicyExplainer/pull/2)!

## Version 1.3.4 (Wednesday, January 24, 2024)
**FIX** Some previous versions of this module failed to load on Windows PowerShell 5.1 due to a missing backtick. PowerShell 7 considered this to be valid syntax. Thanks to Aslan Grealis for finding this bug.
Expand Down
3 changes: 2 additions & 1 deletion MailPolicyExplainer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ PrivateData = @{
ReleaseNotes = '- Test-DkimRecord will emit the full DKIM TXT record to the verbose stream.
- DNSSEC-authenticated denial-of-existence is now shown by default.
- Added the `-DisableDnssecVerification` switch to most cmdlets to disable all DNSSEC checks (except for DANE).
- Removed the `ip4:` qualifier from parser output.'
- Removed the `ip4:` qualifier from parser output.
- Line endings for MTA-STS policy files are now parsed correctly on Windows PowerShell 5.1.'
}
}

Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ New features:
Two bugs were fixed:
- The SPF parser would sometimes show IPv4 addresses with a character prepended; for example, "Accept mail from the IPv4 address +192.0.2.1" or "Reject mail from the IPv4 address -192.0.2.2". This has been corrected by fixing the parser.
- DNSSEC status is now shown even when records are not found. DNSSEC is checked even records do not exist, in what's called authenticated denial of existence, so we should communicate it to the user regardless.
- MTA-STS policy files are parsed to make sure they contain CR+LF line endings, but this did not work correctly on Windows PowerShell 5.1. Thanks to [Jason Berry](https://github.com/skyblaster) for reporting it [and fixing it, too](https://github.com/rhymeswithmogul/MailPolicyExplainer/pull/2)!

## Version 1.3.4
This was released on Wednesday, January 24, 2024.
Expand Down
4 changes: 2 additions & 2 deletions src/MailPolicyExplainer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,8 @@ Function Test-MtaStsPolicy
# Split it up two different ways and see if we get the same results.
# If not, then someone probably saved the file with UNIX ("`r") endings.
# We're going to be strict and refuse to parse the file in this case.
$lines = $policy.Content.Split("`r`n")
$LFlines = $policy.Content -Split "`r?`n"
$lines = $policy.Content -Split "`r`n"
$LFlines = $policy.Content -Split "`n"

If ($lines.Count -ne $LFLines.Count) {
Write-Debug "This file has $($lines.Count) CRLF-terminated lines and $($LFlines.Count) LF-terminated lines."
Expand Down

0 comments on commit 3fe2812

Please sign in to comment.