Back to index

openldap  2.4.31
LDAPSaslBindResult.cpp
Go to the documentation of this file.
00001 // $OpenLDAP$
00002 /*
00003  * Copyright 2007-2012 The OpenLDAP Foundation, All Rights Reserved.
00004  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
00005  */
00006 
00007 #include "debug.h"
00008 #include <lber.h>
00009 #include "LDAPRequest.h"
00010 #include "LDAPException.h"
00011 
00012 #include "LDAPResult.h"
00013 #include "LDAPSaslBindResult.h"
00014 
00015 using namespace std;
00016 
00017 LDAPSaslBindResult::LDAPSaslBindResult(const LDAPRequest* req, LDAPMessage* msg) :
00018         LDAPResult(req, msg){
00019     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPSaslBindResult::LDAPSaslBindResult()" 
00020             << std::endl);
00021     BerValue* data = 0;
00022     LDAP* lc = req->getConnection()->getSessionHandle();
00023     int err = ldap_parse_sasl_bind_result(lc, msg, &data, 0);
00024     if( err != LDAP_SUCCESS && err != LDAP_SASL_BIND_IN_PROGRESS ){
00025         ber_bvfree(data);
00026         throw LDAPException(err);
00027     }else{
00028         if(data){
00029             DEBUG(LDAP_DEBUG_TRACE, "   creds present" << std::endl);
00030             m_creds=string(data->bv_val, data->bv_len);
00031             ber_bvfree(data);
00032         } else {
00033             DEBUG(LDAP_DEBUG_TRACE, "   no creds present" << std::endl);
00034         }
00035     }
00036 }
00037 
00038 LDAPSaslBindResult::~LDAPSaslBindResult(){
00039     DEBUG(LDAP_DEBUG_DESTROY,"LDAPSaslBindResult::~LDAPSaslBindResult()" << endl);
00040 }
00041 
00042 const string& LDAPSaslBindResult::getServerCreds() const{
00043     return m_creds;
00044 }
00045