From: Chris R. <chr...@me...> - 2002-03-05 14:49:06
|
Armin Fuerst <ar...@co...> wrote: > > hi! > > i am using the Net::LDAP library to create a little maintenance utility > for a ldap-server. > searching and removing was working perfectly, but i now have a problem > adding new entries. > the ldap-server used is from data connection limited. > i created a new entry using (before, i used 'new' and 'bind'): > > $ldapresults=$ldapconnection->add ($dn) What type is the $dn variable? If it is just a string representing a DN, then you've possibly found two bugs: 1) Net::LDAP shouldn't let you add an entry with no attributes 2) your server has added an incomplete and illegal entry > and this did something in the database, but i'm not sure exactly what. > when i try to search this entry, i don't see it (but i see other entries). > with the directory admin tool that came with the ldap-server, i see the > entry, but when i try to access it, i receive the error-message, that the > entry has been deleted. when i try again, the entry appears again and when > i try to delete it, the directory admin closes without any comment > (crashes?). > > when i try to create the entry again (like above), i get the > error-message: "The entry already exists", when i try to delete it, i get > the error-message : "No such object". > when i try to delete the whole tree in the directory admin, i get the > error-message: > Unable to delete the entry "..." (or any of its superiors) because this > area of the directroy contains links or aliases. > > > can you please tell me: > * how can i get rid of the entry? Since you don't seem to be able to delete it over protocol, that will probably depend on what brand of server it is. You might need to dump the database contents to some text file (eg LDIF), edit the text file, and reload it. > * what did i do wrong when trying to create the entry? Probably, you forgot to specify any attributes in the entry. As far as I can recall, you can use add() two ways: 1) specifying the whole entry in the arguments: $ldap->add("cn=My Entry,o=My Company,c=WW", attr => [ "objectClass" => [qw(top person)], "cn" => ["My Entry"], "sn" => ["Entry"], ]); 2) creating a Net::LDAP::Entry object, and adding that object: $e = new Net::LDAP::Entry; $e->dn("cn=My Entry,o=My Company,c=WW"); $e->add( "objectClass" => [qw(top person)], "cn" => ["My Entry"], "sn" => ["Entry"], ); $ldap->add($e); > kind regards, > > armin fuerst > > Cheers, Chris |