From 7731832751ab9f3c6ddeb66f186d3d7fa1934a6d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 13:11:40 +0200 Subject: Adding upstream version 2.4.57+dfsg. Signed-off-by: Daniel Baumann --- contrib/ldapc++/src/LDAPExtResult.cpp | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 contrib/ldapc++/src/LDAPExtResult.cpp (limited to 'contrib/ldapc++/src/LDAPExtResult.cpp') diff --git a/contrib/ldapc++/src/LDAPExtResult.cpp b/contrib/ldapc++/src/LDAPExtResult.cpp new file mode 100644 index 0000000..164a86c --- /dev/null +++ b/contrib/ldapc++/src/LDAPExtResult.cpp @@ -0,0 +1,49 @@ +// $OpenLDAP$ +/* + * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "debug.h" +#include +#include "LDAPRequest.h" +#include "LDAPException.h" + +#include "LDAPResult.h" +#include "LDAPExtResult.h" + +using namespace std; + +LDAPExtResult::LDAPExtResult(const LDAPRequest* req, LDAPMessage* msg) : + LDAPResult(req, msg){ + DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPExtResult::LDAPExtResult()" << endl); + char* oid = 0; + BerValue* data = 0; + LDAP* lc = req->getConnection()->getSessionHandle(); + int err=ldap_parse_extended_result(lc, msg, &oid, &data, 0); + if(err != LDAP_SUCCESS){ + ber_bvfree(data); + ldap_memfree(oid); + throw LDAPException(err); + }else{ + m_oid=string(oid); + ldap_memfree(oid); + if(data){ + m_data=string(data->bv_val, data->bv_len); + ber_bvfree(data); + } + } +} + +LDAPExtResult::~LDAPExtResult(){ + DEBUG(LDAP_DEBUG_DESTROY,"LDAPExtResult::~LDAPExtResult()" << endl); +} + +const string& LDAPExtResult::getResponseOid() const{ + return m_oid; +} + +const string& LDAPExtResult::getResponse() const{ + return m_data; +} + -- cgit v1.2.3