Skip to content

Commit c5f0985

Browse files
committed
Fix a mechanisms
1 parent faf4796 commit c5f0985

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

checkdmarc/spf.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,18 @@ def parse_spf_record(
407407
raise _SPFMissingRecords(
408408
f"An a mechanism points to {value.lower()}, but that domain/subdomain does not have any A/AAAA records."
409409
)
410-
for record in a_records:
410+
for i in range(len(a_records)):
411411
if cidr:
412-
record = f"{record}/{cidr}"
413-
pairs = [
414-
("mechanism", mechanism),
415-
("value", record),
416-
("dns_lookups", mechanism_dns_lookups),
417-
("void_dns_lookups", mechanism_void_dns_lookups),
418-
("action", action),
419-
]
412+
a_records[i] = f"{a_records[i]}/{cidr}"
413+
pairs = [
414+
("mechanism", mechanism),
415+
("value", domain),
416+
("addresses", a_records),
417+
("dns_lookups", mechanism_dns_lookups),
418+
("void_dns_lookups", mechanism_void_dns_lookups),
419+
("action", action),
420+
]
421+
parsed["mechanisms"].append(pairs)
420422

421423
elif mechanism == "mx":
422424
mechanism_dns_lookups += 1

0 commit comments

Comments
 (0)