Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet committed Jul 31, 2024
1 parent 2128889 commit f19aca1
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions checkdmarc/dmarc.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,11 @@ def verify_dmarc_report_destination(source_domain: str,
nameservers: list[str] = None,
ignore_unrelated_records: bool = False,
resolver: dns.resolver.Resolver = None,
timeout: float = 2.0) -> bool:
timeout: float = 2.0) -> None:
"""
Checks if the report destination accepts reports for the source domain
per RFC 7489, section 7.1
per RFC 7489, section 7.1. Raises `checkdmarc.dmarc.UnverifiedDMARCURIDestination`
if it doesn't accept.
Args:
source_domain (str): The source domain
Expand All @@ -694,10 +695,6 @@ def verify_dmarc_report_destination(source_domain: str,
requests
timeout (float): number of seconds to wait for an answer from DNS
Returns:
bool: Indicates if the report domain accepts reports from the given
domain
Raises:
:exc:`checkdmarc.dmarc.UnverifiedDMARCURIDestination`
:exc:`checkdmarc.dmarc.UnrelatedTXTRecordFound`
Expand All @@ -712,7 +709,7 @@ def verify_dmarc_report_destination(source_domain: str,
nameservers=nameservers,
ignore_unrelated_records=ignore_unrelated_records,
resolver=resolver):
return True
return
target = f"{source_domain}._report._dmarc.{destination_domain}"
message = f"{destination_domain} does not indicate that it accepts " \
f"DMARC reports about {source_domain} - " \
Expand Down Expand Up @@ -741,12 +738,10 @@ def verify_dmarc_report_destination(source_domain: str,
f"at {target}\n\n{ur_str}", data={"target": target})

if dmarc_record_count < 1:
return False
raise UnverifiedDMARCURIDestination(message)
except Exception:
raise UnverifiedDMARCURIDestination(message)

return True


def parse_dmarc_record(
record: str, domain: str, parked: bool = False,
Expand Down

0 comments on commit f19aca1

Please sign in to comment.