From: Graham B. <gb...@po...> - 2000-09-08 09:29:10
|
On Thu, Sep 07, 2000 at 11:03:29PM -0700, 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. Ah, this needs to be removed from the docs. It may have just been an original intention. > Well, whatever, maybe this doesn't hold for changed dn's so, I give > it an explicit $entry->update($ldap). Now I get: yes that is right. > $ 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? No, this should be trapped. You cannot change a dn in this way, you can only change attributes. So ->update should of done nothing but return an error. > 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.) Well try using $ldap->moddn( $entry->dn, newrdn => $newrdn ); Graham. |