diff options
author | Jan Cholasta <jcholast@redhat.com> | 2013-01-16 14:14:58 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-03-01 16:59:42 +0100 |
commit | ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d (patch) | |
tree | 84ad0688b942996dd7b8fa58af3e2702b92f85d2 /ipaserver/ipaldap.py | |
parent | e2120c31c3ba62d1bc57825b90a30d26ca58aa79 (diff) | |
download | freeipa.git-ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d.tar.gz freeipa.git-ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d.tar.xz freeipa.git-ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d.zip |
Add custom mapping object for LDAP entry data.
Diffstat (limited to 'ipaserver/ipaldap.py')
-rw-r--r-- | ipaserver/ipaldap.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py index 9b3b86fc..c7e1552e 100644 --- a/ipaserver/ipaldap.py +++ b/ipaserver/ipaldap.py @@ -40,7 +40,7 @@ from ipalib import errors from ipapython.ipautil import format_netloc, wait_for_open_socket, wait_for_open_ports from ipapython.dn import DN from ipapython.entity import Entity -from ipaserver.plugins.ldap2 import IPASimpleLDAPObject +from ipaserver.plugins.ldap2 import IPASimpleLDAPObject, LDAPEntry # Global variable to define SASL auth SASL_AUTH = ldap.sasl.sasl({},'GSSAPI') @@ -54,7 +54,7 @@ class IPAEntryLDAPObject(IPASimpleLDAPObject): objtype, data = IPASimpleLDAPObject.result(self, msgid, all, timeout) # data is either a 2-tuple or a list of 2-tuples if data: - if isinstance(data, tuple): + if isinstance(data, (LDAPEntry, tuple)): return objtype, Entry(data) elif isinstance(data, list): return objtype, [Entry(x) for x in data] @@ -102,7 +102,10 @@ class Entry: a search result entry or a reference or None. If creating a new empty entry, data is the string DN.""" if entrydata: - if isinstance(entrydata,tuple): + if isinstance(entrydata,LDAPEntry): + self.dn = entrydata.dn + self.data = entrydata + elif isinstance(entrydata,tuple): self.dn = entrydata[0] self.data = ipautil.CIDict(entrydata[1]) elif isinstance(entrydata,DN): |