summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-07-07 22:54:07 -0400
committerRob Crittenden <rcritten@redhat.com>2009-07-07 22:57:23 -0400
commit45a40635bb6867f55f757413776c2374ae07a888 (patch)
tree270d785e7936e2b2c85e750176ffcf3c13a9918a /ipaserver/plugins
parentf59cab1ccdb6a0257c7316e42774e5fdd8a9afed (diff)
downloadfreeipa-45a40635bb6867f55f757413776c2374ae07a888.tar.gz
freeipa-45a40635bb6867f55f757413776c2374ae07a888.tar.xz
freeipa-45a40635bb6867f55f757413776c2374ae07a888.zip
Add class variable to indicate whether SSL is required or not.
Older python-ldap versions will crash if you call ldap.get_option() on a value that has not been set.
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r--ipaserver/plugins/ldap2.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 586c31f9..43cc6b97 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -168,14 +168,14 @@ class ldap2(CrudBackend, Encoder):
self._host = api.env.ldap_host
self._port = api.env.ldap_port
self._schema = _schema
+ self._ssl = False
CrudBackend.__init__(self)
def __del__(self):
self.disconnect()
def __str__(self):
- using_cacert = bool(_ldap.get_option(_ldap.OPT_X_TLS_CACERTFILE))
- return _get_url(self._host, self._port, using_cacert)
+ return _get_url(self._host, self._port, self._ssl)
@encode_args(3, 4, 'bind_dn', 'bind_pw')
def create_connection(self, host=None, port=None, ccache=None,
@@ -208,8 +208,10 @@ class ldap2(CrudBackend, Encoder):
if tls_cacertfile is not None:
_ldap.set_option(_ldap.OPT_X_TLS_CACERTFILE, tls_cacertfile)
+ self._ssl = True
if tls_certfile is not None:
_ldap.set_option(_ldap.OPT_X_TLS_CERTFILE, tls_certfile)
+ self._ssl = True
if tls_keyfile is not None:
_ldap.set_option(_ldap.OPT_X_TLS_KEYFILE, tls_keyfile)