From 534aaf2b2aa967909640325de409316479f8f7e3 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 11 Jun 2012 08:28:02 -0700 Subject: Properly handle certs with no extensions. --- sleekxmpp/xmlstream/cert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sleekxmpp/xmlstream/cert.py') diff --git a/sleekxmpp/xmlstream/cert.py b/sleekxmpp/xmlstream/cert.py index 0f58d4ed..b2711e8e 100644 --- a/sleekxmpp/xmlstream/cert.py +++ b/sleekxmpp/xmlstream/cert.py @@ -42,7 +42,7 @@ def extract_names(raw_cert): cert = decoder.decode(raw_cert, asn1Spec=Certificate())[0] tbs = cert.getComponentByName('tbsCertificate') subject = tbs.getComponentByName('subject') - extensions = tbs.getComponentByName('extensions') + extensions = tbs.getComponentByName('extensions') or [] # Extract the CommonName(s) from the cert. for rdnss in subject: -- cgit v1.2.3 From d92aa05b5c18806ab5addc947eeedaaf4d51500e Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 19 Jun 2012 01:29:48 -0700 Subject: PEP8 formatting updates. --- sleekxmpp/xmlstream/cert.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sleekxmpp/xmlstream/cert.py') diff --git a/sleekxmpp/xmlstream/cert.py b/sleekxmpp/xmlstream/cert.py index b2711e8e..339f872d 100644 --- a/sleekxmpp/xmlstream/cert.py +++ b/sleekxmpp/xmlstream/cert.py @@ -7,11 +7,12 @@ try: from pyasn1.type.univ import Any, ObjectIdentifier, OctetString from pyasn1.type.char import BMPString, IA5String, UTF8String from pyasn1.type.useful import GeneralizedTime - from pyasn1_modules.rfc2459 import Certificate, DirectoryString, SubjectAltName, GeneralNames, GeneralName + from pyasn1_modules.rfc2459 import (Certificate, DirectoryString, + SubjectAltName, GeneralNames, + GeneralName) from pyasn1_modules.rfc2459 import id_ce_subjectAltName as SUBJECT_ALT_NAME from pyasn1_modules.rfc2459 import id_at_commonName as COMMON_NAME - XMPP_ADDR = ObjectIdentifier('1.3.6.1.5.5.7.8.5') SRV_NAME = ObjectIdentifier('1.3.6.1.5.5.7.8.7') @@ -149,7 +150,7 @@ def verify(expected, raw_cert): expected_wild = expected[expected.index('.'):] expected_srv = '_xmpp-client.%s' % expected - for name in cert_names['XMPPAddr']: + for name in cert_names['XMPPAddr']: if name == expected: return True for name in cert_names['SRV']: -- cgit v1.2.3