Back to index

openldap  2.4.31
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
LDAPConnection Class Reference

Main class for synchronous LDAP-Communication. More...

#include <LDAPConnection.h>

Inheritance diagram for LDAPConnection:
Inheritance graph
[legend]
Collaboration diagram for LDAPConnection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LDAPConnection (const std::string &hostname="localhost", int port=389, LDAPConstraints *cons=new LDAPConstraints())
 This Constructor initializes synchronous LDAP-Connection.
 ~LDAPConnection ()
 Destructor.
void init (const std::string &hostname, int port)
 Initzializes a synchronous connection to a server.
void start_tls ()
 Start TLS on this connection.
void bind (const std::string &dn="", const std::string &passwd="", LDAPConstraints *cons=0)
 Performs a simple authentication with the server.
void saslInteractiveBind (const std::string &mech, int flags=0, SaslInteractionHandler *sih=0, const LDAPConstraints *cons=0)
void unbind ()
 Performs the UNBIND-operation on the destination server.
bool compare (const std::string &dn, const LDAPAttribute &attr, LDAPConstraints *cons=0)
 Performs a COMPARE-operation on an entery of the destination server.
void del (const std::string &dn, const LDAPConstraints *cons=0)
 Deletes an entry from the directory.
void add (const LDAPEntry *le, const LDAPConstraints *cons=0)
 Use this method to perform the ADD-operation.
void modify (const std::string &dn, const LDAPModList *mods, const LDAPConstraints *cons=0)
 To modify the attributes of an entry, this method can be used.
void rename (const std::string &dn, const std::string &newRDN, bool delOldRDN=false, const std::string &newParentDN="", const LDAPConstraints *cons=0)
 This method performs the ModDN-operation.
LDAPSearchResultssearch (const std::string &base, int scope=0, const std::string &filter="objectClass=*", const StringList &attrs=StringList(), bool attrsOnly=false, const LDAPConstraints *cons=0)
 This method can be used for the sync.
LDAPExtResultextOperation (const std::string &oid, const std::string &value="", const LDAPConstraints *const =0)
 This method is for extended LDAP-Operations.
const std::string & getHost () const
int getPort () const
void setConstraints (LDAPConstraints *cons)
 Change the default constraints of the connection.
const LDAPConstraintsgetConstraints () const
 Get the default constraints of the connection.
TlsOptions getTlsOptions () const

Static Public Attributes

static const int SEARCH_BASE = LDAPAsynConnection::SEARCH_BASE
 Constant for the Search-Operation to indicate a Base-Level Search.
static const int SEARCH_ONE = LDAPAsynConnection::SEARCH_ONE
 Constant for the Search-Operation to indicate a One-Level Search.
static const int SEARCH_SUB = LDAPAsynConnection::SEARCH_SUB
 Constant for the Search-Operation to indicate a Subtree Search.

Private Member Functions

void initialize (const std::string &uri)
 Initializes a connection to a server.
LDAPMessageQueuebind (const std::string &dn="", const std::string &passwd="", const LDAPConstraints *cons=0)
 Simple authentication to a LDAP-Server.
LDAPMessageQueuesaslBind (const std::string &mech, const std::string &cred, const LDAPConstraints *cons=0)
LDAPMessageQueuecompare (const std::string &dn, const LDAPAttribute &attr, const LDAPConstraints *cons=0)
 Perform the COMPARE-operation on an attribute.
void abandon (LDAPMessageQueue *q)
 End an outstanding request.
LDAP * getSessionHandle () const
LDAPAsynConnectionreferralConnect (const LDAPUrlList &urls, LDAPUrlList::const_iterator &usedUrl, const LDAPConstraints *cons) const
 This method is used internally for automatic referral chasing.

Private Attributes

bool m_cacheEnabled
 Is caching enabled?

Detailed Description

Main class for synchronous LDAP-Communication.

The class represent a LDAP-Connection to perform synchronous LDAP-Operations. This provides methodes for the different LDAP-Operations. All the methods for the LDAP-operations block until all results for the operation are received or until an error occurs

Definition at line 21 of file LDAPConnection.h.


Constructor & Destructor Documentation

LDAPConnection::LDAPConnection ( const std::string &  hostname = "localhost",
int  port = 389,
LDAPConstraints cons = new LDAPConstraints() 
)

This Constructor initializes synchronous LDAP-Connection.

During execution of this constructor no network communication is performed. Just some internal data structure are initialized

