From: Mark W. <mew...@un...> - 2000-09-08 13:41:27
|
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). 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. Mark On Thu, 7 Sep 2000, Jurgen Botz wrote: > So I wrote simple little program to change the dn of an entry > (attached), and first it fails as follows: > > $ perl rename.pl uid=jbotz,ou=people,o=eazel password \ > uid=tuser,ou=people,o=eazel uid=tuser1,ou=people,o=eazel > > Can't call method "modify" on an undefined value at > /usr/lib/perl5/site_perl/5.005/Net/LDAP/Entry.pm line 200 > > This seems to be because I call $entry->update without any args, > but the manual sez: > CLIENT is only optional if the Net::LDAP::Entry object was created > by a search on a directory server. In which case, if omitted, the > update will be sent back to the same server. > > Well, whatever, maybe this doesn't hold for changed dn's so, I give > it an explicit $entry->update($ldap). Now I get: > > $ perl rename.pl uid=jbotz,ou=people,o=eazel password \ > uid=tuser,ou=people,o=eazel uid=tuser1,ou=people,o=eazel > > Can't use an undefined value as an ARRAY reference at > /usr/lib/perl5/site_perl/5.005/Net/LDAP.pm line 313. > > This seems to be because Net::LDAP->modify doesn't know its change > type. Adding an explicit $entry->changetype('modify') to my script > gets me further, but shouldn't the fact that I changed the dn have > tipped it off? > > Anyway, now my program runs all the way through and produces the > following error: > > Error: LDAP_PROTOCOL_ERROR -- Unrecognized version number or incorrect > PDU structure > > Right now I'm pretty clueless what this could mean. All I'm trying > to do at the moment is change the RDN! (On a Netscape 4.11 server, > and the OpenLDAP ldapmodrdn(1) program works fine.) > > - Jurgen > > > |