svn commit: samba r5522 - branches/SAMBA_3_0/source/lib trunk/source/lib

gd at samba.org gd at samba.org
Wed Feb 23 20:38:30 GMT 2005


Author: gd
Date: 2005-02-23 20:38:29 +0000 (Wed, 23 Feb 2005)
New Revision: 5522

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

Log:
Better handling of LDAP over IPC connections that have expired on the
LDAP-Server.

Guenther

Modified:
   branches/SAMBA_3_0/source/lib/smbldap.c
   trunk/source/lib/smbldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/smbldap.c
===================================================================
--- branches/SAMBA_3_0/source/lib/smbldap.c	2005-02-23 20:00:26 UTC (rev 5521)
+++ branches/SAMBA_3_0/source/lib/smbldap.c	2005-02-23 20:38:29 UTC (rev 5522)
@@ -888,7 +888,7 @@
 		socklen_t len = sizeof(addr);
 		int sd;
 		if (ldap_get_option(ldap_state->ldap_struct, LDAP_OPT_DESC, &sd) == 0 &&
-		    getpeername(sd, (struct sockaddr *) &addr, &len) < 0) {
+		    ((getpeername(sd, (struct sockaddr *) &addr, &len) < 0) || addr.sun_family == AF_LOCAL)) {
 		    	/* the other end has died. reopen. */
 		    	ldap_unbind_ext(ldap_state->ldap_struct, NULL, NULL);
 		    	ldap_state->ldap_struct = NULL;
@@ -962,8 +962,6 @@
 	if (*rc != LDAP_SERVER_DOWN)
 		goto no_next;
 
-	now = time(NULL);
-
 	if (now >= endtime) {
 		smbldap_close(ldap_state);
 		*rc = LDAP_TIMEOUT;
@@ -986,7 +984,6 @@
 
 		*attempts += 1;
 
-		smbldap_close(ldap_state);
 		open_rc = smbldap_open(ldap_state);
 
 		if (open_rc == LDAP_SUCCESS) {

Modified: trunk/source/lib/smbldap.c
===================================================================
--- trunk/source/lib/smbldap.c	2005-02-23 20:00:26 UTC (rev 5521)
+++ trunk/source/lib/smbldap.c	2005-02-23 20:38:29 UTC (rev 5522)
@@ -897,7 +897,7 @@
 		socklen_t len = sizeof(addr);
 		int sd;
 		if (ldap_get_option(ldap_state->ldap_struct, LDAP_OPT_DESC, &sd) == 0 &&
-		    getpeername(sd, (struct sockaddr *) &addr, &len) < 0) {
+		    ((getpeername(sd, (struct sockaddr *) &addr, &len) < 0) || addr.sun_family == AF_LOCAL)) {
 		    	/* the other end has died. reopen. */
 		    	ldap_unbind_ext(ldap_state->ldap_struct, NULL, NULL);
 		    	ldap_state->ldap_struct = NULL;
@@ -971,8 +971,6 @@
 	if (*rc != LDAP_SERVER_DOWN)
 		goto no_next;
 
-	now = time(NULL);
-
 	if (now >= endtime) {
 		smbldap_close(ldap_state);
 		*rc = LDAP_TIMEOUT;
@@ -995,7 +993,6 @@
 
 		*attempts += 1;
 
-		smbldap_close(ldap_state);
 		open_rc = smbldap_open(ldap_state);
 
 		if (open_rc == LDAP_SUCCESS) {



More information about the samba-cvs mailing list