1 // $OpenLDAP$
2 /*
3 * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5 */
6
7 #include "debug.h"
8 #include <lber.h>
9 #include "LDAPRequest.h"
10 #include "LDAPException.h"
11
12 #include "LDAPResult.h"
13 #include "LDAPExtResult.h"
14
15 using namespace std;
16
LDAPExtResult(const LDAPRequest * req,LDAPMessage * msg)17 LDAPExtResult::LDAPExtResult(const LDAPRequest* req, LDAPMessage* msg) :
18 LDAPResult(req, msg){
19 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPExtResult::LDAPExtResult()" << endl);
20 char* oid = 0;
21 BerValue* data = 0;
22 LDAP* lc = req->getConnection()->getSessionHandle();
23 int err=ldap_parse_extended_result(lc, msg, &oid, &data, 0);
24 if(err != LDAP_SUCCESS){
25 ber_bvfree(data);
26 ldap_memfree(oid);
27 throw LDAPException(err);
28 }else{
29 m_oid=string(oid);
30 ldap_memfree(oid);
31 if(data){
32 m_data=string(data->bv_val, data->bv_len);
33 ber_bvfree(data);
34 }
35 }
36 }
37
~LDAPExtResult()38 LDAPExtResult::~LDAPExtResult(){
39 DEBUG(LDAP_DEBUG_DESTROY,"LDAPExtResult::~LDAPExtResult()" << endl);
40 }
41
getResponseOid() const42 const string& LDAPExtResult::getResponseOid() const{
43 return m_oid;
44 }
45
getResponse() const46 const string& LDAPExtResult::getResponse() const{
47 return m_data;
48 }
49
50