SASL support for LDAPConnection

This commit is contained in:
Ralf Haferkamp 2008-04-01 16:35:42 +00:00
parent 8cb162ef44
commit ee846c174c
2 changed files with 38 additions and 0 deletions

View File

@ -60,6 +60,40 @@ void LDAPConnection::bind(const string& dn, const string& passwd,
delete msg; // memcheck
}
void LDAPConnection::saslInteractiveBind( const std::string &mech,
int flags,
SaslInteractionHandler *sih,
const LDAPConstraints *cons)
{
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;
}
void LDAPConnection::unbind(){
LDAPAsynConnection::unbind();
}

View File

@ -89,6 +89,10 @@ class LDAPConnection : private LDAPAsynConnection {
*/
void bind(const std::string& dn="", const std::string& passwd="",
LDAPConstraints* cons=0);
void saslInteractiveBind(const std::string& mech,
int flags=0,
SaslInteractionHandler *sih=0,
const LDAPConstraints *cons=0);
/**
* Performs the UNBIND-operation on the destination server