Commits

George Notaras committed 73f3076

Improved hostname validator to reject hostnames with a trailing dot.

Comments (0)

Files changed (1)

src/powerdns_manager/utils.py

     
     In case ``hostname`` is not validated a ``ValidationError`` is raised.
     
+    PowerDNS expects to find FQDN hostnames, so if the hostname ends with a dot,
+    it is rejected.
+    
     By default, the valid hostname characters are:
     
         A-Za-z0-9._-
     if not hostname:
         return
     
+    if hostname.endswith('.'):
+        raise ValidationError('PowerDNS expects to find FQDN hostnames without trailing dot')
+    
     if reject_ip:
         # Check if hostname is an IP and reject it if it is.
         try: