Parcourir la source

Check that the reverse DNS entries end with a '.'

Baptiste Jonglez il y a 11 ans
Parent
commit
fb2c41b8e0
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      coin/reverse_dns/models.py

+ 4 - 0
coin/reverse_dns/models.py

@@ -26,6 +26,10 @@ class ReverseDNSEntry(models.Model):
     objects = NetManager()
 
     def clean(self):
+        if self.reverse:
+            # Check that the reverse ends with a "." (add it if necessary)
+            if not self.reverse.endswith('.'):
+                self.reverse += '.'
         if self.ip:
             if not self.ip in self.ip_subnet.inet:
                 raise ValidationError('IP address must be included in the IP subnet.')