summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraschrijver <aschrijver@openbsd.org>2008-10-20 18:19:25 +0000
committeraschrijver <aschrijver@openbsd.org>2008-10-20 18:19:25 +0000
commit7f4bc074def0407733bc5cae86fa89ef09ac4666 (patch)
treeecfa82118928ea5bde22e3cb42863b9f1abe78ff
parentAdd 2 missing directives and remove duplicate configuration entry. (diff)
downloadwireguard-openbsd-7f4bc074def0407733bc5cae86fa89ef09ac4666.tar.xz
wireguard-openbsd-7f4bc074def0407733bc5cae86fa89ef09ac4666.zip
Do not stop connecting after the first connect fails.
OK mikeb@
-rw-r--r--usr.sbin/ypldap/ldapclient.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c
index 759beec3120..b1c4954d4d7 100644
--- a/usr.sbin/ypldap/ldapclient.c
+++ b/usr.sbin/ypldap/ldapclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapclient.c,v 1.6 2008/10/19 12:00:54 aschrijver Exp $ */
+/* $OpenBSD: ldapclient.c,v 1.7 2008/10/20 18:19:25 aschrijver Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -93,15 +93,19 @@ aldap_openidm(struct idm *idm)
if (connect(fd, res0->ai_addr, res0->ai_addrlen) == 0)
break;
- else {
+ else
warn("connect to %s port %s (%s) failed", hbuf, sbuf, "tcp");
- return NULL;
- }
close(fd);
fd = -1;
} while ((res0 = res0->ai_next) != NULL);
+ freeaddrinfo(idm->idm_addrinfo);
+ idm->idm_addrinfo = NULL;
+
+ if(fd == -1)
+ return NULL;
+
return aldap_init(fd);
}
@@ -315,10 +319,8 @@ aldap_openhost(char *host, char *port)
if (connect(fd, res0->ai_addr, res0->ai_addrlen) == 0)
break;
- else {
+ else
warn("connect to %s port %s (%s) failed", host, port, "tcp");
- return NULL;
- }
close(fd);
fd = -1;
@@ -326,10 +328,10 @@ aldap_openhost(char *host, char *port)
freeaddrinfo(res);
- if((al = aldap_init(fd)) == NULL)
+ if(fd == -1)
return NULL;
- return al;
+ return aldap_init(fd);
}
struct aldap *