From: Michael Tremer Date: Wed, 10 Dec 2025 17:10:01 +0000 (+0000) Subject: util: Be more lax with domain names X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5d7f832c4fb82478f3c512cca5f8ca94d5cb2ad;p=dnsbl.git util: Be more lax with domain names There are a lot of domain names out there that start/end with a non-alphanumerical character which is why we need to remove this check. We also need to accept underscores in domain names. Signed-off-by: Michael Tremer --- diff --git a/src/dnsbl/util.py b/src/dnsbl/util.py index 0e828d1..02924dd 100644 --- a/src/dnsbl/util.py +++ b/src/dnsbl/util.py @@ -101,10 +101,8 @@ def is_fqdn(s): for label in labels: if not 1 <= len(label) <= 63: return False - if not label[0].isalnum() or not label[-1].isalnum(): - return False for ch in label: - if not (ch.isalnum() or ch == "-"): + if not ch.isalnum() or ch in "-_": return False return True