r3357 - in trunk: libmcrypto/include/libmcrypto libmcrypto/source libminisip libminisip/include libmnetutil libmnetutil/include libmnetutil/include/libmnetutil libmnetutil/source
mikaelsv at minisip.org
mikaelsv at minisip.org
Wed Aug 8 16:00:39 CEST 2007
Author: mikaelsv
Date: 2007-08-08 16:00:39 +0200 (Wed, 08 Aug 2007)
New Revision: 3357
Modified:
trunk/libmcrypto/include/libmcrypto/CacheManager.h
trunk/libmcrypto/include/libmcrypto/CertificateFinder.h
trunk/libmcrypto/include/libmcrypto/CertificatePathFinderUcd.h
trunk/libmcrypto/source/CacheManager.cxx
trunk/libmcrypto/source/CertificateFinder.cxx
trunk/libmcrypto/source/CertificatePathFinderUcd.cxx
trunk/libminisip/Makefile.am
trunk/libminisip/include/Makefile.am
trunk/libmnetutil/Makefile.am
trunk/libmnetutil/include/Makefile.am
trunk/libmnetutil/include/libmnetutil/LdapConnection.h
trunk/libmnetutil/include/libmnetutil/LdapEntry.h
trunk/libmnetutil/source/LdapConnection.cxx
trunk/libmnetutil/source/LdapEntry.cxx
Log:
* Bug fixes, precious pug fixes. The decision to move the certificate management
classes from libminisip to libmcrypto required more work than expected...
* Another fix is that libmcrypto, hopefully, no longer fails to compile due to
lack of LDAP support in libmnetutil. The new certificate management classes
require LDAP support, but instead of breaking the compilation due to missing
LDAP support they now only throw run-time exceptions.
Modified: trunk/libmcrypto/include/libmcrypto/CacheManager.h
===================================================================
--- trunk/libmcrypto/include/libmcrypto/CacheManager.h 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmcrypto/include/libmcrypto/CacheManager.h 2007-08-08 14:00:39 UTC (rev 3357)
@@ -24,13 +24,13 @@
#ifndef _CACHEMANAGER_H_
#define _CACHEMANAGER_H_
-#include <libminisip/libminisip_config.h>
+#include <libmcrypto/config.h>
+#include <libmcrypto/cert.h>
#include <libmutil/MemObject.h>
#include <libmutil/CacheItem.h>
#include <libmnetutil/DirectorySet.h>
#include <libmnetutil/DirectorySetItem.h>
-#include <libmcrypto/cert.h>
#include <string>
#include <map>
@@ -38,11 +38,11 @@
#define CACHEMANAGER_CERTSET_ROOTCAS "rootcas"
#define CACHEMANAGER_DIRSET_MAIN "main"
-class LIBMINISIP_API CacheManager : public MObject {
+class LIBMCRYPTO_API CacheManager : public MObject {
public:
CacheManager();
- //MRef<CertificateSetItem*> findCertificate();
+ MRef<Certificate*> findCertificate();
/**
* Returns a directory set item responsible for a particular domain.
@@ -88,9 +88,9 @@
//void removeFromCache(MRef<CacheItem*> item);
/**
- * @param searchText Can be either a SIP URI or an X.509 DN. If the parameter is a SIP URI then
- * the function will match the URI against the certificate's subjectAltNames.
- * Otherwise (if the parameter is not a SIP URI) the subject field is matched.
+ * @param searchText Can be either a SIP URI or an X.509 DN. If the parameter is a SIP URI then
+ * the function will match the URI against the certificate's subjectAltNames.
+ * Otherwise (if the parameter is not a SIP URI) the subject field is matched.
*/
std::vector<MRef<Certificate*> > findCertificate(const std::string searchText, const std::string issuer);
private:
@@ -99,7 +99,6 @@
std::map<std::string, MRef<DirectorySet*> > directorySets;
std::vector<MRef<Certificate*> > fakeCache;
-
};
#endif
Modified: trunk/libmcrypto/include/libmcrypto/CertificateFinder.h
===================================================================
--- trunk/libmcrypto/include/libmcrypto/CertificateFinder.h 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmcrypto/include/libmcrypto/CertificateFinder.h 2007-08-08 14:00:39 UTC (rev 3357)
@@ -24,14 +24,14 @@
#ifndef _CERTIFICATEFINDER_H_
#define _CERTIFICATEFINDER_H_
-#include <libminisip/libminisip_config.h>
+#include <libmcrypto/config.h>
#include <libmutil/MemObject.h>
#include <libmutil/Timestamp.h>
#include <libmcrypto/cert.h>
#include <libmnetutil/Downloader.h>
#include <libmnetutil/LdapDownloader.h>
-#include <libminisip/config/CacheManager.h>
+#include <libmcrypto/CacheManager.h>
#include <string>
#include <vector>
@@ -40,7 +40,7 @@
#define MAX_EFFORT -1
#endif
-class LIBMINISIP_API CertificateFinderStats : public MObject {
+class LIBMCRYPTO_API CertificateFinderStats : public MObject {
public:
CertificateFinderStats() : ldapQueries (0), ldapQueriesNoResult (0), ldapQueriesNoDirectory (0), ldapCertsDownloaded (0), dnsQueries (0), dnsQueriesNoResult (0), dnsSrvQueries (0), dnsSrvQueriesNoResult (0), certsProcessed (0), certsUseful (0), cacheQueries (0), cacheQueriesNoResult (0) { }
@@ -63,7 +63,7 @@
/**
* Finds certificates mathching certain subjects and issuers.
*/
-class LIBMINISIP_API CertificateFinder : public MObject {
+class LIBMCRYPTO_API CertificateFinder : public MObject {
public:
CertificateFinder();
Modified: trunk/libmcrypto/include/libmcrypto/CertificatePathFinderUcd.h
===================================================================
--- trunk/libmcrypto/include/libmcrypto/CertificatePathFinderUcd.h 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmcrypto/include/libmcrypto/CertificatePathFinderUcd.h 2007-08-08 14:00:39 UTC (rev 3357)
@@ -24,13 +24,13 @@
#ifndef _CERTIFICATEPATHFINDERUCD_H_
#define _CERTIFICATEPATHFINDERUCD_H_
-#include <libminisip/libminisip_config.h>
+#include <libmcrypto/config.h>
#include <libmutil/MemObject.h>
#include <libmutil/Timestamp.h>
#include <libmcrypto/cert.h>
-#include <libminisip/config/CertificateFinder.h>
-#include <libminisip/config/CacheManager.h>
+#include <libmcrypto/CertificateFinder.h>
+#include <libmcrypto/CacheManager.h>
#include <vector>
#include <string>
@@ -39,7 +39,7 @@
#define MAX_EFFORT -1
#endif
-class LIBMINISIP_API CertificatePathFinderUcd : public MObject {
+class LIBMCRYPTO_API CertificatePathFinderUcd : public MObject {
public:
CertificatePathFinderUcd(MRef<CacheManager*> cm);
~CertificatePathFinderUcd();
Modified: trunk/libmcrypto/source/CacheManager.cxx
===================================================================
--- trunk/libmcrypto/source/CacheManager.cxx 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmcrypto/source/CacheManager.cxx 2007-08-08 14:00:39 UTC (rev 3357)
@@ -22,7 +22,7 @@
*/
#include <config.h>
-#include <libminisip/config/CacheManager.h>
+#include <libmcrypto/CacheManager.h>
#include <libmutil/stringutils.h>
#include <libmcrypto/cert.h>
#include <libmnetutil/FileDownloader.h>
Modified: trunk/libmcrypto/source/CertificateFinder.cxx
===================================================================
--- trunk/libmcrypto/source/CertificateFinder.cxx 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmcrypto/source/CertificateFinder.cxx 2007-08-08 14:00:39 UTC (rev 3357)
@@ -22,7 +22,7 @@
*/
#include <config.h>
-#include <libminisip/config/CertificateFinder.h>
+#include <libmcrypto/CertificateFinder.h>
#include <libmnetutil/LdapConnection.h>
#include <libmnetutil/LdapUrl.h>
Modified: trunk/libmcrypto/source/CertificatePathFinderUcd.cxx
===================================================================
--- trunk/libmcrypto/source/CertificatePathFinderUcd.cxx 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmcrypto/source/CertificatePathFinderUcd.cxx 2007-08-08 14:00:39 UTC (rev 3357)
@@ -22,7 +22,7 @@
*/
#include <config.h>
-#include <libminisip/config/CertificatePathFinderUcd.h>
+#include <libmcrypto/CertificatePathFinderUcd.h>
#include<libmutil/SipUri.h>
#include <iostream>
Modified: trunk/libminisip/Makefile.am
===================================================================
--- trunk/libminisip/Makefile.am 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libminisip/Makefile.am 2007-08-08 14:00:39 UTC (rev 3357)
@@ -416,8 +416,6 @@
ldappb_la_LIBADD = libminisip.la $(MUTIL_LIBS) $(MNETUTIL_LIBS)
endif
-libcachemanager_src = source/subsystem_config/CacheManager.cxx
-
libminisip_la_SOURCES = source/Minisip.cxx \
source/MinisipExceptions.cxx \
$(libonlineconf_src) \
@@ -436,8 +434,7 @@
$(libzrtp_src) \
$(libsdp_src) \
$(libsoundcard_src) \
- $(libspaudio_src) \
- $(libcachemanager_src)
+ $(libspaudio_src)
libminisip_la_LIBADD += $(libsoundcard_libadd)
Modified: trunk/libminisip/include/Makefile.am
===================================================================
--- trunk/libminisip/include/Makefile.am 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libminisip/include/Makefile.am 2007-08-08 14:00:39 UTC (rev 3357)
@@ -108,7 +108,6 @@
libminisip/config/ConfBackend.h \
libminisip/config/UserConfig.h \
libminisip/config/OnlineConfBackend.h \
- libminisip/config/CacheManager.h \
libminisip/contacts/ContactDb.h \
libminisip/contacts/PhoneBook.h \
libminisip/ipprovider/SimpleIpProvider.h \
Modified: trunk/libmnetutil/Makefile.am
===================================================================
--- trunk/libmnetutil/Makefile.am 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmnetutil/Makefile.am 2007-08-08 14:00:39 UTC (rev 3357)
@@ -32,15 +32,12 @@
source/IP6ServerSocket.cxx
endif
-ldap_src =
-if ENABLE_LDAP
-ldap_src += \
+ldap_src = \
source/LdapConnection.cxx \
source/LdapEntry.cxx \
source/LdapException.cxx \
source/LdapUrl.cxx \
source/LdapDownloader.cxx
-endif
mnetutil_src = \
source/init.cxx \
Modified: trunk/libmnetutil/include/Makefile.am
===================================================================
--- trunk/libmnetutil/include/Makefile.am 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmnetutil/include/Makefile.am 2007-08-08 14:00:39 UTC (rev 3357)
@@ -1,6 +1,4 @@
-ldap_src =
-if ENABLE_LDAP
-ldap_src += \
+ldap_src = \
libmnetutil/LdapConnection.h \
libmnetutil/LdapCredentials.h \
libmnetutil/LdapDirectoryLocator.h \
@@ -8,7 +6,6 @@
libmnetutil/LdapException.h \
libmnetutil/LdapUrl.h \
libmnetutil/LdapDownloader.h
-endif
pkginclude_HEADERS = \
$(ldap_src) \
Modified: trunk/libmnetutil/include/libmnetutil/LdapConnection.h
===================================================================
--- trunk/libmnetutil/include/libmnetutil/LdapConnection.h 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmnetutil/include/libmnetutil/LdapConnection.h 2007-08-08 14:00:39 UTC (rev 3357)
@@ -21,14 +21,11 @@
#include<libmnetutil/libmnetutil_config.h>
-#include <ldap.h>
-
#include <libmutil/MemObject.h>
#include <libmnetutil/LdapException.h>
#include <libmnetutil/LdapCredentials.h>
#include <libmnetutil/LdapEntry.h>
-#include <ldap.h>
#include <string>
#include <vector>
@@ -72,7 +69,8 @@
* @param scope The scope of the search. Possible values: LDAP_SCOPE_SUBTREE, LDAP_SCOPE_BASE or LDAP_SCOPE_ONE.
* @return A vector containing LdapEntry instances. Each LdapEntry represents a returned object and each instance is already populated with the appropriate values when returned.
*/
- std::vector<MRef<LdapEntry*> > find(std::string baseDn, std::string query, std::vector<std::string> & attrs, int scope = LDAP_SCOPE_SUBTREE) throw (LdapNotConnectedException, LdapException);
+ std::vector<MRef<LdapEntry*> > find(std::string baseDn, std::string query, std::vector<std::string> & attrs) throw (LdapNotConnectedException, LdapException);
+ std::vector<MRef<LdapEntry*> > find(std::string baseDn, std::string query, std::vector<std::string> & attrs, int scope) throw (LdapNotConnectedException, LdapException);
/**
* Determine the base DN of the connected server.
@@ -97,7 +95,8 @@
*/
//LDAP* getLdapObject();
private:
- LDAP* ld;
+ //LDAP* ld;
+ void* ld;
std::string hostname;
int32_t port;
MRef<LdapCredentials*> cred;
Modified: trunk/libmnetutil/include/libmnetutil/LdapEntry.h
===================================================================
--- trunk/libmnetutil/include/libmnetutil/LdapEntry.h 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmnetutil/include/libmnetutil/LdapEntry.h 2007-08-08 14:00:39 UTC (rev 3357)
@@ -21,8 +21,6 @@
#include<libmnetutil/libmnetutil_config.h>
-#include <ldap.h>
-#include <lber.h>
#include <libmnetutil/LdapException.h>
#include <libmutil/MemObject.h>
#include <libmutil/stringutils.h>
@@ -77,7 +75,7 @@
*/
class LIBMNETUTIL_API LdapEntry : public MObject {
public:
- LdapEntry(LDAP* ld, LDAPMessage* entry);
+ LdapEntry(void* ld, void* entry);
//~LdapEntry();
/**
Modified: trunk/libmnetutil/source/LdapConnection.cxx
===================================================================
--- trunk/libmnetutil/source/LdapConnection.cxx 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmnetutil/source/LdapConnection.cxx 2007-08-08 14:00:39 UTC (rev 3357)
@@ -24,20 +24,41 @@
#include <config.h>
#include <libmnetutil/LdapConnection.h>
+#ifdef ENABLE_LDAP
+ #include <ldap.h>
+#endif
+
LdapConnection::LdapConnection(std::string host, int32_t port) {
+#ifdef ENABLE_LDAP
init(host, port, NULL);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
LdapConnection::LdapConnection(std::string host) {
+#ifdef ENABLE_LDAP
init(host, LDAP_PORT, NULL);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
LdapConnection::LdapConnection(std::string host, int32_t port, MRef<LdapCredentials*> cred) {
+#ifdef ENABLE_LDAP
init(host, port, cred);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
LdapConnection::LdapConnection(std::string host, MRef<LdapCredentials*> cred) {
+#ifdef ENABLE_LDAP
init(host, LDAP_PORT, cred);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
void LdapConnection::init(std::string host, int aPort, MRef<LdapCredentials*> aCred){
+#ifdef ENABLE_LDAP
hostname = host;
port = aPort;
cred = aCred;
@@ -49,28 +70,48 @@
} catch (LdapException & e) {
//std::cerr << e.what() << std::endl;
}
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
LdapConnection::~LdapConnection() {
+#ifdef ENABLE_LDAP
disconnect();
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
bool LdapConnection::isConnected(bool alsoCheckBind) {
+#ifdef ENABLE_LDAP
if (NULL == ld)
return false;
if (alsoCheckBind && !isBound)
return false;
return true;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
void LdapConnection::setCredentials(MRef<LdapCredentials*> cred) {
+#ifdef ENABLE_LDAP
this->cred = cred;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
MRef<LdapCredentials*> LdapConnection::getCredentials() {
+#ifdef ENABLE_LDAP
return cred;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
/**
* Some of this code has been copied from an unknown source.
*/
void LdapConnection::connect() throw (LdapException) {
+#ifdef ENABLE_LDAP
int auth_method = LDAP_AUTH_SIMPLE;
int desired_version = LDAP_VERSION3;
@@ -84,7 +125,7 @@
}
// Set protocol version
- if (ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version) != LDAP_OPT_SUCCESS) {
+ if (ldap_set_option((LDAP*)ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version) != LDAP_OPT_SUCCESS) {
throw LdapException("Could not set connection options after setting up connection");
}
@@ -97,23 +138,38 @@
pass = cred->password.c_str();
}
- if (ldap_bind_s(ld, user, pass, auth_method) != LDAP_SUCCESS) {
+ if (ldap_bind_s((LDAP*)ld, user, pass, auth_method) != LDAP_SUCCESS) {
throw LdapException("Could not bind to connected server");
}
isBound = true;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
bool LdapConnection::disconnect() {
+#ifdef ENABLE_LDAP
if (isBound) {
- ldap_unbind(ld);
+ ldap_unbind((LDAP*)ld);
}
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
/**
* Some of this code has been copied from an unknown source.
*/
+std::vector<MRef<LdapEntry*> > LdapConnection::find(std::string baseDn, std::string query, std::vector<std::string> & attrs) throw (LdapNotConnectedException, LdapException) {
+#ifdef ENABLE_LDAP
+ return find(baseDn, query, attrs, LDAP_SCOPE_SUBTREE);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
+}
std::vector<MRef<LdapEntry*> > LdapConnection::find(std::string baseDn, std::string query, std::vector<std::string> & attrs, int scope) throw (LdapNotConnectedException, LdapException) {
+#ifdef ENABLE_LDAP
LDAPMessage* msg;
std::vector<MRef<LdapEntry*> > entries = std::vector<MRef<LdapEntry*> >();
char* searchAttrs[attrs.size()+1];
@@ -135,7 +191,7 @@
searchAttrs[attrs.size()] = NULL;
// Send query (note that it is blocking!)
- if (ldap_search_s(ld, baseDn.c_str(), scope, query.c_str(), searchAttrs, 0, &msg) != LDAP_SUCCESS)
+ if (ldap_search_s((LDAP*)ld, baseDn.c_str(), scope, query.c_str(), searchAttrs, 0, &msg) != LDAP_SUCCESS)
{
// Return empty list
throw LdapException("LdapException: Could not execute query");
@@ -143,10 +199,10 @@
// Push each returned object (entry) onto the result vector
- for( entry = ldap_first_entry(ld, msg);entry != NULL; entry = ldap_next_entry(ld,entry))
+ for( entry = ldap_first_entry((LDAP*)ld, msg);entry != NULL; entry = ldap_next_entry((LDAP*)ld,entry))
{
// Parse the returned entry directly (don't wait until the user actually "needs" it)
- entries.push_back(MRef<LdapEntry*>(new LdapEntry(ld, entry)));
+ entries.push_back(MRef<LdapEntry*>(new LdapEntry((LDAP*)ld, entry)));
}
@@ -154,9 +210,13 @@
ldap_msgfree(msg);
return std::vector<MRef<LdapEntry*> >(entries);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
std::string LdapConnection::getBaseDn() throw (LdapNotConnectedException, LdapUnsupportedException) {
+#ifdef ENABLE_LDAP
if (!isConnected()) {
throw LdapNotConnectedException();
@@ -177,6 +237,9 @@
throw LdapUnsupportedException("Retrieving base DN");
}
}
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
/*
LDAP* LdapConnection::getLdapObject() {
Modified: trunk/libmnetutil/source/LdapEntry.cxx
===================================================================
--- trunk/libmnetutil/source/LdapEntry.cxx 2007-08-08 09:34:50 UTC (rev 3356)
+++ trunk/libmnetutil/source/LdapEntry.cxx 2007-08-08 14:00:39 UTC (rev 3357)
@@ -23,9 +23,16 @@
#include <config.h>
#include <libmnetutil/LdapEntry.h>
+
+#ifdef ENABLE_LDAP
+ #include <ldap.h>
+ #include <lber.h>
+#endif
+
#include <string>
-LdapEntry::LdapEntry(LDAP* ld, LDAPMessage* entry) {
+LdapEntry::LdapEntry(void* ld, void* entry) {
+#ifdef ENABLE_LDAP
BerElement* ber;
struct berval** binaries;
char* attr;
@@ -35,14 +42,14 @@
valuesBinary.clear();
valuesStrings.clear();
- for( attr = ldap_first_attribute(ld, entry, &ber); attr != NULL; attr = ldap_next_attribute(ld, entry, ber)) {
+ for( attr = ldap_first_attribute((LDAP*)ld, (LDAPMessage*)entry, &ber); attr != NULL; attr = ldap_next_attribute((LDAP*)ld, (LDAPMessage*)entry, ber)) {
std::string attrName(attr);
// Separate binary attributes from the rest simply to testing what the returned attribute is called. Simple and effective.
if (stringEndsWith(attr, ";binary")) {
// Process binary attributes
- if ((binaries = ldap_get_values_len(ld, entry, attr)) != NULL) {
+ if ((binaries = ldap_get_values_len((LDAP*)ld, (LDAPMessage*)entry, attr)) != NULL) {
for (i=0; binaries[i] != NULL; i++) {
valuesBinary[attrName].push_back(MRef<LdapEntryBinaryValue*>(new LdapEntryBinaryValue(binaries[i]->bv_val, binaries[i]->bv_len)));
}
@@ -50,7 +57,7 @@
}
} else {
// Process string attributes
- if ((strings = ldap_get_values(ld, entry, attr)) != NULL) {
+ if ((strings = ldap_get_values((LDAP*)ld, (LDAPMessage*)entry, attr)) != NULL) {
for (i = 0; strings[i] != NULL; i++) {
valuesStrings[attrName].push_back(std::string(strings[i]));
}
@@ -62,9 +69,13 @@
if (ber != NULL) {
ber_free(ber,0);
}
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
bool LdapEntry::hasAttribute(std::string attr) {
+#ifdef ENABLE_LDAP
std::map<std::string, std::vector<MRef<LdapEntryBinaryValue*> > >::iterator binaryIter = valuesBinary.find(attr);
std::map<std::string, std::vector<std::string> >::iterator stringIter = valuesStrings.find(attr);
@@ -73,9 +84,13 @@
}
return false;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
std::string LdapEntry::getAttrValueString(std::string attr) throw (LdapAttributeNotFoundException) {
+#ifdef ENABLE_LDAP
std::map<std::string, std::vector<std::string> >::iterator stringIter = valuesStrings.find(attr);
if (stringIter != valuesStrings.end()) {
@@ -83,8 +98,12 @@
}
throw LdapAttributeNotFoundException(attr);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
std::vector<std::string> LdapEntry::getAttrValuesStrings(std::string attr) throw (LdapAttributeNotFoundException) {
+#ifdef ENABLE_LDAP
std::map<std::string, std::vector<std::string> >::iterator i = valuesStrings.find(attr);
if (i != valuesStrings.end()) {
@@ -92,8 +111,12 @@
}
throw LdapAttributeNotFoundException(attr);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
std::vector< MRef<LdapEntryBinaryValue*> > LdapEntry::getAttrValuesBinary(std::string attr) throw (LdapAttributeNotFoundException) {
+#ifdef ENABLE_LDAP
std::map<std::string, std::vector<MRef<LdapEntryBinaryValue*> > >::iterator i = valuesBinary.find(attr);
if (i != valuesBinary.end()) {
@@ -102,8 +125,12 @@
throw LdapAttributeNotFoundException(attr);
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
std::vector< MRef<LdapEntryBinaryPairValue*> > LdapEntry::getAttrValuesBinaryPairs(std::string attr) throw (LdapAttributeNotFoundException) {
+#ifdef ENABLE_LDAP
std::vector< MRef<LdapEntryBinaryValue*> > rawBinary;
std::vector< MRef<LdapEntryBinaryValue*> >::iterator rawIter;
std::vector< MRef<LdapEntryBinaryPairValue*> > result;
@@ -167,9 +194,13 @@
throw; // Re-throw exception
}
return result;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
std::vector<std::string> LdapEntry::getAttrNames() {
+#ifdef ENABLE_LDAP
std::vector<std::string> res;
std::map<std::string, std::vector<std::string> >::iterator i;
std::map<std::string, std::vector<MRef<LdapEntryBinaryValue*> > >::iterator j;
@@ -181,4 +212,7 @@
res.push_back(j->first);
return res;
+#else
+ throw LdapException("LDAP support not enabled");
+#endif
}
More information about the Minisip-devel
mailing list