This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.10-129-g29ba981


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  29ba9812bb86bf6da9702f4fbff5cdbb25846401 (commit)
      from  e6bd12ddf72412918fe9002a3e27ecc07775bd64 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=29ba9812bb86bf6da9702f4fbff5cdbb25846401

commit 29ba9812bb86bf6da9702f4fbff5cdbb25846401
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Wed Jul 1 02:42:59 2009 -0700

    Fix getnetbyaddr implementation.
    
    There were two problems in the getnetbyaddr implementation.  The type
    argument is pretty much useless since (almost) no input file contains
    this information and the NSS backends make up the value they fill in
    for the n_addrtype field.  Therefore we now declare that passing AF_UNSPEC
    is always recognized.  Secondly, the files backend didn't compare the network
    numbers with the correct endianess.
    
    Also change getent to take advantage of the type parameter change.

diff --git a/ChangeLog b/ChangeLog
index 7a25874..714d114 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +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.
+	* nss/getent.c (networks_keys): Pass AF_UNSPEC instead of AF_UNIX
+	to getnetbyaddr.
+
 2009-06-26  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86_64/multiarch/ifunc-defines.sym (FAMILIY_OFFSET): Define.
diff --git a/nss/getent.c b/nss/getent.c
index 3a9430f..3a482e1 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_UNIX);
+	net = getnetbyaddr (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 9f4a3e0..064de5a 100644
--- a/nss/nss_files/files-network.c
+++ b/nss/nss_files/files-network.c
@@ -1,5 +1,5 @@
 /* Networks file parser in nss_files module.
-   Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996-1998, 2000, 2001, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -81,7 +81,8 @@ DB_LOOKUP (netbyname, ,,
 
 DB_LOOKUP (netbyaddr, ,,
 	   {
-	     if (result->n_addrtype == type && result->n_net == net)
+	     if ((type == AF_UNSPEC || result->n_addrtype == type)
+		 && result->n_net == htonl (net))
 	       /* Bingo!  */
 	       break;
 	   }, uint32_t net, int type)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                     |    7 +++++++
 nss/getent.c                  |    2 +-
 nss/nss_files/files-network.c |    5 +++--
 3 files changed, 11 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]