diff options
author | aschrijver <aschrijver@cvs.openbsd.org> | 2008-10-20 18:19:26 +0000 |
---|---|---|
committer | aschrijver <aschrijver@cvs.openbsd.org> | 2008-10-20 18:19:26 +0000 |
commit | 04772ebcb3bf00d2ed7cb21d739ecc93f3cb7c7a (patch) | |
tree | bb07eb9cf0be8e86231d45975cc10b03c408ea6e /usr.sbin/ypldap | |
parent | 353487f7b8bb4815eeee97f6453b33a4052784cb (diff) |
Do not stop connecting after the first connect fails.
OK mikeb@
Diffstat (limited to 'usr.sbin/ypldap')
-rw-r--r-- | usr.sbin/ypldap/ldapclient.c | 20 |
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 * |