slimta / python-slimta

Python libraries to send, receive, and queue email.
https://slimta.org/
MIT License
171 stars 43 forks source link

Reversed behavior of DnsBlocklist "strict" mode #132

Closed NicolasLM closed 3 years ago

NicolasLM commented 6 years ago

DnsBlocklist.get defaults to being not strict, meaning that unresponsive blacklists should not be considered as having an entry.

In practice however, DNS errors happening while querying the blacklist will result in the entry being present. This likely comes from the not in slimta.util.dnsbl:

try:
    DNSResolver.query(query, 'A').get()
except DNSError as exc:
    if exc.errno == ARES_ENOTFOUND:
        return False
    logging.log_exception(__name__, query=query)
    return not strict
else:
    return True