2000-09-01 14:46:32 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
|
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "LDAPUrl.h"
|
2000-10-03 14:25:34 -04:00
|
|
|
|
2000-09-01 14:46:32 -04:00
|
|
|
#include <ldap.h>
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
LDAPUrl::LDAPUrl(const char *url){
|
|
|
|
|
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPUrl::LDAPUrl()" << endl);
|
|
|
|
|
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
|
|
|
|
" url:" << url << endl);
|
2000-09-01 14:46:32 -04:00
|
|
|
if (ldap_is_ldap_url(url)){
|
2000-10-03 14:25:34 -04:00
|
|
|
LDAPURLDesc *urlDesc;
|
|
|
|
|
ldap_url_parse(url, &urlDesc);
|
|
|
|
|
if(urlDesc->lud_host){
|
|
|
|
|
m_Host = string(urlDesc->lud_host);
|
|
|
|
|
}
|
|
|
|
|
m_Port = urlDesc->lud_port;
|
|
|
|
|
if(urlDesc->lud_dn){
|
|
|
|
|
m_DN = string(urlDesc->lud_dn);
|
|
|
|
|
}
|
|
|
|
|
m_Attrs = StringList(urlDesc->lud_attrs);
|
|
|
|
|
m_Scope = urlDesc->lud_scope;
|
|
|
|
|
if(urlDesc->lud_filter){
|
|
|
|
|
m_Filter = string(urlDesc->lud_filter);
|
|
|
|
|
}else{
|
|
|
|
|
m_Filter = "";
|
|
|
|
|
}
|
|
|
|
|
m_urlString= string(url);
|
|
|
|
|
ldap_free_urldesc(urlDesc);
|
2000-09-01 14:46:32 -04:00
|
|
|
}else{
|
|
|
|
|
DEBUG(LDAP_DEBUG_TRACE," noUrl:" << url << endl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LDAPUrl::~LDAPUrl(){
|
2000-10-03 14:25:34 -04:00
|
|
|
DEBUG(LDAP_DEBUG_DESTROY, "LDAPUrl::~LDAPUrl()" << endl);
|
|
|
|
|
m_Attrs.clear();
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int LDAPUrl::getPort() const {
|
2000-10-03 14:25:34 -04:00
|
|
|
return m_Port;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int LDAPUrl::getScope() const {
|
2000-10-03 14:25:34 -04:00
|
|
|
return m_Scope;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
const string& LDAPUrl::getURLString() const {
|
|
|
|
|
return m_urlString;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
const string& LDAPUrl::getHost() const {
|
|
|
|
|
return m_Host;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
const string& LDAPUrl::getDN() const {
|
|
|
|
|
return m_DN;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
const string& LDAPUrl::getFilter() const {
|
|
|
|
|
return m_Filter;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|
2000-10-03 14:25:34 -04:00
|
|
|
const StringList& LDAPUrl::getAttrs() const {
|
|
|
|
|
return m_Attrs;
|
2000-09-01 14:46:32 -04:00
|
|
|
}
|
|
|
|
|
|