]> git.sur5r.net Git - openldap/blobdiff - contrib/ldapc++/src/LDAPConnection.cpp
Merge remote branch 'origin/mdb.master'
[openldap] / contrib / ldapc++ / src / LDAPConnection.cpp
index 5facda9b6f011ecb7c67daa352bffda703d032c1..266ef9c5a0313514ddb64efd8c7cf77cd36c43c3 100644 (file)
@@ -1,5 +1,6 @@
+// $OpenLDAP$
 /*
- * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -7,7 +8,6 @@
 
 #include "LDAPResult.h"
 #include "LDAPException.h"
-#include "LDAPReferralException.h"
 #include "LDAPUrlList.h"
 
 #include "LDAPConnection.h"
@@ -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();
 }
@@ -342,3 +376,7 @@ void LDAPConnection::setConstraints(LDAPConstraints* cons){
 const LDAPConstraints* LDAPConnection::getConstraints() const{
     return LDAPAsynConnection::getConstraints();
 }
+
+TlsOptions LDAPConnection::getTlsOptions() const {
+    return LDAPAsynConnection::getTlsOptions();
+}