mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
Allow disabling LDAP schema retrieval in LDAPClient and IPAdmin.
This commit is contained in:
committed by
Martin Kosek
parent
4152c36bf2
commit
fffd2eb32d
@@ -255,7 +255,7 @@ class IPASimpleLDAPObject(object):
|
|||||||
'originscope': DN_SYNTAX_OID, # DN
|
'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
|
"""An internal LDAP connection object
|
||||||
|
|
||||||
:param uri: The LDAP URI to connect to
|
: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
|
Generally, it should be true if the API context is 'installer' or
|
||||||
'updates', but it must be given explicitly since the API object
|
'updates', but it must be given explicitly since the API object
|
||||||
is not always available
|
is not always available
|
||||||
|
:param no_schema: If true, schema is never requested from the server.
|
||||||
"""
|
"""
|
||||||
self.log = log_mgr.get_logger(self)
|
self.log = log_mgr.get_logger(self)
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
self.conn = SimpleLDAPObject(uri)
|
self.conn = SimpleLDAPObject(uri)
|
||||||
|
self._no_schema = no_schema
|
||||||
self._has_schema = False
|
self._has_schema = False
|
||||||
self._schema = None
|
self._schema = None
|
||||||
self._force_schema_updates = force_schema_updates
|
self._force_schema_updates = force_schema_updates
|
||||||
|
|
||||||
def _get_schema(self):
|
def _get_schema(self):
|
||||||
|
if self._no_schema:
|
||||||
|
return None
|
||||||
if not self._has_schema:
|
if not self._has_schema:
|
||||||
try:
|
try:
|
||||||
self._schema = schema_cache.get_schema(
|
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,
|
def __init__(self, host='', port=389, cacert=None, debug=None, ldapi=False,
|
||||||
realm=None, protocol=None, force_schema_updates=True,
|
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
|
self.conn = None
|
||||||
log_mgr.get_logger(self, True)
|
log_mgr.get_logger(self, True)
|
||||||
if debug and debug.lower() == "on":
|
if debug and debug.lower() == "on":
|
||||||
@@ -1665,7 +1669,8 @@ class IPAdmin(LDAPClient):
|
|||||||
|
|
||||||
LDAPClient.__init__(self, ldap_uri)
|
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:
|
if start_tls:
|
||||||
self.conn.start_tls_s()
|
self.conn.start_tls_s()
|
||||||
|
|||||||
Reference in New Issue
Block a user