Skip to content
Snippets Groups Projects
Commit af619a0a authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Server now correctly handles certs without subjAltName (thx to bodik)

parent 3c8c3a46
Branches
Tags
No related merge requests found
...@@ -316,8 +316,11 @@ class X509Authenticator(NoAuthenticator): ...@@ -316,8 +316,11 @@ class X509Authenticator(NoAuthenticator):
subj = cert.get_subject() subj = cert.get_subject()
commons = [n.get_data().as_text() for n in subj.get_entries_by_nid(subj.nid["CN"])] commons = [n.get_data().as_text() for n in subj.get_entries_by_nid(subj.nid["CN"])]
ext = cert.get_ext("subjectAltName") try:
extstrs = [val.strip() for val in ext.get_value().split(",")] extstrs = cert.get_ext("subjectAltName").get_value().split(",")
except LookupError:
extstrs = []
extstrs = [val.strip() for val in extstrs]
altnames = [val[4:] for val in extstrs if val.startswith("DNS:")] altnames = [val[4:] for val in extstrs if val.startswith("DNS:")]
# bit of mangling to get rid of duplicates and leave commonname first # bit of mangling to get rid of duplicates and leave commonname first
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment