diff options
-rw-r--r-- | ipaserver/ipaldap.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py index c814f579..88c6fcc9 100644 --- a/ipaserver/ipaldap.py +++ b/ipaserver/ipaldap.py @@ -255,7 +255,8 @@ class IPASimpleLDAPObject(object): 'originscope': DN_SYNTAX_OID, # DN }) - def __init__(self, uri, force_schema_updates, no_schema=False): + def __init__(self, uri, force_schema_updates, no_schema=False, + decode_attrs=True): """An internal LDAP connection object :param uri: The LDAP URI to connect to @@ -267,6 +268,9 @@ class IPASimpleLDAPObject(object): '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. + :param decode_attrs: + If true, attributes are decoded to Python types according to their + syntax. """ self.log = log_mgr.get_logger(self) self.uri = uri @@ -275,6 +279,7 @@ class IPASimpleLDAPObject(object): self._has_schema = False self._schema = None self._force_schema_updates = force_schema_updates + self._decode_attrs = decode_attrs def _get_schema(self): if self._no_schema: @@ -377,6 +382,9 @@ class IPASimpleLDAPObject(object): ''' ''' + if not self._decode_attrs: + return values + ipa_values = [] for original_value in values: @@ -1649,7 +1657,8 @@ 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, no_schema=False): + start_tls=False, ldap_uri=None, no_schema=False, + decode_attrs=True): self.conn = None log_mgr.get_logger(self, True) if debug and debug.lower() == "on": @@ -1670,7 +1679,8 @@ class IPAdmin(LDAPClient): LDAPClient.__init__(self, ldap_uri) self.conn = IPASimpleLDAPObject(ldap_uri, force_schema_updates=True, - no_schema=no_schema) + no_schema=no_schema, + decode_attrs=decode_attrs) if start_tls: self.conn.start_tls_s() |