summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-02-25 14:12:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:47 -0500
commitf823e8c411721201480afe2d275224d81c7de2c8 (patch)
treeb82889d69317faab469ba5afd7fc6a138b7ff8d0 /source3
parentf95e9fc45b1d34c55b04318b79928adabd8f09e2 (diff)
downloadsamba-f823e8c411721201480afe2d275224d81c7de2c8.tar.gz
samba-f823e8c411721201480afe2d275224d81c7de2c8.tar.bz2
samba-f823e8c411721201480afe2d275224d81c7de2c8.zip
r5556: Fix the build on AIX.
use AF_UNIX instead of AF_LOCAL (thanks to Doug VanLeuven <roamdad-at-sonic.net>) and make smbldap_open() a bit more readable. Guenther (This used to be commit 526d6a9493cd091f2a9b8e072f11e673133fe5c1)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/smbldap.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index fec6cc23a8..3296f7994a 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -873,8 +873,9 @@ static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_
*********************************************************************/
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) {
@@ -883,12 +884,21 @@ static int smbldap_open(struct smbldap_state *ldap_state)
}
#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;