Parameters:
hostnameName (or IP-Adress) of the destination host
portPort the LDAP server is running on
consDefault constraints to use with operations over this connection

Definition at line 20 of file LDAPConnection.cpp.

                               :
        LDAPAsynConnection(hostname, port, cons){
}

Destructor.

Definition at line 25 of file LDAPConnection.cpp.

                               {
}

Member Function Documentation

End an outstanding request.

Parameters:
qAll outstanding request related to this LDAPMessageQueue will be abandoned

Definition at line 248 of file LDAPAsynConnection.cpp.

                                                   {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::abandon()" << endl);
    LDAPRequestStack *reqStack=q->getRequestStack();
    LDAPRequest *req;
    while(! reqStack->empty()){
        req=reqStack->top();
        if (ldap_abandon_ext(cur_session, req->getMsgID(), 0, 0) 
                != LDAP_SUCCESS){
            throw LDAPException(this);
        }
        delete req;
        reqStack->pop();
    }
}

Here is the call graph for this function:

Use this method to perform the ADD-operation.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
lethe entry to add to the directory
consA set of constraints that should be used with this request

Reimplemented from LDAPAsynConnection.

Definition at line 177 of file LDAPConnection.cpp.

                                                                        {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::add" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::add(le,cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    switch (resCode){
        case LDAPResult::SUCCESS :
            delete res; 
            delete msg;
        break;
        case LDAPResult::REFERRAL :
        {
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }
        break;
        default :
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
    }
}

Here is the call graph for this function:

void LDAPConnection::bind ( const std::string &  dn = "",
const std::string &  passwd = "",
LDAPConstraints cons = 0 
)

Performs a simple authentication with the server.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
dnThe name of the entry to bind as
passwdThe cleartext password for the entry

Definition at line 32 of file LDAPConnection.cpp.

                              {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::bind" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::bind(dn,passwd,cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    if(resCode != LDAPResult::SUCCESS) {
        if(resCode == LDAPResult::REFERRAL){
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }else{
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
        }
    }
    delete res;
    delete msg;   // memcheck
}

Here is the call graph for this function:

Here is the caller graph for this function:

LDAPMessageQueue * LDAPAsynConnection::bind ( const std::string &  dn = "",
const std::string &  passwd = "",
const LDAPConstraints cons = 0 
) [inherited]

Simple authentication to a LDAP-Server.

Exceptions:
LDAPExceptionIf the Request could not be sent to the destination server, a LDAPException-object contains the error that occured. This method does a simple (username, password) bind to the server. Other, saver, authentcation methods are provided later
Parameters:
dnthe distiguished name to bind as
passwdcleartext password to use

Definition at line 86 of file LDAPAsynConnection.cpp.

                                                          {
    DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::bind()" <<  endl);
    DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER, "   dn:" << dn << endl
               << "   passwd:" << passwd << endl);
    LDAPBindRequest *req = new LDAPBindRequest(dn,passwd,this,cons);
    try{
        LDAPMessageQueue *ret = req->sendRequest();
        return ret;
    }catch(LDAPException e){
        delete req;
        throw;
    }
}

Here is the call graph for this function:

bool LDAPConnection::compare ( const std::string &  dn,
const LDAPAttribute attr,
LDAPConstraints cons = 0 
)

Performs a COMPARE-operation on an entery of the destination server.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
dnDistinguished name of the entry for which the compare should be performed
attrAn Attribute (one (!) value) to use for the compare operation
consA set of constraints that should be used with this request
Returns:
The result of the compare operation. true if the attr-parameter matched an Attribute of the entry. false if it did not match

Definition at line 101 of file LDAPConnection.cpp.

                              {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::compare" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::compare(dn,attr,cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    switch (resCode){
        case LDAPResult::COMPARE_TRUE :
            delete res; 
            delete msg;
            return true;
        break;
        case LDAPResult::COMPARE_FALSE :
            delete res;
            delete msg;
            return false;
        break;
        case LDAPResult::REFERRAL :
        {
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }
        break;
        default :
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

LDAPMessageQueue * LDAPAsynConnection::compare ( const std::string &  dn,
const LDAPAttribute attr,
const LDAPConstraints cons = 0 
) [inherited]

Perform the COMPARE-operation on an attribute.

Exceptions:
LDAPExceptionIf the Request could not be sent to the destination server, a LDAPException-object contains the error that occured.
Parameters:
dnDistinguished name of the entry for which the compare should be performed
attrAn Attribute (one (!) value) to use for the compare operation
consA set of constraints that should be used with this request

Definition at line 170 of file LDAPAsynConnection.cpp.

                                                               {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::compare()" << endl);
    DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,"   dn:" << dn << endl
            << "   attr:" << attr << endl);
    LDAPCompareRequest *req = new LDAPCompareRequest(dn, attr, this, cons);
    try{
        LDAPMessageQueue *ret = req->sendRequest();
        return ret;
    }catch(LDAPException e){
        delete req;
        throw;
    }
}

