From c000cad09d0b54c455c99271bfb996c2dfe13073 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 03:23:53 +0200 Subject: Adding upstream version 2.4.47+dfsg. Signed-off-by: Daniel Baumann --- contrib/ldapc++/src/LDAPSearchResult.cpp | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 contrib/ldapc++/src/LDAPSearchResult.cpp (limited to 'contrib/ldapc++/src/LDAPSearchResult.cpp') diff --git a/contrib/ldapc++/src/LDAPSearchResult.cpp b/contrib/ldapc++/src/LDAPSearchResult.cpp new file mode 100644 index 0000000..f904515 --- /dev/null +++ b/contrib/ldapc++/src/LDAPSearchResult.cpp @@ -0,0 +1,52 @@ +// $OpenLDAP$ +/* + * Copyright 2000-2018 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + + +#include + +#include "debug.h" +#include "LDAPSearchResult.h" +#include "LDAPRequest.h" + +using namespace std; + +LDAPSearchResult::LDAPSearchResult(const LDAPRequest *req, + LDAPMessage *msg) : LDAPMsg(msg){ + DEBUG(LDAP_DEBUG_CONSTRUCT, + "LDAPSearchResult::LDAPSearchResult()" << endl); + entry = new LDAPEntry(req->getConnection(), msg); + //retrieve the controls here + LDAPControl** srvctrls=0; + int err = ldap_get_entry_controls(req->getConnection()->getSessionHandle(), + msg,&srvctrls); + if(err != LDAP_SUCCESS){ + ldap_controls_free(srvctrls); + }else{ + if (srvctrls){ + m_srvControls = LDAPControlSet(srvctrls); + m_hasControls = true; + ldap_controls_free(srvctrls); + }else{ + m_hasControls = false; + } + } +} + +LDAPSearchResult::LDAPSearchResult(const LDAPSearchResult& res) : + LDAPMsg(res){ + entry = new LDAPEntry(*(res.entry)); +} + +LDAPSearchResult::~LDAPSearchResult(){ + DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchResult::~LDAPSearchResult()" << endl); + delete entry; +} + +const LDAPEntry* LDAPSearchResult::getEntry() const{ + DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::getEntry()" << endl); + return entry; +} + -- cgit v1.2.3