Author: metze Date: 2007-07-16 09:48:15 +0000 (Mon, 16 Jul 2007) New Revision: 23886
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23886 Log: add ads_disconnect() function metze Modified: branches/SAMBA_3_2/source/libads/ads_struct.c branches/SAMBA_3_2/source/libads/ldap.c branches/SAMBA_3_2/source/libads/ldap_utils.c Changeset: Modified: branches/SAMBA_3_2/source/libads/ads_struct.c =================================================================== --- branches/SAMBA_3_2/source/libads/ads_struct.c 2007-07-16 08:23:20 UTC (rev 23885) +++ branches/SAMBA_3_2/source/libads/ads_struct.c 2007-07-16 09:48:15 UTC (rev 23886) @@ -141,9 +141,7 @@ 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); Modified: branches/SAMBA_3_2/source/libads/ldap.c =================================================================== --- branches/SAMBA_3_2/source/libads/ldap.c 2007-07-16 08:23:20 UTC (rev 23885) +++ branches/SAMBA_3_2/source/libads/ldap.c 2007-07-16 09:48:15 UTC (rev 23886) @@ -465,6 +465,18 @@ 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 */ Modified: branches/SAMBA_3_2/source/libads/ldap_utils.c =================================================================== --- branches/SAMBA_3_2/source/libads/ldap_utils.c 2007-07-16 08:23:20 UTC (rev 23885) +++ branches/SAMBA_3_2/source/libads/ldap_utils.c 2007-07-16 09:48:15 UTC (rev 23886) @@ -75,11 +75,7 @@ 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)) {
