mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipalib.x509: Handle missing SAN gracefully
When extension is not present None is returned instead of empty iterable or exception thrown. Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Martin Basti
parent
7e2d185ba0
commit
308c790ee9
@@ -435,8 +435,12 @@ def get_san_general_names(cert):
|
||||
asn1Spec=rfc2459.TBSCertificate()
|
||||
)[0]
|
||||
OID_SAN = univ.ObjectIdentifier('2.5.29.17')
|
||||
# One would expect KeyError or empty iterable when the key ('extensions'
|
||||
# in this particular case) is not pressent in the certificate but pyasn1
|
||||
# returns None here
|
||||
extensions = tbs['extensions'] or []
|
||||
gns = []
|
||||
for ext in tbs['extensions']:
|
||||
for ext in extensions:
|
||||
if ext['extnID'] == OID_SAN:
|
||||
der = decoder.decode(
|
||||
ext['extnValue'], asn1Spec=univ.OctetString())[0]
|
||||
|
||||
Reference in New Issue
Block a user