From: Jim H. <ha...@us...> - 2000-09-19 15:20:46
|
I'm attempting to move an entry to another container via copy and delete since my server (Novell NDS eDirectory) apparently won't allow a moddn to a different one. I am using perl-ldap-0.19 and perl 5.005_03 on one Solaris system and perl-ldap-0.22 on another. Strange things are happening with both versions. In executing the code below, which is a callback from a search, it prints the "attempting to add" message for both things found in the search, but never prints either "Add fail" or "attempting to delete", which seems like an impossibility. It goes into some sort of catatonic state after printing the 2 "attempting to add" messages. It also neither adds nor deletes. Any ideas of what I should try? Here is the code I am using: sub process_entry { # execute this once for each entry found in searchldap my $uid; my ( $search, $entry ) = @_ ; return unless $search; return unless $entry; $dn = $entry->dn; # get the dn for this one; #set the dn for the corresponding disabled place my $newdn = $dn; $dn =~ /^\w+\=(\w+)/; # the first thing in the dn is what we want $uid = $1; # the uid $newdn =~ s/o\s*\=\s*usna/ou\=usna\,o\=disabled/i; my $newentry = Net::LDAP::Entry->new; $newentry = $entry; $newentry->dn($newdn); print "attempting to add entry ",$newentry->dn,"\n" if $testing; $mesg = $ldap->add($newentry); if ($mesg->code) { print "Add fail for $newdn\n ", Net::LDAP::Util::ldap_error_name($mesg->code), "\n" if $testing; print ERROR "Add fail for $newdn\n ", Net::LDAP::Util::ldap_error_name($mesg->code), "\n"; } else { print "attempting to delete $dn\n" if $testing; $mesg = $ldap->delete($dn); #delete old entry print LOG "moved to $newdn\n"; if ($mesg->code) { print "Delete fail for $dn\n ", Net::LDAP::Util::ldap_error_name($mesg->code), "\n" if $testing; print ERROR "Delete fail for $dn\n ", Net::LDAP::Util::ldap_error_name($mesg->code), "\n"; } else { if ($testing) { print "would have sent deluser for $uid\n"; } else { system "senddeluser $uid"; } } } $search->pop_entry; } --Jim Harle |