summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2013-03-07 10:52:57 +0100
committerMartin Kosek <mkosek@redhat.com>2013-03-08 14:47:52 +0100
commitfffd2eb32df63010351ed0f07fd34b411cdaf06e (patch)
tree4131ccdfe85f245b7b063c34d8ced7164750a689
parent4152c36bf2943c3e27044e4e9ad7ac24318b14f8 (diff)
downloadfreeipa-fffd2eb32df63010351ed0f07fd34b411cdaf06e.tar.gz
freeipa-fffd2eb32df63010351ed0f07fd34b411cdaf06e.tar.xz
freeipa-fffd2eb32df63010351ed0f07fd34b411cdaf06e.zip
Allow disabling LDAP schema retrieval in LDAPClient and IPAdmin.
-rw-r--r--ipaserver/ipaldap.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index d9f91d538..c814f5798 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -255,7 +255,7 @@ class IPASimpleLDAPObject(object):
'originscope': DN_SYNTAX_OID, # DN
})
- def __init__(self, uri, force_schema_updates):
+ def __init__(self, uri, force_schema_updates, no_schema=False):
"""An internal LDAP connection object
:param uri: The LDAP URI to connect to
@@ -266,15 +266,19 @@ class IPASimpleLDAPObject(object):
Generally, it should be true if the API context is 'installer' or
'updates', but it must be given explicitly since the API object
is not always available
+ :param no_schema: If true, schema is never requested from the server.
"""
self.log = log_mgr.get_logger(self)
self.uri = uri
self.conn = SimpleLDAPObject(uri)
+ self._no_schema = no_schema
self._has_schema = False
self._schema = None
self._force_schema_updates = force_schema_updates
def _get_schema(self):
+ if self._no_schema:
+ return None
if not self._has_schema:
try:
self._schema = schema_cache.get_schema(
@@ -1645,7 +1649,7 @@ class IPAdmin(LDAPClient):
def __init__(self, host='', port=389, cacert=None, debug=None, ldapi=False,
realm=None, protocol=None, force_schema_updates=True,
- start_tls=False, ldap_uri=None):
+ start_tls=False, ldap_uri=None, no_schema=False):
self.conn = None
log_mgr.get_logger(self, True)
if debug and debug.lower() == "on":
@@ -1665,7 +1669,8 @@ class IPAdmin(LDAPClient):
LDAPClient.__init__(self, ldap_uri)
- self.conn = IPASimpleLDAPObject(ldap_uri, force_schema_updates=True)
+ self.conn = IPASimpleLDAPObject(ldap_uri, force_schema_updates=True,
+ no_schema=no_schema)
if start_tls:
self.conn.start_tls_s()