diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-01-14 15:51:52 +0000 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-04-16 06:58:31 +0000 |
commit | 955885d8d909592325f017e09af79d62d912dcd0 (patch) | |
tree | 330daec58f8ab89ebbf5aefdc417fbd382bd2ae2 /ipaserver | |
parent | 964e7e906a9bf66a71dbdf33dd55db6f4cb57064 (diff) | |
download | freeipa-955885d8d909592325f017e09af79d62d912dcd0.tar.gz freeipa-955885d8d909592325f017e09af79d62d912dcd0.tar.xz freeipa-955885d8d909592325f017e09af79d62d912dcd0.zip |
ldap: Move value encoding from IPASimpleLDAPObject to LDAPClient
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/plugins/ldap2.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py index 9ab33e2f1..15e07f27b 100644 --- a/ipaserver/plugins/ldap2.py +++ b/ipaserver/plugins/ldap2.py @@ -360,9 +360,11 @@ class ldap2(LDAPClient, CrudBackend): ('cn', 'etc'), self.api.env.basedn) try: - upg_entries = self.conn.search_s(upg_dn, _ldap.SCOPE_BASE, - attrlist=['*']) - except _ldap.NO_SUCH_OBJECT: + with self.error_handler(): + upg_entries = self.conn.search_s(str(upg_dn), _ldap.SCOPE_BASE, + attrlist=['*']) + upg_entries = self._convert_result(upg_entries) + except errors.NotFound: upg_entries = None if not upg_entries or 'originfilter' not in upg_entries[0]: raise errors.ACIError(info=_( @@ -477,7 +479,9 @@ class ldap2(LDAPClient, CrudBackend): conn.unbind() with self.error_handler(): - self.conn.passwd_s(dn, old_pass, new_pass) + old_pass = self.encode(old_pass) + new_pass = self.encode(new_pass) + self.conn.passwd_s(str(dn), old_pass, new_pass) def add_entry_to_group(self, dn, group_dn, member_attr='member', allow_same=False): """ @@ -509,7 +513,9 @@ class ldap2(LDAPClient, CrudBackend): # update group entry try: with self.error_handler(): - self.conn.modify_s(group_dn, modlist) + modlist = [(a, self.encode(b), self.encode(c)) + for a, b, c in modlist] + self.conn.modify_s(str(group_dn), modlist) except errors.DatabaseError: raise errors.AlreadyGroupMember() @@ -529,7 +535,9 @@ class ldap2(LDAPClient, CrudBackend): # update group entry try: with self.error_handler(): - self.conn.modify_s(group_dn, modlist) + modlist = [(a, self.encode(b), self.encode(c)) + for a, b, c in modlist] + self.conn.modify_s(str(group_dn), modlist) except errors.MidairCollision: raise errors.NotGroupMember() @@ -583,7 +591,7 @@ class ldap2(LDAPClient, CrudBackend): (_ldap.MOD_REPLACE, 'krblastpwdchange', None)] with self.error_handler(): - self.conn.modify_s(dn, mod) + self.conn.modify_s(str(dn), mod) # CrudBackend methods |