Hmm. I'm no perl expert so forgive my not understanding what LDAP requests
are being done here. But when deleting a subtree, you'll probably want a
recursive algorithm to do the $conn_ldap->delete(). If the $element is an
LDAP attribute of the entry, then you don't need to delete those to be able
to delete the entries. You just need to delete all the child entries.    

If your sure it's a leaf, then you should be able to delete it with the
"ldapdelete" command. I'll bet you'll get the same error from ldapdelete.

Here is some psuedocode

deleteIt(entry e)
{
   kids[] = e.getSubentries();
   i = kids.length;
   while(i > 0)
   {
     deleteIt(kids[i-1]);
     i--;  
   }
   e.remove();
}

-----Original Message-----
From: Aur�lien Labrosse [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 06, 2001 9:27 AM
To: [EMAIL PROTECTED]
Subject: Re: $conn->delete($entry->getDN());


Hi,
so there's my code snippet :

$element = $entry->FIRSTKEY();
while($element)
{
 $entry->remove($element);
 $element = $entry->NEXTKEY();
}
$conn_ldap->delete( $entry->getDN() );

if($conn_ldap->getErrorString() eq "Success")
{
 &utils::log($IDClient . $loggingTab[$logCode] . " OK  ") if $DEBUG>0;
}
else
{
 &utils::log($IDClient . $loggingTab[$logCode] .
$conn_ldap->getErrorString() . " FAIL");
}

but i get the "non leaf" error if a search return more than one "dn", on the
last one.
I check the "remove" errorString in the loop, ans its always success. the
snippet treat all the elements
i could see by a standard "ldapsearch" shell command. So why its not
considered as a leaf?

Aur�lien

Kevin L. Burns <[EMAIL PROTECTED]> a �crit dans le message :
[EMAIL PROTECTED]
> More specifically, it isn't the attributes you have to discover and
> delete, it is the node's children.
>
> Jonathan McClure wrote:
> > You can't delete the non leaf entries automatically. You have to delete
the
> > subentries recursively. Similar to trying to delete an empty DOS dir.
> >
> > -----Original Message-----
> > From: Aur�lien Labrosse [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 05, 2001 12:49 PM
> > To: [EMAIL PROTECTED]
> > Subject: $conn->delete($entry->getDN());
> >
> >
> > Hi,
> > when i try to delete an entry, i always get in  errorString :
> > "operation non allowed on non leaf"
> > What should i do before? discover all attributes and delete them one by
one?
> > thx...
> >
> > Aur�lien
> >
> >
> >
> >
>


Reply via email to