Skip to content

Commit

Permalink
Remove ip4: qualifier from output.
Browse files Browse the repository at this point in the history
Due to a parser bug, IPv4 addresses extracted from the `ip4:` tokens
would have the qualifier prepended to the address.  This has been
corrected by fixing the parser to exclude any given qualifier.

This was never an issue for parsing IPv6 addresses from the `ip6:`
tokens, because I managed to write that code correctly.  #legacyIP
  • Loading branch information
rhymeswithmogul committed Mar 28, 2024
1 parent 049ab4f commit 397c0b0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# MailPolicyExplainer Change Log

## Version 1.3.5
**FIX** The SPF qualifier is no longer prepended to IPv4 addresses.

## 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
6 changes: 3 additions & 3 deletions MailPolicyExplainer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
RootModule = 'src/MailPolicyExplainer.psm1'

# Version number of this module.
ModuleVersion = '1.3.4'
ModuleVersion = '1.3.5'

# Supported PSEditions
CompatiblePSEditions = @('Core', 'Desktop')
Expand Down Expand Up @@ -95,7 +95,7 @@ FileList = @(
# by PowerShell.
PrivateData = @{
PSData = @{
#Prerelease = 'git'
Prerelease = 'git'

# Tags applied to this module.
# These help with module discovery in online galleries.
Expand All @@ -112,7 +112,7 @@ PrivateData = @{
ProjectUri = 'https://github.com/rhymeswithmogul/MailPolicyExplainer'
IconUri = 'https://raw.githubusercontent.com/rhymeswithmogul/MailPolicyExplainer/main/icon/PSGallery.png'

ReleaseNotes = '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.'
ReleaseNotes = 'Removed the `ip4:` qualifier from parser output.'
}
}

Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# MailPolicyExplainer News

## Version 1.3.5
This will be released soon.

This is a bugfix release. 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.

## Version 1.3.4
This was released on Wednesday, January 24, 2024.

Expand Down
2 changes: 1 addition & 1 deletion src/MailPolicyExplainer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ Function Test-SpfRecord
Return
}
} Else {
$ip4addr = $token -Replace 'ip4:' -Replace '/32'
$ip4addr = $token -Replace '[\+\-\~\?]?ip4:' -Replace '/32'
If ($token -Match "^\+?ip4:.*") {
Write-GoodNews "${RecordType}: Accept mail from the IPv4 address $ip4addr."
}
Expand Down

0 comments on commit 397c0b0

Please sign in to comment.