[shprotx] fix loading of multiple SSL certificates and better error message. fixes #3619
This commit is contained in:
parent
661acc5a09
commit
b7cc062d7d
|
@ -761,15 +761,18 @@ class NonBlockingTLS(PlugIn):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if 'BEGIN CERTIFICATE' in line:
|
if 'BEGIN CERTIFICATE' in line:
|
||||||
begin = i
|
begin = i
|
||||||
continue
|
|
||||||
elif 'END CERTIFICATE' in line and begin > -1:
|
elif 'END CERTIFICATE' in line and begin > -1:
|
||||||
cert = ''.join(lines[begin:i+2])
|
cert = ''.join(lines[begin:i+2])
|
||||||
try:
|
try:
|
||||||
X509cert = OpenSSL.crypto.load_certificate(
|
X509cert = OpenSSL.crypto.load_certificate(
|
||||||
OpenSSL.crypto.FILETYPE_PEM, cert)
|
OpenSSL.crypto.FILETYPE_PEM, cert)
|
||||||
store.add_cert(X509cert)
|
store.add_cert(X509cert)
|
||||||
|
except OpenSSL.crypto.Error, exception_obj:
|
||||||
|
log.warning('Unable to load a certificate from file %s: %s' %\
|
||||||
|
(gajim.MY_CACERTS, exception_obj.message[0][2]))
|
||||||
except:
|
except:
|
||||||
log.warning('Unable to load a certificate from file %s' % \
|
log.warning(
|
||||||
|
'Unknown error while loading certificate from file %s' % \
|
||||||
gajim.MY_CACERTS)
|
gajim.MY_CACERTS)
|
||||||
begin = -1
|
begin = -1
|
||||||
i += 1
|
i += 1
|
||||||
|
|
Loading…
Reference in New Issue