Commit d77c263
authored
BUGFIX: Fix SPF parsing of qualified mechanisms like +mx (#4062)
<!--
## Before submiting a pull request
Please make sure you've run the following commands from the root
directory.
bin/generate-all.sh
(this runs commands like "go generate", fixes formatting, and so on)
## Release changelog section
Help keep the release changelog clear by pre-naming the proper section
in the GitHub pull request title.
Some examples:
* CICD: Add required GHA permissions for goreleaser
* DOCS: Fixed providers with "contributor support" table
* ROUTE53: Allow R53_ALIAS records to enable target health evaluation
More examples/context can be found in the file .goreleaser.yml under the
'build' > 'changelog' key.
!-->
Fixes a regression where `SPF_BUILDER` with `overflow` rejected valid
RFC 7208 qualified mechanisms like `+mx`, `~mx`, `?a`, etc. with the
error `unsupported SPF part mx`. The root cause was that `lcpart` (the
lowercase comparison variable) was created before stripping the
qualifier prefix (`+`,`-`,`~`,`?`), so `HasPrefix` checks against `"mx"`
or `"a"` failed when the string was still `"+mx"` or `"+a"`. Qualifiers
on mechanisms are valid per [RFC 7208 Section
4.7](https://www.rfc-editor.org/rfc/rfc7208#section-4.7). A regression
test covering all qualifier/mechanism combinations has been added.
Fixes #40421 parent afd69e9 commit d77c263
2 files changed
+35
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
120 | 154 | | |
121 | 155 | | |
122 | 156 | | |
| |||
0 commit comments