Skip to content

Commit 9841a20

Browse files
committed
5.2.18
- Fix void `a` SPF mechanism lookup output
1 parent 87010bb commit 9841a20

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

.vscode/launch.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,18 @@
226226
"console": "integratedTerminal",
227227
"justMyCode": true
228228
},
229+
{
230+
"name": "checkdmarc --skip-tls python.org",
231+
"type": "debugpy",
232+
"request": "launch",
233+
"module": "checkdmarc._cli",
234+
"args": [
235+
"--skip-tls",
236+
"python.org"
237+
],
238+
"console": "integratedTerminal",
239+
"justMyCode": true
240+
},
229241
{
230242
"name": "checkdmarc --skip-tls kickbox.com",
231243
"type": "debugpy",

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 5.2.18
4+
5+
- Fix void `a` SPF mechanism lookup output
6+
37
## 5.12.17
48

59
- Fix crash on DNS retry

checkdmarc/_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
See the License for the specific language governing permissions and
2020
limitations under the License."""
2121

22-
__version__ = "5.12.17"
22+
__version__ = "5.12.18"
2323

2424
OS = platform.system()
2525
OS_RELEASE = platform.release()

checkdmarc/spf.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,14 +758,22 @@ def parse_spf_record(
758758
if isinstance(warning, (_SPFMissingRecords, DNSExceptionNXDOMAIN)):
759759
mechanism_void_dns_lookups += 1
760760
total_void_dns_lookups += 1
761+
mechanism = OrderedDict([
762+
("mechanism", mechanism),
763+
("value", value),
764+
("record", None),
765+
("dns_lookups", 1),
766+
("void_dns_lookups", 1),
767+
])
768+
parsed["mechanisms"].append(mechanism)
761769
if total_void_dns_lookups > 2:
762770
raise SPFTooManyVoidDNSLookups(
763771
"Parsing the SPF record has "
764772
f"{total_void_dns_lookups}/2 maximum void DNS "
765773
"lookups (RFC 7208 § 4.6.4)",
766774
void_dns_lookups=total_void_dns_lookups,
767775
)
768-
warnings.append(str(warning))
776+
warnings.append(f"{value}: {str(warning)}")
769777

770778
if error:
771779
result = OrderedDict(
@@ -819,11 +827,20 @@ def get_spf_record(
819827
"""
820828
domain = normalize_domain(domain)
821829
record = query_spf_record(
822-
domain, nameservers=nameservers, resolver=resolver, timeout=timeout
830+
domain,
831+
nameservers=nameservers,
832+
resolver=resolver,
833+
timeout=timeout,
834+
timeout_retries=timeout_retries,
823835
)
824836
record = record["record"]
825837
parsed_record = parse_spf_record(
826-
record, domain, nameservers=nameservers, resolver=resolver, timeout=timeout
838+
record,
839+
domain,
840+
nameservers=nameservers,
841+
resolver=resolver,
842+
timeout=timeout,
843+
timeout_retries=timeout_retries,
827844
)
828845
parsed_record["record"] = record
829846
return parsed_record

0 commit comments

Comments
 (0)