prevent traceback when a wrong certificate is being checked. Fixes #7242

This commit is contained in:
Yann Leboulanger 2012-10-08 11:14:47 +02:00
parent d8f1eb99cb
commit 566273af2c
1 changed files with 6 additions and 1 deletions

View File

@ -133,7 +133,12 @@ try:
for i in range(0, cnt):
ext = cert.get_extension(i)
if ext.get_short_name() == 'subjectAltName':
r = _parse_asn1(ext.get_data())
try:
r = _parse_asn1(ext.get_data())
except:
log.error('Wrong data in certificate: subjectAltName=%s' % \
ext.get_data())
continue
if 'otherName' in r:
if oid_xmppaddr in r['otherName']:
for host in r['otherName'][oid_xmppaddr]: