about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-07-01 03:33:26 -0700
committerUlrich Drepper <drepper@redhat.com>2009-07-01 03:33:26 -0700
commit5cd1f906c34256abdccc92052fbbde51fd70a565 (patch)
treea4dc5522f622b7b9b0ab2dc2ae9d6c4b630bcab6
parent29ba9812bb86bf6da9702f4fbff5cdbb25846401 (diff)
downloadglibc-5cd1f906c34256abdccc92052fbbde51fd70a565.tar.gz
glibc-5cd1f906c34256abdccc92052fbbde51fd70a565.tar.xz
glibc-5cd1f906c34256abdccc92052fbbde51fd70a565.zip
Fix getent networks lookup and resulting incorrect NSS change.
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.
-rw-r--r--ChangeLog5
-rw-r--r--nss/getent.c2
-rw-r--r--nss/nss_files/files-network.c2
3 files changed, 5 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 714d114d5e..6dfd700637 100644
--- 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-26  H.J. Lu  <hongjiu.lu@intel.com>
 
diff --git a/nss/getent.c b/nss/getent.c
index 3a482e140f..d70a8da0f4 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -534,7 +534,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]);
 
diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c
index 064de5a143..92aea75d9e 100644
--- a/nss/nss_files/files-network.c
+++ b/nss/nss_files/files-network.c
@@ -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)