Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : 0.9-fixes
---------------------------------------------------------------
commit cf408e07004b2199cace8b233958528d55c10222
Author: Peter Hatina <phatina(a)redhat.com>
Date: Wed Dec 18 08:32:59 2013 +0100
drop verification callback
---------------------------------------------------------------
cli/lmi/shell/LMIBaseClient.py | 19 +------------------
cli/lmi/shell/LMIConnection.py | 8 +++-----
2 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/cli/lmi/shell/LMIBaseClient.py b/cli/lmi/shell/LMIBaseClient.py
index c2d78e9..6a0f677 100644
--- a/cli/lmi/shell/LMIBaseClient.py
+++ b/cli/lmi/shell/LMIBaseClient.py
@@ -49,23 +49,6 @@ class LMIBaseClient(object):
CONN_TYPE_PEGASUS_UDS = range(2)
def __init__(self, uri, username="", password="", **kwargs):
- def verify_callback(conn, cert, errno, errdepth, rcode):
- """
- Callback function used to verify the server certificate. It is passed to
- OpenSSL.SSL.set_verify, and is called during the SSL handshake. This
function
- returns True, if verification passes and False otherwise.
-
- :param conn: Connection object
- :param cert: x509 object
- :param int errno: potential error number
- :param int errdepth: error depth
- :param int rcode: return code
- :returns: True, if certificate was successfully verified; False otherwise
-
- **NOTE:** see :py:class:`pywbem.cim_operations.WBEMConnection`
- """
- return bool(rcode) and cert.get_subject().commonName == hostname
-
# Set remaining arguments
conn_type = kwargs.pop("conn_type", LMIBaseClient.CONN_TYPE_WBEM)
verify_server_cert = kwargs.pop("verify_server_cert", True)
@@ -87,7 +70,7 @@ class LMIBaseClient(object):
self._cliconn = pywbem.WBEMConnection(self._uri,
(self._username, password),
x509={"key_file" : key_file, "cert_file" :
cert_file},
- verify_callback=verify_callback if verify_server_cert else None
+ no_verification=not verify_server_cert
)
# NOTE: usage with Key=something, Value=something is deprecated
diff --git a/cli/lmi/shell/LMIConnection.py b/cli/lmi/shell/LMIConnection.py
index 7c693c7..f859385 100644
--- a/cli/lmi/shell/LMIConnection.py
+++ b/cli/lmi/shell/LMIConnection.py
@@ -21,7 +21,7 @@ import logging
import readline
import urlparse
-import OpenSSL.SSL
+import M2Crypto.SSL
from LMIBaseClient import LMIBaseClient
from LMIShellClient import LMIShellClient
@@ -312,12 +312,10 @@ class LMIConnection(object):
return LMIReturnValue(rval=True)
lmi_raise_or_dump_exception(e)
errorstr = e.args[1]
- except pywbem.cim_http.AuthError, e:
+ except (pywbem.cim_http.AuthError, \
+ M2Crypto.SSL.SSLError), e:
lmi_raise_or_dump_exception(e)
errorstr = e.args[0]
- except OpenSSL.SSL.Error, e:
- lmi_raise_or_dump_exception(e)
- errorstr = e.args[0][0][2]
return LMIReturnValue(rval=False, errorstr=errorstr)
def subscribe_indication(self, **kwargs):