diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:35:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:35:32 +0000 |
commit | 5ea77a75dd2d2158401331879f3c8f47940a732c (patch) | |
tree | d89dc06e9f4850a900f161e25f84e922c4f86cc8 /contrib/ldapc++/src/LDAPSaslBindResult.cpp | |
parent | Initial commit. (diff) | |
download | openldap-upstream.tar.xz openldap-upstream.zip |
Adding upstream version 2.5.13+dfsg.upstream/2.5.13+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/ldapc++/src/LDAPSaslBindResult.cpp')
-rw-r--r-- | contrib/ldapc++/src/LDAPSaslBindResult.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/ldapc++/src/LDAPSaslBindResult.cpp b/contrib/ldapc++/src/LDAPSaslBindResult.cpp new file mode 100644 index 0000000..ae15cfb --- /dev/null +++ b/contrib/ldapc++/src/LDAPSaslBindResult.cpp @@ -0,0 +1,45 @@ +// $OpenLDAP$ +/* + * Copyright 2007-2022 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "debug.h" +#include <lber.h> +#include "LDAPRequest.h" +#include "LDAPException.h" + +#include "LDAPResult.h" +#include "LDAPSaslBindResult.h" + +using namespace std; + +LDAPSaslBindResult::LDAPSaslBindResult(const LDAPRequest* req, LDAPMessage* msg) : + LDAPResult(req, msg){ + DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPSaslBindResult::LDAPSaslBindResult()" + << std::endl); + BerValue* data = 0; + LDAP* lc = req->getConnection()->getSessionHandle(); + int err = ldap_parse_sasl_bind_result(lc, msg, &data, 0); + if( err != LDAP_SUCCESS && err != LDAP_SASL_BIND_IN_PROGRESS ){ + ber_bvfree(data); + throw LDAPException(err); + }else{ + if(data){ + DEBUG(LDAP_DEBUG_TRACE, " creds present" << std::endl); + m_creds=string(data->bv_val, data->bv_len); + ber_bvfree(data); + } else { + DEBUG(LDAP_DEBUG_TRACE, " no creds present" << std::endl); + } + } +} + +LDAPSaslBindResult::~LDAPSaslBindResult(){ + DEBUG(LDAP_DEBUG_DESTROY,"LDAPSaslBindResult::~LDAPSaslBindResult()" << endl); +} + +const string& LDAPSaslBindResult::getServerCreds() const{ + return m_creds; +} + |