From 39c40c18ef8ed801dadf28a0ce1e0097d13f2f22 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Tue, 9 Feb 2021 22:09:43 +0100 Subject: [PATCH] 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. --- modoboa/admin/lib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modoboa/admin/lib.py b/modoboa/admin/lib.py index 3fe459e66..995ee514f 100644 --- a/modoboa/admin/lib.py +++ b/modoboa/admin/lib.py @@ -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