summaryrefslogtreecommitdiffstats
path: root/ipapython/nsslib.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-03-11 19:51:07 +0100
committerMartin Basti <mbasti@redhat.com>2016-03-22 10:20:51 +0100
commit491447cc5ab8c5eff2be57d609201cefb79f7053 (patch)
tree401ff990eddb00a6fed63ed9dd5c0e4b546799c4 /ipapython/nsslib.py
parentaa749957360b85fecaed2f9f8dc286f560b89e0b (diff)
downloadfreeipa-491447cc5ab8c5eff2be57d609201cefb79f7053.tar.gz
freeipa-491447cc5ab8c5eff2be57d609201cefb79f7053.tar.xz
freeipa-491447cc5ab8c5eff2be57d609201cefb79f7053.zip
pylint: remove bare except
Bare except should not be used. Reviewed-By: Petr Spacek <pspacek@redhat.com> Reviewed-By: Lukas Slebodnik <lslebodn@redhat.com>
Diffstat (limited to 'ipapython/nsslib.py')
-rw-r--r--ipapython/nsslib.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py
index 16aa1d9a4..335ac28f6 100644
--- a/ipapython/nsslib.py
+++ b/ipapython/nsslib.py
@@ -223,17 +223,12 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
self.tls_version_max = str(tls_version_max)
def _create_socket(self):
- # TODO: remove the try block once python-nss is guaranteed to contain
- # these values
- try:
- #pylint: disable=E1101
- ssl_enable_renegotiation = ssl.SSL_ENABLE_RENEGOTIATION
- ssl_require_safe_negotiation = ssl.SSL_REQUIRE_SAFE_NEGOTIATION
- ssl_renegotiate_requires_xtn = ssl.SSL_RENEGOTIATE_REQUIRES_XTN
- except:
- ssl_enable_renegotiation = 20
- ssl_require_safe_negotiation = 21
- ssl_renegotiate_requires_xtn = 2
+ ssl_enable_renegotiation = getattr(
+ ssl, 'SSL_ENABLE_RENEGOTIATION', 20)
+ ssl_require_safe_negotiation = getattr(
+ ssl,'SSL_REQUIRE_SAFE_NEGOTIATION', 21)
+ ssl_renegotiate_requires_xtn = getattr(
+ ssl, 'SSL_RENEGOTIATE_REQUIRES_XTN', 2)
# Create the socket here so we can do things like let the caller
# override the NSS callbacks