From 0bd288cd6cb5e3f5a0214f8b767113887a2e8919 Mon Sep 17 00:00:00 2001 From: Yoshinobu Inoue Date: Sat, 29 Jan 2000 18:21:05 +0000 Subject: Add NI_NAMEREQD flag to getnameinfo() call. Without this flag, getnameinfo() don't return error at name resolving failure. But it is used at doaddrlookup(-N) case in telnet, error need to be returned to correctly initialize hostname buffer. Discovered at checking recent KAME repository change, noticed by itojun. --- contrib/telnet/telnet/commands.c | 2 +- crypto/telnet/telnet/commands.c | 2 +- usr.bin/telnet/commands.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c index dd83669d1d9b8..8380c2969bda7 100644 --- a/contrib/telnet/telnet/commands.c +++ b/contrib/telnet/telnet/commands.c @@ -2451,7 +2451,7 @@ tn(argc, argv) if (doaddrlookup) gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len, _hostname, sizeof(_hostname) - 1, NULL, 0, - 0); + NI_NAMEREQD); if (gni_err != 0) (void) strncpy(_hostname, hostp, sizeof(_hostname) - 1); _hostname[sizeof(_hostname)-1] = '\0'; diff --git a/crypto/telnet/telnet/commands.c b/crypto/telnet/telnet/commands.c index dd83669d1d9b8..8380c2969bda7 100644 --- a/crypto/telnet/telnet/commands.c +++ b/crypto/telnet/telnet/commands.c @@ -2451,7 +2451,7 @@ tn(argc, argv) if (doaddrlookup) gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len, _hostname, sizeof(_hostname) - 1, NULL, 0, - 0); + NI_NAMEREQD); if (gni_err != 0) (void) strncpy(_hostname, hostp, sizeof(_hostname) - 1); _hostname[sizeof(_hostname)-1] = '\0'; diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index a640becaa1680..33a45481667da 100644 --- a/usr.bin/telnet/commands.c +++ b/usr.bin/telnet/commands.c @@ -2274,7 +2274,7 @@ tn(argc, argv) if (doaddrlookup) gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len, _hostname, sizeof(_hostname) - 1, NULL, 0, - 0); + NI_NAMEREQD); if (gni_err != 0) (void) strncpy(_hostname, hostp, sizeof(_hostname) - 1); _hostname[sizeof(_hostname)-1] = '\0'; -- cgit v1.3