3 #include "LDAPConnection.h"
4 #include "LDAPConstraints.h"
5 #include "LDAPSearchReference.h"
6 #include "LDAPSearchResults.h"
7 #include "LDAPAttribute.h"
8 #include "LDAPAttributeList.h"
10 #include "LDAPException.h"
11 #include "LDAPModification.h"
12 #include "LDAPReferralException.h"
13 #include "LDAPSchema.h"
18 LDAPConnection *lc=new LDAPConnection("192.168.3.128",389);
19 cout << "----------------------doing bind...." << endl;
21 lc->bind("uid=admin,dc=home,dc=local" , "secret");
22 cout << lc->getHost() << endl;
24 tmp.add("subschemasubentry");
25 LDAPSearchResults* entries = lc->search("",
26 LDAPConnection::SEARCH_BASE,
29 LDAPEntry* rootDse = entries->getNext();
30 std::string schemabase="cn=subschema";
33 const LDAPAttribute* schemaAttr = rootDse->getAttributes()->getAttributeByName("subschemaSubentry");
34 schemabase = *(schemaAttr->getValues().begin());
37 attrs.add("objectClasses");
38 attrs.add("attributeTypes");
39 entries = lc->search(schemabase, LDAPConnection::SEARCH_BASE, "(objectClass=*)",
42 LDAPEntry* entry = entries->getNext();
44 const LDAPAttribute* oc = entry->getAttributes()->getAttributeByName("objectClasses");
46 schema.setObjectClasses((oc->getValues()));
47 LDAPObjClass test = schema.getObjectClassByName("inetOrgPerson");
48 cout << test.getDesc() << endl;
49 // StringList mustAttr = test.getMay();
50 // for( StringList::const_iterator i = mustAttr.begin(); i != mustAttr.end(); i++ ){
51 // cout << *i << endl;
53 StringList sup = test.getSup();
54 for( StringList::const_iterator i = sup.begin(); i != sup.end(); i++ ){
62 }catch (LDAPException e){
63 cout << "------------------------- caught Exception ---------"<< endl;