X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fsrc%2FLDAPAsynConnection.cpp;h=582d2b53ae67113e618067fb5f3883ba207924d9;hb=0563d68c4779db0c82980466c9f9860abb0de0f8;hp=7c8358e12b2890f7ea57711bd69f51fe1880f64e;hpb=6549cfc7d09511de67e113d602c4071599127e2c;p=openldap diff --git a/contrib/ldapc++/src/LDAPAsynConnection.cpp b/contrib/ldapc++/src/LDAPAsynConnection.cpp index 7c8358e12b..582d2b53ae 100644 --- a/contrib/ldapc++/src/LDAPAsynConnection.cpp +++ b/contrib/ldapc++/src/LDAPAsynConnection.cpp @@ -1,6 +1,6 @@ // $OpenLDAP$ /* - * Copyright 2000-2013 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 2000-2014 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -43,7 +43,10 @@ LDAPAsynConnection::LDAPAsynConnection(const string& url, int port, this->setConstraints(cons); } -LDAPAsynConnection::~LDAPAsynConnection(){} +LDAPAsynConnection::~LDAPAsynConnection(){ + unbind(); + delete m_constr; +} void LDAPAsynConnection::init(const string& hostname, int port){ DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::init" << endl); @@ -51,6 +54,8 @@ void LDAPAsynConnection::init(const string& hostname, int port){ " hostname:" << hostname << endl << " port:" << port << endl); + unbind(); + m_uri.setScheme("ldap"); m_uri.setHost(hostname); m_uri.setPort(port); @@ -66,6 +71,8 @@ void LDAPAsynConnection::init(const string& hostname, int port){ } void LDAPAsynConnection::initialize(const std::string& uri){ + unbind(); + m_uri.setURLString(uri); int ret = ldap_initialize(&cur_session, m_uri.getURLString().c_str()); if ( ret != LDAP_SUCCESS ) { @@ -277,6 +284,7 @@ void LDAPAsynConnection::unbind(){ void LDAPAsynConnection::setConstraints(LDAPConstraints *cons){ DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::setConstraints()" << endl); + delete m_constr; m_constr=cons; }