diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2018-05-01 02:30:39 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2018-05-01 13:14:23 +0300 |
commit | e471a74e40d378d2c27e1a045b511d7b33c9e31c (patch) | |
tree | 46598a317024171b2f0da0e14525978e5d586015 | |
parent | 541d0da11e3c81c20dd797687d0da2d367b45244 (diff) |
Record all ssl errors that are encountered
-rw-r--r-- | nbxmpp/bosh.py | 4 | ||||
-rw-r--r-- | nbxmpp/tls_nb.py | 6 | ||||
-rw-r--r-- | nbxmpp/transports_nb.py | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/nbxmpp/bosh.py b/nbxmpp/bosh.py index 2d6fa0c..1babfeb 100644 --- a/nbxmpp/bosh.py +++ b/nbxmpp/bosh.py @@ -93,8 +93,10 @@ class NonBlockingBOSH(NonBlockingTransport): # ssl variables self.ssl_certificate = None + # first ssl error self.ssl_errnum = 0 - + # all ssl errors + self.ssl_errors = [] def connect(self, conn_5tuple, on_connect, on_connect_failure): NonBlockingTransport.connect(self, conn_5tuple, on_connect, on_connect_failure) diff --git a/nbxmpp/tls_nb.py b/nbxmpp/tls_nb.py index 99ca4f5..da9ba0c 100644 --- a/nbxmpp/tls_nb.py +++ b/nbxmpp/tls_nb.py @@ -508,7 +508,13 @@ class NonBlockingTLS(PlugIn): def _ssl_verify_callback(self, sslconn, cert, errnum, depth, ok): # Exceptions can't propagate up through this callback, so print them here. try: + if errnum: + self._owner.ssl_errors.append(errnum) + # This stores all ssl errors that are encountered while + # the chain is verifyed if not self._owner.ssl_errnum: + # This records the first ssl error that is encountered + # we keep this because of backwards compatibility self._owner.ssl_errnum = errnum if depth == 0: self._owner.ssl_certificate = cert diff --git a/nbxmpp/transports_nb.py b/nbxmpp/transports_nb.py index c3faa71..37e7a58 100644 --- a/nbxmpp/transports_nb.py +++ b/nbxmpp/transports_nb.py @@ -339,7 +339,10 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject): # ssl variables self.ssl_certificate = None + # first ssl error self.ssl_errnum = 0 + # all ssl errors + self.ssl_errors = [] self.alpn = alpn |