Revision 89417bb7b0a4654601e2447a0a172196e31fab6e authored by Rene Brun on 24 May 2007, 08:56:37 UTC, committed by Rene Brun on 24 May 2007, 08:56:37 UTC
on fNpx and fNpy such that this parameter can be modified without recompiling.


git-svn-id: http://root.cern.ch/svn/root/trunk@18875 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent d4d2313
Raw File
LDAPExample.C
void LDAPExample()
{
   gSystem->Load("libRLDAP.so");

   TLDAPServer *server = new TLDAPServer("ldap.cern.ch");

   TLDAPResult *result = server.Search();

   if (result == 0) {
      printf("Search failed\n");
      exit(1);
   }
   result->Print();
   delete result;

   const char *namingcontexts = server.GetNamingContexts();
   result = server.Search(namingcontexts, LDAP_SCOPE_ONELEVEL, 0, 0, 1);
   TLDAPEntry *entry = result.GetNext();
   entry->Print();

   TString dn = entry->GetDn();

   delete result;
   delete entry;

   cout << "The DN of the entry is " << dn << endl;

   result = server.Search(dn, LDAP_SCOPE_SUBTREE, 0, 0, 0);

   if (result == 0) {
      printf("Search failed\n");
      exit(1);
   }

   result->Print();
   Int_t counter = result.GetCount();
   cout << "The result contains " << counter << " entries !!!" << endl;

   entry = result.GetNext();

   TLDAPAttribute *attribute = entry.GetAttribute("member");

   Int_t counter2 = attribute.GetCount();
   cout << "The attribute " << attribute.GetName() << " contains "
        << counter2 << " values !!!" << endl;
   const char *value = attribute.GetValue();
   cout << "The first value of the attribute is " << endl;
   cout << value << endl;

   delete result;
   delete entry;
}
back to top