Commit c0dbaa73 authored by Ralf Haferkamp's avatar Ralf Haferkamp
Browse files

some changes to make the library working with gcc 3.0 (mostly namespace

stuff). See also ITS#1322
parent a1ecd9b6
......@@ -80,9 +80,9 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ./src/config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = README AUTHORS INSTALL Makefile.am Makefile.in TODO \
aclocal.m4 config.guess config.sub configure configure.in install-sh \
ltconfig ltmain.sh missing mkinstalldirs
DIST_COMMON = README AUTHORS Makefile.am Makefile.in TODO aclocal.m4 \
config.guess config.sub configure configure.in install-sh ltconfig \
ltmain.sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
......@@ -241,7 +241,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
......
This diff is collapsed.
......@@ -5,8 +5,8 @@ dnl COPYING RESTRICTIONS APPLY, see COPYRIGHT file
dnl Process this file with autoconf to produce a configure script.
dnl disable config.cache
define([AC_CACHE_LOAD], )
define([AC_CACHE_SAVE], )
dnl define([AC_CACHE_LOAD], )
dnl define([AC_CACHE_SAVE], )
AC_INIT(src/main.cpp)
AM_INIT_AUTOMAKE(main, 0.0.1)
......@@ -17,7 +17,7 @@ dnl Checks for programs.
AC_PROG_INSTALL
dnl AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
dnl AC_PROG_RANLIB
dnl AM_DISABLE_SHARED
AM_PROG_LIBTOOL
dnl AC_PROG_MAKE_SET
......@@ -45,6 +45,8 @@ AC_ARG_WITH(ldap-includes,[ --with-ldap-includes=DIR Path to the libldap inc
dnl Checks for libraries.
AC_CHECK_LIB(resolv,main)
AC_CHECK_LIB(lber,ber_strdup,[
dnl NOOP
:
],[
echo " didn't find ber_strdup in liblber !";
echo " Check for the right version (>= 2.0) of the OpenLDAP libraries";
......@@ -52,6 +54,8 @@ AC_CHECK_LIB(lber,ber_strdup,[
exit
])
AC_CHECK_LIB(ldap,ldap_add_ext,[
dnl NOOP
:
],[
echo " didn't find ldap_add_ext in libldap !";
echo " Check for the right version (>= 2.0) of the OpenLDAP libraries";
......@@ -64,6 +68,8 @@ dnl Checks for header files.
AC_HEADER_TIME
AC_CHECK_HEADER(ldap.h)
AC_EGREP_HEADER(ldap_add_ext,ldap.h,[
dnl NOOP
:
],[
echo " didn't find ldap_add_ext in ldap.h!";
echo " Check for the right version (>= 2.0) of the OpenLDAP includes";
......@@ -72,6 +78,8 @@ AC_EGREP_HEADER(ldap_add_ext,ldap.h,[
])
AC_CHECK_HEADER(lber.h)
AC_EGREP_HEADER(ber_strdup,lber.h,[
dnl NOOP
:
],[
echo " didn't find ber_strdup in lber.h!";
echo " Check for the right version (>= 2.0) of the OpenLDAP includes";
......
......@@ -14,6 +14,8 @@
#include "LDAPMessageQueue.h"
#include "LDAPResult.h"
using namespace std;
LDAPAddRequest::LDAPAddRequest(const LDAPAddRequest& req) :
LDAPRequest(req){
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAddRequest::LDAPAddRequest(&)" << endl);
......
......@@ -22,6 +22,8 @@
#include "LDAPRebindAuth.h"
#include "LDAPSearchRequest.h"
using namespace std;
LDAPAsynConnection::LDAPAsynConnection(const string& hostname, int port,
LDAPConstraints *cons ){
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPAsynConnection::LDAPAsynConnection()"
......
......@@ -70,7 +70,7 @@ class LDAPAsynConnection{
* @param cons Default constraints to use with operations over
* this connection
*/
LDAPAsynConnection(const string& hostname=string("localhost"),
LDAPAsynConnection(const std::string& hostname=std::string("localhost"),
int port=389, LDAPConstraints *cons=new LDAPConstraints() );
//* Destructor
......@@ -87,7 +87,7 @@ class LDAPAsynConnection{
* LDAP-Server
* @param port The Network Port the server is running on
*/
void init(const string& hostname, int port);
void init(const std::string& hostname, int port);
/**
* Start TLS on this connection. This isn't in the constructor,
......@@ -107,7 +107,7 @@ class LDAPAsynConnection{
* @param dn the distiguished name to bind as
* @param passwd cleartext password to use
*/
LDAPMessageQueue* bind(const string& dn="", const string& passwd="",
LDAPMessageQueue* bind(const std::string& dn="", const std::string& passwd="",
const LDAPConstraints *cons=0);
/** Performing a search on a directory tree.
......@@ -122,15 +122,15 @@ class LDAPAsynConnection{
* LDAPAsynConnection::SEARCH_BASE, <BR>
* LDAPAsynConnection::SEARCH_ONE, <BR>
* LDAPAsynConnection::SEARCH_SUB
* @param filter The string representation of a search filter to
* @param filter The std::string representation of a search filter to
* use with this operation
* @param attrsOnly true if only the attributes names (no values)
* should be returned
* @param cons A set of constraints that should be used with this
* request
*/
LDAPMessageQueue* search(const string& base="", int scope=0,
const string& filter="objectClass=*",
LDAPMessageQueue* search(const std::string& base="", int scope=0,
const std::string& filter="objectClass=*",
const StringList& attrs=StringList(),
bool attrsOnly=false,
const LDAPConstraints *cons=0);
......@@ -145,7 +145,7 @@ class LDAPAsynConnection{
* @param cons A set of constraints that should be used with this
* request
*/
LDAPMessageQueue* del(const string& dn, const LDAPConstraints *cons=0);
LDAPMessageQueue* del(const std::string& dn, const LDAPConstraints *cons=0);
/**
* Perform the COMPARE-operation on an attribute
......@@ -160,7 +160,7 @@ class LDAPAsynConnection{
* @param cons A set of constraints that should be used with this
* request
*/
LDAPMessageQueue* compare(const string& dn, const LDAPAttribute& attr,
LDAPMessageQueue* compare(const std::string& dn, const LDAPAttribute& attr,
const LDAPConstraints *cons=0);
/** Add an entry to the directory
......@@ -179,12 +179,12 @@ class LDAPAsynConnection{
* destination server, a LDAPException-object contains the
* error that occured.
* @param dn Distiguished Name of the Entry to modify
* @param modlist A set of modification that should be applied
* @param modstd::list A set of modification that should be applied
* to the Entry
* @param cons A set of constraints that should be used with this
* request
*/
LDAPMessageQueue* modify(const string& dn, const LDAPModList *modlist,
LDAPMessageQueue* modify(const std::string& dn, const LDAPModList *modlist,
const LDAPConstraints *cons=0);
/** modify the DN of an entry
......@@ -201,8 +201,8 @@ class LDAPAsynConnection{
* @param newParentDN The DN of the new parent entry of the entry
* 0 to keep the old one
*/
LDAPMessageQueue* rename(const string& dn, const string& newRDN,
bool delOldRDN=false, const string& newParentDN="",
LDAPMessageQueue* rename(const std::string& dn, const std::string& newRDN,
bool delOldRDN=false, const std::string& newParentDN="",
const LDAPConstraints* cons=0);
/** Perform a LDAP extended Operation
......@@ -216,8 +216,8 @@ class LDAPAsynConnection{
* @param cons A set of constraints that should be used with this
* request
*/
LDAPMessageQueue* extOperation(const string& oid,
const string& value="", const LDAPConstraints *cons=0);
LDAPMessageQueue* extOperation(const std::string& oid,
const std::string& value="", const LDAPConstraints *cons=0);
/** End an outstanding request
*
......@@ -243,7 +243,7 @@ class LDAPAsynConnection{
* @returns The Hostname of the destination server of the
* connection.
*/
const string& getHost() const;
const std::string& getHost() const;
/**
* @returns The Port to which this connection is connecting to on
......@@ -270,7 +270,7 @@ class LDAPAsynConnection{
* referral.
*
* @throws LDAPException in any case of an error
* @param urls Contains a list of LDAP-Urls that indicate the
* @param urls Contains a std::list of LDAP-Urls that indicate the
* destinations of a referral
* @param usedUrl After this method has successfully bind to one of
* the Destination URLs this parameter contains the URLs
......@@ -293,7 +293,7 @@ class LDAPAsynConnection{
/// is cacheEnabled?
bool getCacheEnabled() { return m_cacheEnabled;};
/// uncache a specific dn. Used internally by methods that write.
void uncache_entry(string &dn);
void uncache_entry(std::string &dn);
/// used to clear the cache. Probably should be used after creating
/// an object that a cached search should find.
void flush_cache();
......@@ -321,7 +321,7 @@ class LDAPAsynConnection{
/**
* The name of the destination host
*/
string m_host;
std::string m_host;
/**
* The port the destination server is running on.
......
......@@ -19,6 +19,7 @@
#include "LDAPAttribute.h"
using namespace std;
LDAPAttribute::LDAPAttribute(){
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute( )" << endl);
......
......@@ -33,16 +33,16 @@ class LDAPAttribute{
LDAPAttribute(const LDAPAttribute& attr);
/**
* Construct an Attribute with a single string value
* Construct an Attribute with a single std::string value
* @param name The attribute's name (type)
* @param value The string value of the attribute, if "" the
* @param value The std::string value of the attribute, if "" the
* attribute will have no values, for LDAPv3
* this values must be UTF-8 encoded
*/
LDAPAttribute(const string& name, const string& value="");
LDAPAttribute(const std::string& name, const std::string& value="");
/**
* Construct an attribute with multiple string values
* Construct an attribute with multiple std::string values
* @param name The attribute's name (type)
* @param values A 0-terminated array of char*. Each char* specifies
* one value of the attribute (UTF-8 encoded)
......@@ -50,13 +50,13 @@ class LDAPAttribute{
LDAPAttribute(const char* name, char **values);
/**
* Construct an attribute with multiple string values
* Construct an attribute with multiple std::string values
* @param name The attribute's name (type)
* @param values A list of strings. Each element specifies
* @param values A std::list of std::strings. Each element specifies
* one value of the attribute (UTF-8 or binary
* encoded)
*/
LDAPAttribute(const string& name, const StringList& values);
LDAPAttribute(const std::string& name, const StringList& values);
/**
* Construct an attribute with multiple binary coded values
......@@ -76,11 +76,11 @@ class LDAPAttribute{
~LDAPAttribute();
/**
* Add a single string value(bin/char) to the Attribute
* Add a single std::string value(bin/char) to the Attribute
* @param value Value that should be added, it is copied inside the
* object
*/
void addValue(const string& value);
void addValue(const std::string& value);
/**
* Add a single binary value to the Attribute
......@@ -95,7 +95,7 @@ class LDAPAttribute{
* Set the values of the attribute. If the object contains some values
* already, they are deleted
* @param values 0-terminated array of char*, each char*
* representing a string value to add to the entry
* representing a std::string value to add to the entry
*
* @return 0 no problem <BR>
* -1 failure (mem. allocation problem)
......@@ -116,8 +116,8 @@ class LDAPAttribute{
/**
* Set the values of the attribute. If the object does already contain
* some values, they will be deleted
* @param values A list of string-Objects. Each string is
* representing a string or binary value to add to
* @param values A std::list of std::string-Objects. Each std::string is
* representing a std::string or binary value to add to
* the entry
*/
void setValues(const StringList& values);
......@@ -134,7 +134,7 @@ class LDAPAttribute{
BerValue** getBerValues() const;
/**
* @return The values of the array as a list of strings
* @return The values of the array as a std::list of std::strings
*/
const StringList& getValues() const;
......@@ -146,13 +146,13 @@ class LDAPAttribute{
/**
* @return The name(type) of the attribute
*/
const string& getName() const ;
const std::string& getName() const ;
/**
* Sets the Attribute's name (type)
* @param the new name of the object
*/
void setName(const string& name);
void setName(const std::string& name);
/**
* For internal use only.
......@@ -168,13 +168,13 @@ class LDAPAttribute{
bool isNotPrintable() const ;
private :
string m_name;
std::string m_name;
StringList m_values;
/**
* This method can be used to dump the data of a LDAPResult-Object.
* It is only useful for debugging purposes at the moment
*/
friend ostream& operator << (ostream& s, const LDAPAttribute& attr);
friend std::ostream& operator << (std::ostream& s, const LDAPAttribute& attr);
};
#endif //#ifndef LDAP_ATTRIBUTE_H
......@@ -3,7 +3,6 @@
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include <ldap.h>
#include "debug.h"
......@@ -14,6 +13,8 @@
#include "LDAPAsynConnection.h"
#include "LDAPMessage.h"
using namespace std;
LDAPAttributeList::LDAPAttributeList(){
DEBUG(LDAP_DEBUG_CONSTRUCT,
"LDAPAttributeList::LDAPAttributList( )" << endl);
......
......@@ -7,12 +7,13 @@
#ifndef LDAP_ATTRIBUTE_LIST_H
#define LDAP_ATTRIBUTE_LIST_H
#include <ldap.h>
#include <list>
class LDAPAttribute;
class LDAPAsynConnection;
class LDAPMsg;
typedef list<LDAPAttribute> AttrList;
typedef std::list<LDAPAttribute> AttrList;
/**
* This container class is used to store multiple LDAPAttribute-objects.
......@@ -88,7 +89,8 @@ class LDAPAttributeList{
* This method can be used to dump the data of a LDAPResult-Object.
* It is only useful for debugging purposes at the moment
*/
friend ostream& operator << (ostream& s, const LDAPAttributeList& al);
friend std::ostream& operator << (std::ostream& s,
const LDAPAttributeList& al);
};
#endif // LDAP_ATTRIBUTE_LIST_H
......@@ -10,6 +10,8 @@
#include "LDAPBindRequest.h"
#include "LDAPException.h"
using namespace std;
LDAPBindRequest::LDAPBindRequest(const LDAPBindRequest& req) :
LDAPRequest(req){
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPBindRequest::LDAPBindRequest(&)" << endl);
......@@ -69,7 +71,7 @@ LDAPMessageQueue* LDAPBindRequest::sendRequest(){
}
}
LDAPRequest* LDAPBindRequest::followReferral(LDAPMsg* urls){
LDAPRequest* LDAPBindRequest::followReferral(LDAPMsg* /*urls*/){
DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::followReferral()" << endl);
DEBUG(LDAP_DEBUG_TRACE,
"ReferralChasing for bind-operation not implemented yet" << endl);
......
......@@ -10,14 +10,14 @@
class LDAPBindRequest : LDAPRequest {
private:
string m_dn;
string m_cred;
string m_mech;
std::string m_dn;
std::string m_cred;
std::string m_mech;
public:
LDAPBindRequest(const LDAPBindRequest& req);
//just for simple authentication
LDAPBindRequest(const string&, const string& passwd,
LDAPBindRequest(const std::string&, const std::string& passwd,
LDAPAsynConnection *connect, const LDAPConstraints *cons,
bool isReferral=false);
virtual ~LDAPBindRequest();
......
......@@ -12,6 +12,8 @@
#include "LDAPMessageQueue.h"
#include "LDAPResult.h"
using namespace std;
LDAPCompareRequest::LDAPCompareRequest(const LDAPCompareRequest& req){
DEBUG(LDAP_DEBUG_CONSTRUCT,
"LDAPCompareRequest::LDAPCompareRequest(&)" << endl);
......
......@@ -13,7 +13,7 @@ class LDAPMessageQueue;
class LDAPCompareRequest : public LDAPRequest {
public :
LDAPCompareRequest(const LDAPCompareRequest& req);
LDAPCompareRequest(const string& dn, const LDAPAttribute& attr,
LDAPCompareRequest(const std::string& dn, const LDAPAttribute& attr,
LDAPAsynConnection *connect, const LDAPConstraints *cons,
bool isReferral=false, const LDAPRequest* parent=0);
virtual ~LDAPCompareRequest();
......@@ -21,7 +21,7 @@ class LDAPCompareRequest : public LDAPRequest {
virtual LDAPRequest* followReferral(LDAPMsg* urls);
private :
string m_dn;
std::string m_dn;
LDAPAttribute m_attr;
};
......
......@@ -15,6 +15,8 @@ const int LDAPConnection::SEARCH_BASE = LDAPAsynConnection::SEARCH_BASE;
const int LDAPConnection::SEARCH_ONE = LDAPAsynConnection::SEARCH_ONE;
const int LDAPConnection::SEARCH_SUB = LDAPAsynConnection::SEARCH_SUB;
using namespace std;
LDAPConnection::LDAPConnection(const string& hostname, int port,
LDAPConstraints* cons) :
LDAPAsynConnection(hostname, port, cons){
......@@ -333,24 +335,20 @@ const LDAPConstraints* LDAPConnection::getConstraints() const{
return LDAPAsynConnection::getConstraints();
}
int LDAPConnection::enableCache(long timeout, long maxmem)
{
int LDAPConnection::enableCache(long timeout, long maxmem) {
return LDAPAsynConnection::enableCache(timeout, maxmem);
}
void LDAPConnection::disableCache()
{
void LDAPConnection::disableCache() {
LDAPAsynConnection::disableCache();
}
bool LDAPConnection::getCacheEnabled()
{
bool LDAPConnection::getCacheEnabled() {
return LDAPAsynConnection::getCacheEnabled();
}
void LDAPConnection::uncache_entry(string &dn)
{
void LDAPConnection::uncache_entry(string &dn) {
LDAPAsynConnection::uncache_entry(dn);
}
......
......@@ -47,7 +47,7 @@ class LDAPConnection : private LDAPAsynConnection {
* @param cons Default constraints to use with operations over
* this connection
*/
LDAPConnection(const string& hostname="localhost", int port=389,
LDAPConnection(const std::string& hostname="localhost", int port=389,
LDAPConstraints* cons=new LDAPConstraints());
/**
......@@ -66,7 +66,7 @@ class LDAPConnection : private LDAPAsynConnection {
* LDAP-Server
* @param port The Network Port the server is running on
*/
void init(const string& hostname, int port);
void init(const std::string& hostname, int port);
/**
* Start TLS on this connection. This isn't in the constructor,
......@@ -85,7 +85,7 @@ class LDAPConnection : private LDAPAsynConnection {
* @param dn The name of the entry to bind as
* @param passwd The cleartext password for the entry
*/
void bind(const string& dn="", const string& passwd="",
void bind(const std::string& dn="", const std::string& passwd="",
LDAPConstraints* cons=0);
/**
......@@ -112,7 +112,7 @@ class LDAPConnection : private LDAPAsynConnection {
* attr-parameter matched an Attribute of the entry. false if it
* did not match
*/
bool compare(const string& dn, const LDAPAttribute& attr,
bool compare(const std::string& dn, const LDAPAttribute& attr,
LDAPConstraints* cons=0);
/**
......@@ -126,7 +126,7 @@ class LDAPConnection : private LDAPAsynConnection {
* @param cons A set of constraints that should be used with this
* request
*/
void del(const string& dn, const LDAPConstraints* cons=0);
void del(const std::string& dn, const LDAPConstraints* cons=0);
/**
* Use this method to perform the ADD-operation
......@@ -151,7 +151,7 @@ class LDAPConnection : private LDAPAsynConnection {
* @param cons A set of constraints that should be used with this
* request
*/
void modify(const string& dn, const LDAPModList* mods,
void modify(const std::string& dn, const LDAPModList* mods,
const LDAPConstraints* cons=0);
/**
......@@ -174,8 +174,8 @@ class LDAPConnection : private LDAPAsynConnection {
* @param cons A set of constraints that should be used with this
* request
*/
void rename(const string& dn, const string& newRDN,
bool delOldRDN=false, const string& newParentDN="",
void rename(const std::string& dn, const std::string& newRDN,
bool delOldRDN=false, const std::string& newParentDN="",
const LDAPConstraints* cons=0);
/**
......@@ -190,7 +190,7 @@ class LDAPConnection : private LDAPAsynConnection {
* LDAPAsynConnection::SEARCH_BASE, <BR>
* LDAPAsynConnection::SEARCH_ONE, <BR>
* LDAPAsynConnection::SEARCH_SUB
* @param filter The string representation of a search filter to
* @param filter The std::string representation of a search filter to
* use with this operation
* @param attrsOnly true if only the attributes names (no values)
* should be returned
......@@ -199,8 +199,8 @@ class LDAPConnection : private LDAPAsynConnection {
* @returns A pointer to a LDAPSearchResults-object that can be
* used to read the results of the search.
*/
LDAPSearchResults* search(const string& base, int scope=0,
const string& filter="objectClass=*",
LDAPSearchResults* search(const std::string& base, int scope=0,
const std::string& filter="objectClass=*",
const StringList& attrs=StringList(), bool attrsOnly=false,
const LDAPConstraints* cons=0);
......@@ -219,10 +219,10 @@ class LDAPConnection : private LDAPAsynConnection {
* @returns The result of the Extended Operation as an
* pointer to a LDAPExtResult-object.
*/
LDAPExtResult* extOperation(const string& oid, const string&
LDAPExtResult* extOperation(const std::string& oid, const std::string&
value="", const LDAPConstraints *const = 0);
const string& getHost() const;
const std::string& getHost() const;
int getPort() const;
......@@ -240,7 +240,7 @@ class LDAPConnection : private LDAPAsynConnection {
/// is cacheEnabled?
bool getCacheEnabled();
/// uncache a specific dn. Used internally by methods that write.
void uncache_entry(string &dn);
void uncache_entry(std::string &dn);
/// used to clear the cache. Probably should be used after creating
/// an object that a cached search should find.
void flush_cache();
......
......@@ -10,6 +10,8 @@
#include "LDAPConstraints.h"
#include "LDAPControlSet.h"
using namespace std;
LDAPConstraints::LDAPConstraints(){
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPConstraints::LDAPConstraints()" << endl);
m_aliasDeref=LDAPConstraints::DEREF_NEVER;
......
......@@ -26,10 +26,10 @@
class LDAPConstraints{
public :
const static int DEREF_NEVER = 0x00;
const static int DEREF_SEARCHING = 0x01;
const static int DEREF_FINDING = 0x02;
const static int DEREF_ALWAYS = 0x04;