| 1 |
// $OpenLDAP$ |
| 2 |
/* |
| 3 |
* Copyright 2000-2024 The OpenLDAP Foundation, All Rights Reserved. |
| 4 |
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file |
| 5 |
*/ |
| 6 |
|
| 7 |
|
| 8 |
#include <iostream> |
| 9 |
|
| 10 |
#include "debug.h" |
| 11 |
#include "LDAPSearchReference.h" |
| 12 |
#include "LDAPException.h" |
| 13 |
#include "LDAPRequest.h" |
| 14 |
#include "LDAPUrl.h" |
| 15 |
|
| 16 |
using namespace std; |
| 17 |
|
| 18 |
LDAPSearchReference::LDAPSearchReference(const LDAPRequest *req, |
| 19 |
LDAPMessage *msg) : LDAPMsg(msg){ |
| 20 |
DEBUG(LDAP_DEBUG_CONSTRUCT, |
| 21 |
"LDAPSearchReference::LDAPSearchReference()" << endl;) |
| 22 |
char **ref=0; |
| 23 |
LDAPControl** srvctrls=0; |
| 24 |
const LDAPAsynConnection* con=req->getConnection(); |
| 25 |
int err = ldap_parse_reference(con->getSessionHandle(), msg, &ref, |
| 26 |
&srvctrls,0); |
| 27 |
if (err != LDAP_SUCCESS){ |
| 28 |
ber_memvfree((void**) ref); |
| 29 |
ldap_controls_free(srvctrls); |
| 30 |
throw LDAPException(err); |
| 31 |
}else{ |
| 32 |
m_urlList=LDAPUrlList(ref); |
| 33 |
ber_memvfree((void**) ref); |
| 34 |
if (srvctrls){ |
| 35 |
m_srvControls = LDAPControlSet(srvctrls); |
| 36 |
m_hasControls = true; |
| 37 |
ldap_controls_free(srvctrls); |
| 38 |
}else{ |
| 39 |
m_hasControls = false; |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
LDAPSearchReference::~LDAPSearchReference(){ |
| 45 |
DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchReference::~LDAPSearchReference()" |
| 46 |
<< endl); |
| 47 |
} |
| 48 |
|
| 49 |
const LDAPUrlList& LDAPSearchReference::getUrls() const{ |
| 50 |
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchReference::getUrls()" << endl); |
| 51 |
return m_urlList; |
| 52 |
} |
| 53 |
|