]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix getent networks lookup and resulting incorrect NSS change.
authorUlrich Drepper <drepper@redhat.com>
Wed, 1 Jul 2009 10:33:26 +0000 (03:33 -0700)
committerPetr Baudis <pasky@suse.cz>
Thu, 16 Jul 2009 15:42:52 +0000 (17:42 +0200)
I changed the files NSS backend for networks because I thought the
getent use of getnetbyaddr is correct.  But it isn't.  Undo parts
of the last change and fix getent.
(cherry picked from commit 5cd1f906c34256abdccc92052fbbde51fd70a565)

ChangeLog
nss/getent.c
nss/nss_files/files-network.c

index 0e5bcfce752caa7828bb073980b37751876704a1..b5f5d8098547f7c69cdb6ad5650d590e9005e495 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,10 @@
 2009-07-01  Ulrich Drepper  <drepper@redhat.com>
 
        * nss/nss_files/files-network.c (netbyaddr): If type is AF_UNSPEC,
-       recognize all types.  Fix endianess in comparison of network number.
+       recognize all types.
        * nss/getent.c (networks_keys): Pass AF_UNSPEC instead of AF_UNIX
-       to getnetbyaddr.
+       to getnetbyaddr.  Fix network parameter to getnetbyaddr.  It must
+       be in host byte order.
 
 2009-06-24  Andreas Schwab  <aschwab@redhat.com>
 
index cda7d78ed47a86d01e9832c023dbe0b571ed6a52..8955c0f7841374272b5b38cd28e75bd08614b7bd 100644 (file)
@@ -469,7 +469,7 @@ networks_keys (int number, char *key[])
   for (i = 0; i < number; ++i)
     {
       if (isdigit (key[i][0]))
-       net = getnetbyaddr (inet_addr (key[i]), AF_UNSPEC);
+       net = getnetbyaddr (ntohl (inet_addr (key[i])), AF_UNSPEC);
       else
        net = getnetbyname (key[i]);
 
index 064de5a143516d9f03ee21910d7c02b07660c2b0..92aea75d9ea994b3819b4f92d4bcf496c5f0ca11 100644 (file)
@@ -82,7 +82,7 @@ DB_LOOKUP (netbyname, ,,
 DB_LOOKUP (netbyaddr, ,,
           {
             if ((type == AF_UNSPEC || result->n_addrtype == type)
-                && result->n_net == htonl (net))
+                && result->n_net == net)
               /* Bingo!  */
               break;
           }, uint32_t net, int type)