aboutsummaryrefslogtreecommitdiff
path: root/rpkid
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-11-15 01:18:37 +0000
committerRob Austein <sra@hactrn.net>2012-11-15 01:18:37 +0000
commitc43c7100b22a6a203094c7143683e69b60eb425c (patch)
treeb01ab5c2f74fda5d17c9f93eca30e82a97285b37 /rpkid
parent01290083a9bb24091295e87d5f3a414cb8186422 (diff)
Pull from /trunk.
svn path=/branches/tk274/; revision=4873
Diffstat (limited to 'rpkid')
-rw-r--r--rpkid/portal-gui/Makefile.in8
-rw-r--r--rpkid/rpki/gui/app/forms.py17
2 files changed, 17 insertions, 8 deletions
diff --git a/rpkid/portal-gui/Makefile.in b/rpkid/portal-gui/Makefile.in
index eb84d873..a8c892a1 100644
--- a/rpkid/portal-gui/Makefile.in
+++ b/rpkid/portal-gui/Makefile.in
@@ -46,13 +46,7 @@ install: $(BUILD)
${INSTALL} -m 644 apache.conf $(SYSCONFDIR)/apache.conf
${INSTALL} -m 644 $(srcdir)/media/css/bootstrap.min.css $(INSTDIR)/media/css/bootstrap.min.css
${INSTALL} -m 644 rpki.wsgi $(INSTDIR)/wsgi/rpki.wsgi
- # FIXME should eventually try to merge new settings?
- @if [ ! -f ${SYSCONFDIR}/settings.py ]; then \
- ${INSTALL} -m 644 settings.py ${SYSCONFDIR}; \
- else \
- echo "${SYSCONFDIR}/settings.py already exists, installing settings.py as ${SYSCONFDIR}/settings.py.new"; \
- ${INSTALL} -m 644 settings.py ${SYSCONFDIR}/settings.py.new; \
- fi
+ ${INSTALL} -m 644 settings.py ${SYSCONFDIR}
deinstall uninstall:
rm -rf $(INSTDIR)
diff --git a/rpkid/rpki/gui/app/forms.py b/rpkid/rpki/gui/app/forms.py
index 2246a03b..de7a8baf 100644
--- a/rpkid/rpki/gui/app/forms.py
+++ b/rpkid/rpki/gui/app/forms.py
@@ -217,7 +217,7 @@ class ROARequest(forms.Form):
raise forms.ValidationError('invalid IP address')
manager = models.ResourceRangeAddressV4 if isinstance(r, resource_range_ipv4) else models.ResourceRangeAddressV6
- if not manager.objects.filter(cert__parent__issuer=self.conf,
+ if not manager.objects.filter(cert__conf=self.conf,
prefix_min__lte=r.min,
prefix_max__gte=r.max).exists():
raise forms.ValidationError('prefix is not allocated to you')
@@ -245,6 +245,21 @@ class ROARequest(forms.Form):
if max_prefixlen > r.datum_type.bits:
raise forms.ValidationError, \
'max prefix length (%d) is out of range for IP version (%d)' % (max_prefixlen, r.datum_type.bits)
+
+ # verify that the request prefix is not already part of a
+ # roarequest
+ if models.ROARequestPrefix.objects.filter(
+ roa_request__issuer=self.conf,
+ roa_request__asn=self.cleaned_data.get('asn'),
+ version='IPv%d' % (4 if isinstance(r, resource_range_ipv4) else 6,),
+ prefix=str(r.min),
+ prefixlen=r.prefixlen(),
+ max_prefixlen=max_prefixlen
+ ).exists():
+ raise forms.ValidationError(
+ 'this ROA request prefix already exists'
+ )
+
self.cleaned_data['max_prefixlen'] = str(max_prefixlen)
return self.cleaned_data