From: Ulrich Drepper Date: Wed, 1 Jul 2009 10:41:30 +0000 (-0700) Subject: Fix NIS and NIS+ getnetbyaddr backends. X-Git-Tag: fedora/glibc-2.10.1-3~4^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=870a58b0b6a05589a56ea3dc7ee7b59ed64dee50;p=thirdparty%2Fglibc.git Fix NIS and NIS+ getnetbyaddr backends. The addresses were interpreted as class-based network addresses. (cherry picked from commit 2fd0cd8b5257e7ae0c0df0651ee62a6ef7c37cc2) --- diff --git a/ChangeLog b/ChangeLog index b5f5d809854..44c96e0ee8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-01 Ulrich Drepper + * nis/nss_nis/nis-network.c (_nss_nis_getnetbyaddr_r): Don't use + inet_makeaddr. This worked only with class-based networks. + * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r): + Likewise. + * nss/nss_files/files-network.c (netbyaddr): If type is AF_UNSPEC, recognize all types. * nss/getent.c (networks_keys): Pass AF_UNSPEC instead of AF_UNIX diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c index 9b02302e0b5..22a898bb211 100644 --- a/nis/nss_nis/nis-network.c +++ b/nis/nss_nis/nis-network.c @@ -241,7 +241,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net, if (__builtin_expect (yp_get_default_domain (&domain), 0)) return NSS_STATUS_UNAVAIL; - struct in_addr in = inet_makeaddr (addr, 0); + struct in_addr in = { .s_addr = htonl (addr) }; char *buf = inet_ntoa (in); size_t blen = strlen (buf); diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c index 1cf652f071c..902826b62a2 100644 --- a/nis/nss_nisplus/nisplus-network.c +++ b/nis/nss_nisplus/nisplus-network.c @@ -433,7 +433,7 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type, char buf2[18]; int olderr = errno; - struct in_addr in = inet_makeaddr (addr, 0); + struct in_addr in = { .s_addr = htonl (addr) }; strcpy (buf2, inet_ntoa (in)); size_t b2len = strlen (buf2);