Here is the call graph for this function:

void LDAPConnection::del ( const std::string &  dn,
const LDAPConstraints cons = 0 
)

Deletes an entry from the directory.

This method performs the DELETE operation on the server

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
dnDistinguished name of the entry that should be deleted
consA set of constraints that should be used with this request

Reimplemented from LDAPAsynConnection.

Definition at line 142 of file LDAPConnection.cpp.

                                                                     {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::del" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::del(dn,cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    switch (resCode){
        case LDAPResult::SUCCESS :
            delete res; 
            delete msg;
        break;
        case LDAPResult::REFERRAL :
        {
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }
        break;
        default :
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
    }

}

Here is the call graph for this function:

LDAPExtResult * LDAPConnection::extOperation ( const std::string &  oid,
const std::string &  value = "",
const LDAPConstraints * const  cons = 0 
)

This method is for extended LDAP-Operations.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
oidThe Object Identifier of the Extended Operation that should be performed.
strintIf the Extended Operation needs some additional data it can be passed to the server by this parameter.
consA set of constraints that should be used with this request
Returns:
The result of the Extended Operation as an pointer to a LDAPExtResult-object.

Reimplemented from LDAPAsynConnection.

Definition at line 330 of file LDAPConnection.cpp.

                                                         {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::extOperation" << endl);
    LDAPMessageQueue* msg=0;
    LDAPExtResult* res=0;
    try{
        msg = LDAPAsynConnection::extOperation(oid,value,cons);
        res = (LDAPExtResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    switch (resCode){
        case LDAPResult::SUCCESS :
            delete msg;
            return res;
        case LDAPResult::REFERRAL :
        {
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }
        break;
        default :
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
    }
}

Here is the call graph for this function:

Get the default constraints of the connection.

Returns:
Pointer to the LDAPConstraints-Object that is currently used with the Connection

Reimplemented from LDAPAsynConnection.

Definition at line 376 of file LDAPConnection.cpp.

const string & LDAPConnection::getHost ( ) const
Returns:
The Hostname of the destination server of the connection.

Reimplemented from LDAPAsynConnection.

Definition at line 364 of file LDAPConnection.cpp.

Here is the caller graph for this function:

Returns:
The Port to which this connection is connecting to on the remote server.

Reimplemented from LDAPAsynConnection.

Definition at line 368 of file LDAPConnection.cpp.

LDAP * LDAPAsynConnection::getSessionHandle ( ) const [inherited]
Returns:
The C-APIs LDAP-structure that is associated with the current connection

Definition at line 292 of file LDAPAsynConnection.cpp.

                                                { 
    DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::getSessionHandle()" << endl);
    return cur_session;
}

Here is the caller graph for this function:

Reimplemented from LDAPAsynConnection.

Definition at line 380 of file LDAPConnection.cpp.

void LDAPConnection::init ( const std::string &  hostname,
int  port 
)

Initzializes a synchronous connection to a server.

There is actually no communication to the server. Just the object is initialized (e.g. this method is called within the LDAPConnection(char*,int,LDAPConstraints) constructor.)

Parameters:
hostnameThe Name or IP-Address of the destination LDAP-Server
portThe Network Port the server is running on

Reimplemented from LDAPAsynConnection.

void LDAPAsynConnection::initialize ( const std::string &  uri) [inherited]

Initializes a connection to a server.

There actually no communication to the server. Just the object is initialized

Parameters:
uriThe LDAP-Uri for the destination

Definition at line 68 of file LDAPAsynConnection.cpp.

Here is the call graph for this function:

void LDAPConnection::modify ( const std::string &  dn,
const LDAPModList mods,
const LDAPConstraints cons = 0 
)

To modify the attributes of an entry, this method can be used.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
dnThe DN of the entry which should be modified
modsA set of modifications for that entry.
consA set of constraints that should be used with this request

Reimplemented from LDAPAsynConnection.

Definition at line 211 of file LDAPConnection.cpp.

                                    {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::modify" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::modify(dn,mods,cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    switch (resCode){
        case LDAPResult::SUCCESS :
            delete res; 
            delete msg;
        break;
        case LDAPResult::REFERRAL :
        {
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }
        break;
        default :
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
    }
    
}

Here is the call graph for this function:

This method is used internally for automatic referral chasing.

It tries to bind to a destination server of the URLs of a referral.

Exceptions:
LDAPExceptionin any case of an error
Parameters:
urlsContains a std::list of LDAP-Urls that indicate the destinations of a referral
usedUrlAfter this method has successfully bind to one of the Destination URLs this parameter contains the URLs which was contacted.
consAn LDAPConstraints-Object that should be used for the new connection. If this object contains a LDAPRebind-object it is used to bind to the new server

Definition at line 307 of file LDAPAsynConnection.cpp.

                                           {
    DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::referralConnect()" << endl)
    LDAPUrlList::const_iterator conUrl;
    LDAPAsynConnection* tmpConn=0;
    const LDAPRebind* rebind = cons->getReferralRebind();
    LDAPRebindAuth* auth = 0;

    for(conUrl=urls.begin(); conUrl!=urls.end(); conUrl++){
        string host= conUrl->getHost();
        int port= conUrl->getPort();
        DEBUG(LDAP_DEBUG_TRACE,"   connecting to: " << host << ":" <<
                port << endl);
        //Set the new connection's constraints-object ?
        tmpConn=new LDAPAsynConnection(host.c_str(),port);
        int err=0;

        if(rebind){ 
            auth=rebind->getRebindAuth(host, port);
        }
        if(auth){
            string dn = auth->getDN();
            string passwd = auth->getPassword();
            const char* c_dn=0;
            struct berval c_passwd = { 0, 0 };
            if(dn != ""){
                c_dn = dn.c_str();
            }
            if(passwd != ""){
                c_passwd.bv_val = const_cast<char*>(passwd.c_str());
                c_passwd.bv_len = passwd.size();
            }
            err = ldap_sasl_bind_s(tmpConn->getSessionHandle(), c_dn,
                    LDAP_SASL_SIMPLE, &c_passwd, NULL, NULL, NULL);
        } else {   
            // Do anonymous bind
            err = ldap_sasl_bind_s(tmpConn->getSessionHandle(),NULL,
                    LDAP_SASL_SIMPLE, NULL, NULL, NULL, NULL);
        }
        if( err == LDAP_SUCCESS ){
            usedUrl=conUrl;
            return tmpConn;
        }else{
            delete tmpConn;
            tmpConn=0;
        }
        auth=0;
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LDAPConnection::rename ( const std::string &  dn,
const std::string &  newRDN,
bool  delOldRDN = false,
const std::string &  newParentDN = "",
const LDAPConstraints cons = 0 
)

This method performs the ModDN-operation.

It can be used to rename or move an entry by modifing its DN.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
dnThe DN that should be modified
newRDNIf the RDN of the entry should be modified the new RDN can be put here.
delOldRDNIf the old RDN should be removed from the entry's attribute this parameter has to be "true"
newParentDNIf the entry should be moved inside the DIT, the DN of the new parent of the entry can be given here.
consA set of constraints that should be used with this request

Reimplemented from LDAPAsynConnection.

Definition at line 247 of file LDAPConnection.cpp.

                                    {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::rename" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::rename(dn,newRDN,delOldRDN, newParentDN,
                cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    switch (resCode){
        case LDAPResult::SUCCESS :
            delete res; 
            delete msg;
        break;
        case LDAPResult::REFERRAL :
        {
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }
        break;
        default :
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
    }
}

Here is the call graph for this function:

LDAPMessageQueue * LDAPAsynConnection::saslBind ( const std::string &  mech,
const std::string &  cred,
const LDAPConstraints cons = 0 
) [inherited]

Definition at line 101 of file LDAPAsynConnection.cpp.

{
    DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::saslBind()" <<  endl);
    LDAPSaslBindRequest *req = new LDAPSaslBindRequest(mech, cred, this, cons);
    try{
        LDAPMessageQueue *ret = req->sendRequest();
        return ret;
    }catch(LDAPException e){
        delete req;
        throw;
    }

}

Here is the call graph for this function:

void LDAPConnection::saslInteractiveBind ( const std::string &  mech,
int  flags = 0,
SaslInteractionHandler sih = 0,
const LDAPConstraints cons = 0 
)

Reimplemented from LDAPAsynConnection.

Definition at line 63 of file LDAPConnection.cpp.

{
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::bind" << endl);
    LDAPMessageQueue* msg=0;
    LDAPResult* res=0;
    try{
        msg = LDAPAsynConnection::saslInteractiveBind(mech, flags, sih, cons);
        res = (LDAPResult*)msg->getNext();
    }catch(LDAPException e){
        delete msg;
        delete res;
        throw;
    }
    int resCode=res->getResultCode();
    if(resCode != LDAPResult::SUCCESS) {
        if(resCode == LDAPResult::REFERRAL){
            LDAPUrlList urls = res->getReferralUrls();
            delete res;
            delete msg;
            throw LDAPReferralException(urls);
        }else{
            string srvMsg = res->getErrMsg();
            delete res;
            delete msg;
            throw LDAPException(resCode, srvMsg);
        }
    }
    delete res;
    delete msg;
}

Here is the call graph for this function:

LDAPSearchResults * LDAPConnection::search ( const std::string &  base,
int  scope = 0,
const std::string &  filter = "objectClass=*",
const StringList attrs = StringList(),
bool  attrsOnly = false,
const LDAPConstraints cons = 0 
)

This method can be used for the sync.

SEARCH-operation.

Exceptions:
LDAPReferralExceptionif a referral is received
LDAPExceptionfor any other error occuring during the operation
Parameters:
baseThe distinguished name of the starting point for the search
scopeThe scope of the search. Possible values:
LDAPAsynConnection::SEARCH_BASE,
LDAPAsynConnection::SEARCH_ONE,
LDAPAsynConnection::SEARCH_SUB
filterThe std::string representation of a search filter to use with this operation
attrsOnlytrue if only the attributes names (no values) should be returned
consA set of constraints that should be used with this request
Returns:
A pointer to a LDAPSearchResults-object that can be used to read the results of the search.

Reimplemented from LDAPAsynConnection.

Definition at line 284 of file LDAPConnection.cpp.

                                    {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPConnection::search" << endl);
    LDAPMessageQueue* msgq=0;
    LDAPResult* res=0;
    LDAPSearchResults* results= 0;
    
    try{
        results = new LDAPSearchResults();
        msgq = LDAPAsynConnection::search(base,scope, filter, attrs, attrsOnly,
                cons);
        res = results->readMessageQueue(msgq);
    }catch(LDAPException e){
        delete results; // memcheck
        delete msgq;
        throw;
    }
    if(res != 0){
        int resCode=res->getResultCode();
        switch (resCode){
            case LDAPResult::SUCCESS :
                delete res; 
                delete msgq;
                return results;
            break;
            case LDAPResult::REFERRAL :
            {
                LDAPUrlList urls = res->getReferralUrls();
                delete results; // memcheck
                delete res;
                delete msgq;
                throw LDAPReferralException(urls);
            }
            break;
            default :
                string srvMsg = res->getErrMsg();
                delete results; // memcheck
                delete res;
                delete msgq;
                throw LDAPException(resCode, srvMsg);
        }
    }        
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Change the default constraints of the connection.

cons cons New LDAPConstraints to use with the connection

Reimplemented from LDAPAsynConnection.

Definition at line 372 of file LDAPConnection.cpp.

Here is the caller graph for this function:

Start TLS on this connection.

This isn't in the constructor, because it could fail (i.e. server doesn't have SSL cert, client api wasn't compiled against OpenSSL, etc.).

Exceptions:
LDAPExceptionif the TLS Layer could not be setup correctly

Reimplemented from LDAPAsynConnection.

Definition at line 28 of file LDAPConnection.cpp.

Performs the UNBIND-operation on the destination server.

Exceptions:
LDAPExceptionin any case of an error

Reimplemented from LDAPAsynConnection.

Definition at line 97 of file LDAPConnection.cpp.

Here is the caller graph for this function:


Member Data Documentation

bool LDAPAsynConnection::m_cacheEnabled [protected, inherited]

Is caching enabled?

Definition at line 334 of file LDAPAsynConnection.h.

Constant for the Search-Operation to indicate a Base-Level Search.

Reimplemented from LDAPAsynConnection.

Definition at line 28 of file LDAPConnection.h.

Constant for the Search-Operation to indicate a One-Level Search.

Reimplemented from LDAPAsynConnection.

Definition at line 34 of file LDAPConnection.h.

Constant for the Search-Operation to indicate a Subtree Search.

Reimplemented from LDAPAsynConnection.

Definition at line 40 of file LDAPConnection.h.


The documentation for this class was generated from the following files: