2000-09-01 14:46:32 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
|
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
#include "debug.h"
|
2000-10-11 13:18:27 -04:00
|
|
|
#include "LDAPSearchResult.h"
|
2000-09-01 14:46:32 -04:00
|
|
|
#include "LDAPRequest.h"
|
|
|
|
|
|
2001-09-28 12:39:58 -04:00
|
|
|
using namespace std;
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
LDAPSearchResult::LDAPSearchResult(const LDAPRequest *req,
|
|
|
|
|
LDAPMessage *msg) : LDAPMsg(msg){
|
2001-09-28 12:39:58 -04:00
|
|
|
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
|
|
|
|
"LDAPSearchResult::LDAPSearchResult()" << endl);
|
2000-09-01 14:46:32 -04:00
|
|
|
entry = new LDAPEntry(req->getConnection(), msg);
|
2000-10-03 14:25:34 -04:00
|
|
|
//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));
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LDAPSearchResult::~LDAPSearchResult(){
|
2000-10-03 14:25:34 -04:00
|
|
|
DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchResult::~LDAPSearchResult()" << endl);
|
2000-09-01 14:46:32 -04:00
|
|
|
delete entry;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
const LDAPEntry* LDAPSearchResult::getEntry() const{
|
2000-09-01 14:46:32 -04:00
|
|
|
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::getEntry()" << endl);
|
|
|
|
|
return entry;
|
|
|
|
|
}
|
|
|
|
|
|