From: Ulrich Drepper Date: Tue, 19 Oct 2004 21:11:32 +0000 (+0000) Subject: Update. X-Git-Tag: cvs/fedora-glibc-20041020T1016~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=653aeda54916d28b010c1bb2240c962b9d01b6ad;p=platform%2Fupstream%2Fglibc.git Update. 2004-10-19 Ulrich Drepper * nss/getent.c (hosts_keys): Let inet_pton decide whether the string is an address or not. --- diff --git a/ChangeLog b/ChangeLog index 54ec7e1..4594957 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-10-19 Ulrich Drepper + + * nss/getent.c (hosts_keys): Let inet_pton decide whether the + string is an address or not. + 2004-10-19 Jakub Jelinek * elf/dl-addr.c (_dl_addr): Don't look at STT_TLS symbols. diff --git a/nss/getent.c b/nss/getent.c index f9f0a6e..c0a2732 100644 --- a/nss/getent.c +++ b/nss/getent.c @@ -276,19 +276,12 @@ hosts_keys (int number, char *key[]) for (i = 0; i < number; ++i) { struct hostent *host = NULL; + char addr[IN6ADDRSZ]; - if (strchr (key[i], ':') != NULL) - { - char addr[IN6ADDRSZ]; - if (inet_pton (AF_INET6, key[i], &addr)) - host = gethostbyaddr (addr, sizeof (addr), AF_INET6); - } - else if (isdigit (key[i][0])) - { - char addr[INADDRSZ]; - if (inet_pton (AF_INET, key[i], &addr)) - host = gethostbyaddr (addr, sizeof (addr), AF_INET); - } + if (inet_pton (AF_INET6, key[i], &addr) > 0) + host = gethostbyaddr (addr, sizeof (addr), AF_INET6); + else if (inet_pton (AF_INET, key[i], &addr) > 0) + host = gethostbyaddr (addr, sizeof (addr), AF_INET); else if ((host = gethostbyname2 (key[i], AF_INET6)) == NULL) host = gethostbyname2 (key[i], AF_INET);