- some code cleanups

- fix for the client caching code (cache is flushed after modifications
  rather than removing only the changed entry)

The code was submitted by Jeff Costlow <j.costlow@f5.com> under the
following terms:

Copyright 2002, F5 Networks, Inc, All rights reserved.
This software is not subject to any license of F5 Networks.

This is free software; you can redistribute and use it
under the same terms as OpenLDAP itself.
This commit is contained in:
Ralf Haferkamp 2002-04-23 15:28:11 +00:00
parent 3e3911247b
commit bef9945dff
13 changed files with 30 additions and 23 deletions

View File

@ -31,6 +31,7 @@ LDAPAsynConnection::LDAPAsynConnection(const string& hostname, int port,
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
" host:" << hostname << endl << " port:" << port << endl);
cur_session=0;
m_constr = 0;
this->init(hostname, port);
this->setConstraints(cons);
}

View File

@ -160,7 +160,8 @@ class LDAPAsynConnection{
* @param cons A set of constraints that should be used with this
* request
*/
LDAPMessageQueue* compare(const std::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 +180,13 @@ class LDAPAsynConnection{
* destination server, a LDAPException-object contains the
* error that occured.
* @param dn Distiguished Name of the Entry to modify
* @param modstd::list A set of modification that should be applied
* @param modlist 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 std::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,7 +203,8 @@ class LDAPAsynConnection{
* @param newParentDN The DN of the new parent entry of the entry
* 0 to keep the old one
*/
LDAPMessageQueue* rename(const std::string& dn, const std::string& newRDN,
LDAPMessageQueue* rename(const std::string& dn,
const std::string& newRDN,
bool delOldRDN=false, const std::string& newParentDN="",
const LDAPConstraints* cons=0);

View File

@ -37,7 +37,8 @@ LDAPDeleteRequest::~LDAPDeleteRequest(){
"LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
// TODO -- flush the entire cache here? or does this invalidate
// cached searches that may have found the deleted entry.
m_connection->uncache_entry(m_dn);
// m_connection->uncache_entry(m_dn);
m_connection->flush_cache();
}
LDAPMessageQueue* LDAPDeleteRequest::sendRequest(){

View File

@ -30,7 +30,7 @@ LDAPEntry::LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg){
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
char* tmp=ldap_get_dn(ld->getSessionHandle(),msg);
m_dn=string(tmp);
free(tmp);
ldap_memfree(tmp);
m_attrs = new LDAPAttributeList(ld, msg);
}
@ -56,7 +56,7 @@ void LDAPEntry::setAttributes(LDAPAttributeList *attrs){
m_attrs=attrs;
}
const string LDAPEntry::getDN() const{
const string& LDAPEntry::getDN() const{
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getDN()" << endl);
return m_dn;
}

View File

@ -59,7 +59,7 @@ class LDAPEntry{
/**
* @returns The current DN of the entry.
*/
const std::string getDN() const ;
const std::string& getDN() const ;
/**
* @returns A const pointer to the attributes of the entry.

View File

@ -22,7 +22,7 @@ class LDAPException{
/**
* Constructs a LDAPException-object from the parameters
* @param res_code A valid LDAP result code.
* @param err_std::string An addional error message for the error
* @param err_string An addional error message for the error
* that happend (optional)
*/
LDAPException(int res_code, const std::string& err_string=std::string());

View File

@ -20,7 +20,7 @@ class LDAPModList{
public :
/**
* Constructs an empty std::list.
* Constructs an empty list.
*/
LDAPModList();
@ -30,13 +30,13 @@ class LDAPModList{
LDAPModList(const LDAPModList&);
/**
* Adds one element to the end of the std::list.
* Adds one element to the end of the list.
* @param mod The LDAPModification to add to the std::list.
*/
void addModification(const LDAPModification &mod);
/**
* Translates the std::list to a 0-terminated array of
* Translates the list to a 0-terminated array of
* LDAPMod-structures as needed by the C-API
*/
LDAPMod** toLDAPModArray();

View File

@ -40,7 +40,9 @@ LDAPModifyRequest::~LDAPModifyRequest(){
"LDAPModifyRequest::~LDAPModifyRequest()" << endl);
delete m_modList;
// flush this entry from cache.
m_connection->uncache_entry(m_dn);
//m_connection->uncache_entry(m_dn);
// I think we need to do this... (j.costlow)
m_connection->flush_cache();
}
LDAPMessageQueue* LDAPModifyRequest::sendRequest(){

View File

@ -13,7 +13,7 @@ class LDAPSearchReference;
typedef std::list<LDAPSearchReference> RefList;
/**
* Container class for storing a std::list of Search References
* Container class for storing a list of Search References
*
* Used internally only by LDAPSearchResults
*/
@ -22,7 +22,7 @@ class LDAPReferenceList{
typedef RefList::const_iterator const_iterator;
/**
* Constructs an empty std::list.
* Constructs an empty list.
*/
LDAPReferenceList();

View File

@ -21,7 +21,7 @@ class LDAPReferralException : public LDAPException{
public :
/**
* Creates an object that is initialized with a std::list of URLs
* Creates an object that is initialized with a list of URLs
*/
LDAPReferralException(const LDAPUrlList& urls);

View File

@ -22,7 +22,7 @@ class LDAPUrl{
public :
/**
* Create a new object from a c-std::string that contains a LDAP-Url
* Create a new object from a c-string that contains a LDAP-Url
*/
LDAPUrl(const char *url);
@ -43,7 +43,7 @@ class LDAPUrl{
int getScope() const;
/**
* @return The complete URL as a std::string
* @return The complete URL as a string
*/
const std::string& getURLString() const;

View File

@ -19,7 +19,7 @@ class LDAPUrlList{
typedef UrlList::const_iterator const_iterator;
/**
* Constructs an empty std::list.
* Constructs an empty list.
*/
LDAPUrlList();
@ -32,7 +32,7 @@ class LDAPUrlList{
* For internal use only
*
* This constructor is used by the library internally to create a
* std::list of URLs from a array of C-std::strings that was return by
* std::list of URLs from a array of C-strings that was return by
* the C-API
*/
LDAPUrlList(char** urls);

View File

@ -11,7 +11,7 @@
typedef std::list<std::string> ListType;
/**
* Container class to store multiple std::string-objects
* Container class to store multiple string-objects
*/
class StringList{
private:
@ -21,7 +21,7 @@ class StringList{
typedef ListType::const_iterator const_iterator;
/**
* Constructs an empty std::list.
* Constructs an empty list.
*/
StringList();
@ -34,7 +34,7 @@ class StringList{
* For internal use only
*
* This constructor is used by the library internally to create a
* std::list of std::string from a array for c-Strings (char*)thar was
* list of string from a array for c-Strings (char*)thar was
* returned by the C-API
*/
StringList(char** values);