tweaked ssl_verify_host patch a bit

Added dependency on m2crypto package to setup.
This commit is contained in:
Michal Minar 2013-12-16 15:24:11 +01:00
parent 101fcb55ce
commit b00fe8f781

View File

@ -10,7 +10,7 @@ Index: pywbem-20131121/cim_http.py
import sys, string, re, os, socket, getpass
from stat import S_ISSOCK
import cim_obj
@@ -74,8 +75,25 @@ def parse_url(url):
@@ -74,8 +75,26 @@ def parse_url(url):
return host, port, ssl
@ -21,6 +21,7 @@ Index: pywbem-20131121/cim_http.py
+ """
+ if not hasattr(get_default_ca_certs, '_path'):
+ for path in (
+ '/etc/pki/tls/certs',
+ '/etc/ssl/certs',
+ '/etc/ssl/certificates'):
+ if os.path.exists(path):
@ -28,7 +29,7 @@ Index: pywbem-20131121/cim_http.py
+ break
+ else:
+ get_default_ca_certs._path = None
+ return get_default_ca_certs._path
+ return get_default_ca_certs._path
+
def wbem_request(url, data, creds, headers = [], debug = 0, x509 = None,
- verify_callback = None):
@ -37,7 +38,7 @@ Index: pywbem-20131121/cim_http.py
"""Send XML data over HTTP to the specified url. Return the
response in XML. Uses Python's build-in httplib. x509 may be a
dictionary containing the location of the SSL certificate and key
@@ -105,10 +123,35 @@ def wbem_request(url, data, creds, heade
@@ -105,10 +124,35 @@ def wbem_request(url, data, creds, heade
class HTTPSConnection(HTTPBaseConnection, httplib.HTTPSConnection):
def __init__(self, host, port=None, key_file=None, cert_file=None,
@ -75,7 +76,7 @@ Index: pywbem-20131121/cim_http.py
class FileHTTPConnection(HTTPBaseConnection, httplib.HTTPConnection):
def __init__(self, uds_path):
httplib.HTTPConnection.__init__(self, 'localhost')
@@ -117,53 +160,14 @@ def wbem_request(url, data, creds, heade
@@ -117,53 +161,14 @@ def wbem_request(url, data, creds, heade
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.connect(self.uds_path)
@ -133,7 +134,7 @@ Index: pywbem-20131121/cim_http.py
numTries = 0
localAuthHeader = None
@@ -171,10 +175,19 @@ def wbem_request(url, data, creds, heade
@@ -171,10 +176,19 @@ def wbem_request(url, data, creds, heade
data = '<?xml version="1.0" encoding="utf-8" ?>\n' + data
@ -230,3 +231,15 @@ Index: pywbem-20131121/cim_operations.py
except cim_http.Error, arg:
# Convert cim_http exceptions to CIMError exceptions
raise CIMError(0, str(arg))
Index: pywbem-20131121/setup.py
===================================================================
--- pywbem-20131121.orig/setup.py
+++ pywbem-20131121/setup.py
@@ -37,6 +37,7 @@ args = {'name': 'pywbem',
'version': '0.7.0',
'license': 'LGPLv2',
'packages': ['pywbem'],
+ 'install_requires': ['M2Crypto'],
# Make packages in root dir appear in pywbem module
'package_dir': {'pywbem': ''},
# Make extensions in root dir appear in pywbem module