summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/cert.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-09-13 11:00:29 -0700
committerLance Stout <lancestout@gmail.com>2012-09-13 11:00:29 -0700
commitfb3e6b7e35bb949f73a756ae5be683e2fec12454 (patch)
tree26f4aa0300de014259e75211edc37bdecfe96170 /sleekxmpp/xmlstream/cert.py
parentcf28d4586d32082f10578770a14eb74a68b902de (diff)
downloadslixmpp-fb3e6b7e35bb949f73a756ae5be683e2fec12454.tar.gz
slixmpp-fb3e6b7e35bb949f73a756ae5be683e2fec12454.tar.bz2
slixmpp-fb3e6b7e35bb949f73a756ae5be683e2fec12454.tar.xz
slixmpp-fb3e6b7e35bb949f73a756ae5be683e2fec12454.zip
Don't break checking certs for localhost.
Diffstat (limited to 'sleekxmpp/xmlstream/cert.py')
-rw-r--r--sleekxmpp/xmlstream/cert.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/cert.py b/sleekxmpp/xmlstream/cert.py
index 339f872d..6e877efc 100644
--- a/sleekxmpp/xmlstream/cert.py
+++ b/sleekxmpp/xmlstream/cert.py
@@ -147,7 +147,10 @@ def verify(expected, raw_cert):
raise CertificateError(
'Certificate has expired.')
- expected_wild = expected[expected.index('.'):]
+ if '.' in expected:
+ expected_wild = expected[expected.index('.'):]
+ else:
+ expected_wild = expected
expected_srv = '_xmpp-client.%s' % expected
for name in cert_names['XMPPAddr']:
@@ -160,7 +163,10 @@ def verify(expected, raw_cert):
if name == expected:
return True
if name.startswith('*'):
- name_wild = name[name.index('.'):]
+ if '.' in name:
+ name_wild = name[name.index('.'):]
+ else:
+ name_wild = name
if expected_wild == name_wild:
return True
for name in cert_names['URI']: