Browse Source

web/postkey/views.py: add additional validation set for hostnames

Disallow registering set of hostnames intended for i2p project use.
pull/1/head
Hidden Z 14 years ago
parent
commit
390ab411f7
  1. 5
      web/postkey/views.py

5
web/postkey/views.py

@ -1,3 +1,5 @@
import re
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django import forms from django import forms
@ -26,6 +28,9 @@ class AddForm(ModelForm):
"""Validate hostname""" """Validate hostname"""
data = self.cleaned_data['name'] data = self.cleaned_data['name']
data = validate_hostname(data) data = validate_hostname(data)
# Another set of reserved hostnames (suggested by zzz)
if re.search(r'(^|\.)(i2p|i2p2|geti2p|mail|project|i2project|i2pproject|i2p-project).i2p$', data):
raise forms.ValidationError('Trying to use hostname from additional reserved set')
return data return data
def clean_b64hash(self): def clean_b64hash(self):
"""Validate base64 hash""" """Validate base64 hash"""

Loading…
Cancel
Save