From: Jim H. <ha...@us...> - 2000-06-29 18:51:43
|
Eric, I have attached code that will find all attributes without using ldap->schema(). For your second question, it depends on what you want to really search for. If all you want to know is whether an object of a given dn exists, you can use code like $mesg = $ldap->search ( base => $testdn, scope => 0, filter => "(objectclass=*)" ); If the search succeeds, $testdn already exists. If you, however, want to make sure that you are adding an object where the lowest level of the dn is unique, the search is different. This might be when you are looking to add a user with uid=joe, but you want to make sure that not only is there not a "joe" in dept1, but not anywhere. If this is the case, then you need to make sure that all your users have a uid attribute, not just uid as part of the dn. Then the search becomes $mesg = $ldap->search ( base => $normalbase filter => "(uid=$testuid)" ); Jim Harle US Naval Academy On Thu, 29 Jun 2000, Graham Barr wrote: > ----- Forwarded message from Eric Zhou <eri...@ya...> ----- > > Date: Thu, 29 Jun 2000 10:55:36 -0700 (PDT) > From: Eric Zhou <eri...@ya...> > Subject: retrieve perl-ldap schema and ldap search > To: Graham Barr <gb...@po...> > > hi,Graham: > > remember I asked you an address the other day about > two perl module. I am still not that far yet. > I have been able to use ldap->add() and ldap->modify() > function to do some simple stuff. > > do you have some handy example of how to use > ldap->schema to retrieve schema of ldap tree? > the other thing is that I don't quite understand > your ldap->search() doing. because I wish to search > and dn in the ldap tree and see if it is there before > I insert it. do I suppose to use ldap->search() or > ldap->compare(). > > > thank you very much. > > Eric > > > __________________________________________________ > Do You Yahoo!? > Get Yahoo! Mail - Free email you can access from anywhere! > http://mail.yahoo.com/ > > ----- End forwarded message ----- > > |