1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r23886: add ads_disconnect() function

metze
(This used to be commit ba70737b70)
This commit is contained in:
Stefan Metzmacher 2007-07-16 09:48:15 +00:00 committed by Gerald (Jerry) Carter
parent 476c30b9ce
commit 2fc53c947b
3 changed files with 14 additions and 8 deletions

View File

@ -141,9 +141,7 @@ void ads_destroy(ADS_STRUCT **ads)
is_mine = (*ads)->is_mine;
#if HAVE_LDAP
if ((*ads)->ld) {
ldap_unbind((*ads)->ld);
}
ads_disconnect(*ads);
#endif
SAFE_FREE((*ads)->server.realm);
SAFE_FREE((*ads)->server.workgroup);

View File

@ -465,6 +465,18 @@ got_connection:
return ads_sasl_bind(ads);
}
/**
* Disconnect the LDAP server
* @param ads Pointer to an existing ADS_STRUCT
**/
void ads_disconnect(ADS_STRUCT *ads)
{
if (ads->ld) {
ldap_unbind(ads->ld);
ads->ld = NULL;
}
}
/*
Duplicate a struct berval into talloc'ed memory
*/

View File

@ -75,11 +75,7 @@ static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind
DEBUG(3,("Reopening ads connection to realm '%s' after error %s\n",
ads->config.realm, ads_errstr(status)));
if (ads->ld) {
ldap_unbind(ads->ld);
}
ads->ld = NULL;
ads_disconnect(ads);
status = ads_connect(ads);
if (!ADS_ERR_OK(status)) {