r5522: Better handling of LDAP over IPC connections that have expired on the
authorGünther Deschner <gd@samba.org>
Wed, 23 Feb 2005 20:38:29 +0000 (20:38 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:55:44 +0000 (10:55 -0500)
LDAP-Server.

Guenther

source/lib/smbldap.c

index ee03295e72f1ef10f1a17f348fb2b281679fd283..fec6cc23a89f001f0ecbb7e8b4094a60665ed4c1 100644 (file)
@@ -888,7 +888,7 @@ static int smbldap_open(struct smbldap_state *ldap_state)
                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 @@ static int another_ldap_try(struct smbldap_state *ldap_state, int *rc,
        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 @@ static int another_ldap_try(struct smbldap_state *ldap_state, int *rc,
 
                *attempts += 1;
 
-               smbldap_close(ldap_state);
                open_rc = smbldap_open(ldap_state);
 
                if (open_rc == LDAP_SUCCESS) {