summaryrefslogtreecommitdiffstats
path: root/ipalib/rpc.py
diff options
context:
space:
mode:
authorrcrit <rcrit@moon.greyoak.com>2009-06-30 16:34:40 -0400
committerRob Crittenden <rcritten@redhat.com>2009-07-01 08:51:23 -0400
commit9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2 (patch)
tree27215373f629572ee8b6ca15a001eabc3aeabc98 /ipalib/rpc.py
parent79029e8179e4f49aa54e25363db08ba0ebf7b73d (diff)
downloadfreeipa-9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2.tar.gz
freeipa-9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2.tar.xz
freeipa-9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2.zip
Add a local implementation of httplib.SSLFile and httplib.FakeSocket
Python 2.6 changed its internal implementation which makes it difficult to override in a way that is backwards compatible. 508953
Diffstat (limited to 'ipalib/rpc.py')
-rw-r--r--ipalib/rpc.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index 48ac16b5a..6ac0cfa83 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -45,6 +45,13 @@ from ipapython import ipautil
from OpenSSL import SSL
import httplib
+try:
+ from httplib import SSLFile
+ from httplib import FakeSocket
+except ImportError:
+ from ipapython.ipasslfile import SSLFile
+ from ipapython.ipasslfile import FakeSocket
+
# Some Kerberos error definitions from krb5.h
KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN = (-1765328377L)
KRB5KRB_AP_ERR_TKT_EXPIRED = (-1765328352L)
@@ -195,7 +202,7 @@ class SSLTransport(Transport):
return SSLSocket(host, None, **(x509 or {}))
-class SSLFile(httplib.SSLFile):
+class SSLFile(SSLFile):
"""
Override the _read method so we can handle PyOpenSSL errors
gracefully.
@@ -227,7 +234,7 @@ class SSLFile(httplib.SSLFile):
return buf
-class FakeSocket(httplib.FakeSocket):
+class FakeSocket(FakeSocket):
"""
Override this class so we can end up using our own SSLFile
implementation.