Browse Source

validation.py: hostname must not start with '.' or '-'

I just forgot to add this rule earlier.
pull/1/head
Hidden Z 14 years ago
parent
commit
ac3df58a3f
  1. 3
      web/lib/validation.py

3
web/lib/validation.py

@ -32,6 +32,9 @@ def validate_hostname(data): @@ -32,6 +32,9 @@ def validate_hostname(data):
raise forms.ValidationError('Illegal characters in hostname')
else:
namepart = h.groups()[0]
# Must not start with '.' or '-'
if re.match(r'^\.|-', namepart):
raise forms.ValidationError('Hostname must not starts with "." or "-"')
# Must not contain '.-' or '-.' (as of 0.6.1.33)
if re.search(r'(\.-)|(-\.)', namepart):
raise forms.ValidationError('Hostname contain ".-" or "-."')

Loading…
Cancel
Save