Fix LDAPCreate search failure

LDAPCreate reports "search criteria was not specific enough" when LDAP
object created in LDAPCreate shares its container with other LDAP objects
and there is one with the same name and RDN attribute.

Pass objectclass to find_entry_by_attr() function used to retrieve
newly created object for POST_CALLBACK to identify correct LDAP
object.

https://fedorahosted.org/freeipa/ticket/1864
This commit is contained in:
Martin Kosek
2011-09-30 11:04:14 +02:00
parent 1e2c056283
commit 7c884f1205

View File

@@ -739,8 +739,13 @@ class LDAPCreate(CallbackInterface, crud.Create):
try:
if self.obj.rdn_attribute:
# make sure objectclass is either set or None
if self.obj.object_class:
object_class = self.obj.object_class
else:
object_class = None
(dn, entry_attrs) = ldap.find_entry_by_attr(
self.obj.primary_key.name, keys[-1], None, attrs_list,
self.obj.primary_key.name, keys[-1], object_class, attrs_list,
self.obj.container_dn
)
else: