2000-09-02 02:46:32 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "LDAPSearchReference.h"
|
|
|
|
#include "LDAPException.h"
|
|
|
|
#include "LDAPRequest.h"
|
|
|
|
#include "LDAPUrl.h"
|
|
|
|
|
2001-09-29 00:39:58 +08:00
|
|
|
using namespace std;
|
|
|
|
|
2000-10-04 02:25:34 +08:00
|
|
|
LDAPSearchReference::LDAPSearchReference(const LDAPRequest *req,
|
|
|
|
LDAPMessage *msg) : LDAPMsg(msg){
|
|
|
|
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
|
|
|
"LDAPSearchReference::LDAPSearchReference()" << endl;)
|
2000-09-02 02:46:32 +08:00
|
|
|
char **ref=0;
|
2000-10-04 02:25:34 +08:00
|
|
|
LDAPControl** srvctrls=0;
|
2000-09-02 02:46:32 +08:00
|
|
|
const LDAPAsynConnection* con=req->getConnection();
|
2000-10-04 02:25:34 +08:00
|
|
|
int err = ldap_parse_reference(con->getSessionHandle(), msg, &ref,
|
|
|
|
&srvctrls,0);
|
2000-09-02 02:46:32 +08:00
|
|
|
if (err != LDAP_SUCCESS){
|
2005-10-06 01:26:27 +08:00
|
|
|
ber_memvfree((void**) ref);
|
2000-10-04 02:25:34 +08:00
|
|
|
ldap_controls_free(srvctrls);
|
2000-09-02 02:46:32 +08:00
|
|
|
throw LDAPException(err);
|
|
|
|
}else{
|
2000-10-04 02:25:34 +08:00
|
|
|
m_urlList=LDAPUrlList(ref);
|
2005-10-06 01:26:27 +08:00
|
|
|
ber_memvfree((void**) ref);
|
2000-10-04 02:25:34 +08:00
|
|
|
if (srvctrls){
|
|
|
|
m_srvControls = LDAPControlSet(srvctrls);
|
|
|
|
m_hasControls = true;
|
|
|
|
ldap_controls_free(srvctrls);
|
|
|
|
}else{
|
|
|
|
m_hasControls = false;
|
2000-09-02 02:46:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LDAPSearchReference::~LDAPSearchReference(){
|
2000-10-04 02:25:34 +08:00
|
|
|
DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchReference::~LDAPSearchReference()"
|
|
|
|
<< endl);
|
2000-09-02 02:46:32 +08:00
|
|
|
}
|
|
|
|
|
2000-10-04 02:25:34 +08:00
|
|
|
const LDAPUrlList& LDAPSearchReference::getUrls() const{
|
|
|
|
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchReference::getUrls()" << endl);
|
|
|
|
return m_urlList;
|
2000-09-02 02:46:32 +08:00
|
|
|
}
|
|
|
|
|