svn commit: samba r23887 - in branches/SAMBA_3_2_0/source/libads: .

metze at samba.org metze at samba.org
Mon Jul 16 09:48:47 GMT 2007


Author: metze
Date: 2007-07-16 09:48:46 +0000 (Mon, 16 Jul 2007)
New Revision: 23887

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23887

Log:
merge from SAMBA_3_2:
add ads_disconnect() function

metze
Modified:
   branches/SAMBA_3_2_0/source/libads/ads_struct.c
   branches/SAMBA_3_2_0/source/libads/ldap.c
   branches/SAMBA_3_2_0/source/libads/ldap_utils.c


Changeset:
Modified: branches/SAMBA_3_2_0/source/libads/ads_struct.c
===================================================================
--- branches/SAMBA_3_2_0/source/libads/ads_struct.c	2007-07-16 09:48:15 UTC (rev 23886)
+++ branches/SAMBA_3_2_0/source/libads/ads_struct.c	2007-07-16 09:48:46 UTC (rev 23887)
@@ -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_0/source/libads/ldap.c
===================================================================
--- branches/SAMBA_3_2_0/source/libads/ldap.c	2007-07-16 09:48:15 UTC (rev 23886)
+++ branches/SAMBA_3_2_0/source/libads/ldap.c	2007-07-16 09:48:46 UTC (rev 23887)
@@ -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_0/source/libads/ldap_utils.c
===================================================================
--- branches/SAMBA_3_2_0/source/libads/ldap_utils.c	2007-07-16 09:48:15 UTC (rev 23886)
+++ branches/SAMBA_3_2_0/source/libads/ldap_utils.c	2007-07-16 09:48:46 UTC (rev 23887)
@@ -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)) {



More information about the samba-cvs mailing list