From: Jurgen B. <ju...@bo...> - 2000-09-08 16:12:29
|
Mark Wilcox wrote: > You can't use a standard modify to just change the DN of the entry. You > must do a modrdn (can't remember if that's in the current api or not, > check the docs). It is, $ldap->moddn. This works now to changed the RDN. However, I also need to be able to change the superior, and Netscape Dir Server 4.11 barfs on $ldap->moddn($dn, 'newsuperior' => $newsuper) with: Error: LDAP_PARAM_ERROR -- An invalid parameter was specified > If you want to use modify to change the dn of an entry, you must copy all > of the attributes from the old entry into an Entry object, set the new dn > and then add that object to the server. Ok, makes sense... I gather being able to change the superior is not an LDAP v3 requirement. So I have to do as you say, and the following works nicely and is simple enough: $result = $ldap->search( ... $base=$olddn ...) $entry = $result->shift_entry; $entry->dn($newdn); $ldap->delete($olddn); $ldap->add($entry); (At least in my case I must do the delete before the add because some of the attributes have indexes that require them to be globally unique). Thanks to Graham and Mark for the help! - Jurgen |