Raise ValidationError when CSR does not have a subject hostname

Raise ValidationError when CSR does not have a subject hostname.

Ticket: https://fedorahosted.org/freeipa/ticket/3123
This commit is contained in:
Lynn Root authored and Martin Kosek committed 2012-12-11 12:28:59 +01:00
1 parent c481e40d78
commit 4d6de44d3d
1 file changed
+4
+4
View File
@@ -296,6 +296,10 @@ class cert_request(VirtualCommand):
# Ensure that the hostname in the CSR matches the principal
subject_host = get_csr_hostname(csr)
if not subject_host:
raise errors.ValidationError(name='csr',
error=_("No hostname was found in subject of request."))
(servicename, hostname, realm) = split_principal(principal)
if subject_host.lower() != hostname.lower():
raise errors.ACIError(