From 45d1cde80cab1967deefaf0395145393f9fa0418 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 8 Jan 2000 07:43:47 +0000 Subject: [PATCH] (hookup): handle ai_canonname being set in any of the addresses returnedby getaddrinfo. glibc apparently returns the reverse lookup of every address in ai_canonname. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7756 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/ftp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c index 2ec9fbb68..613ef2172 100644 --- a/appl/ftp/ftp/ftp.c +++ b/appl/ftp/ftp/ftp.c @@ -76,10 +76,7 @@ hookup (const char *host, int port) code = -1; return NULL; } - if (ai->ai_canonname != NULL) - strlcpy (hostnamebuf, ai->ai_canonname, sizeof(hostnamebuf)); - else - strlcpy (hostnamebuf, host, sizeof(hostnamebuf)); + strlcpy (hostnamebuf, host, sizeof(hostnamebuf)); hostname = hostnamebuf; for (a = ai; a != NULL; a = a->ai_next) { @@ -87,6 +84,9 @@ hookup (const char *host, int port) if (s < 0) continue; + if (a->ai_canonname != NULL) + strlcpy (hostnamebuf, a->ai_canonname, sizeof(hostnamebuf)); + memcpy (hisctladdr, a->ai_addr, a->ai_addrlen); error = connect (s, a->ai_addr, a->ai_addrlen);