From: Graham B. <gb...@po...> - 2000-09-20 13:58:19
|
Well cannot duplicate it. I have just tried $mesg = $ldap->search(base => $BASEDN, filter => '(&(sn=jensen)(cn=Barbara*))', callback => sub { return unless $_[1]; my $newentry = $_[1]; my $dn = $newentry->dn; $dn =~ s/=/=xx/; $newentry->dn($dn); print "attempting to add entry ",$newentry->dn,"\n"; $mesg = $ldap->add($newentry); print "returned ", $mesg->code,"\n"; }); And the first time I got $ perl -Ilib dummy attempting to add entry cn=xxBarbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US returned 0 The next time I got perl -Ilib dummy attempting to add entry cn=xxBarbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US attempting to add entry cn=xxxxBarbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US returned 0 returned 68 Now the order of the output may seem strange, but it is correct. Graham. On Wed, Sep 20, 2000 at 08:44:41AM -0400, Jim Harle wrote: > I haven't yet gotten any nibbles on this. I will add some clarification > and a line of code. The 3 lines : > print "attempting to add entry ",$newentry->dn,"\n" if $testing; > $mesg = $ldap->add($newentry); > print "returned ", $mesg->code,"\n"; > result in "attempting to add" being printed twice with no "returned'. If > I run with perl -d and put breakpoints at the two prints above, the second > one is never caught and after the second, it loops so tightly that I can't > even use Ctl-C to get out. Any ideas? > > --Jim Harle > > > On Tue, 19 Sep 2000, Jim Harle wrote: > > > 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 > > > > > > > > |