Handle NameTooLong by logging an error

get_dns_records() could be fed with a name that is too long for the DNS
protocol. In this case a NameTooLong error is thrown, which we can catch
and log an error for. This can happen for example if a DNS name that is
already at the limit is used in combination with "manage.py modo
check_mx", which appends an autodiscover to the domain, which then
exceeds the DNS name limit.
This commit is contained in:
Sebastian Lohff
2021-02-09 22:09:43 +01:00
parent 57f5d57ea6
commit 39c40c18ef
+2
View File
@@ -198,6 +198,8 @@ def get_dns_records(name, typ, resolver=None):
logger.warning(
_("DNS resolution timeout, unable to query %s at the moment") %
name, exc_info=e)
except dns.name.NameTooLong as e:
logger.error(_("DNS name is too long: %s" % name), exc_info=e)
else:
return dns_answers
return None