svn commit: samba r5557 - in trunk/source/lib: .
gd at samba.org
gd at samba.org
Fri Feb 25 14:13:58 GMT 2005
Author: gd
Date: 2005-02-25 14:13:58 +0000 (Fri, 25 Feb 2005)
New Revision: 5557
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5557
Log:
Merge from 3_0.
Guenther
Modified:
trunk/source/lib/smbldap.c
Changeset:
Modified: trunk/source/lib/smbldap.c
===================================================================
--- trunk/source/lib/smbldap.c 2005-02-25 14:12:05 UTC (rev 5556)
+++ trunk/source/lib/smbldap.c 2005-02-25 14:13:58 UTC (rev 5557)
@@ -882,8 +882,9 @@
*********************************************************************/
static int smbldap_open(struct smbldap_state *ldap_state)
{
- int rc;
+ int rc, opt_rc;
SMB_ASSERT(ldap_state);
+ BOOL reopen = False;
#ifndef NO_LDAP_SECURITY
if (geteuid() != 0) {
@@ -892,12 +893,21 @@
}
#endif
- if ((ldap_state->ldap_struct != NULL) && ((ldap_state->last_ping + SMBLDAP_DONT_PING_TIME) < time(NULL))) {
+ if ((ldap_state->ldap_struct != NULL) && ((ldap_state->last_ping + SMBLDAP_DONT_PING_TIME) < time(NULL))) {
+
struct sockaddr_un addr;
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) || addr.sun_family == AF_LOCAL)) {
+
+ opt_rc = ldap_get_option(ldap_state->ldap_struct, LDAP_OPT_DESC, &sd);
+ if (opt_rc == 0 && (getpeername(sd, (struct sockaddr *) &addr, &len)) < 0 )
+ reopen = True;
+
+#ifdef HAVE_UNIXSOCKET
+ if (opt_rc == 0 && addr.sun_family == AF_UNIX)
+ reopen = True;
+#endif
+ if (reopen) {
/* the other end has died. reopen. */
ldap_unbind_ext(ldap_state->ldap_struct, NULL, NULL);
ldap_state->ldap_struct = NULL;
More information about the samba-cvs
mailing list