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.16-ports-merge-66-gb3404db


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  b3404dbdebb977f0f8d6099fa466ebbe6eb9157e (commit)
       via  0ced335ac081474e12c89709c81cf2f2094c5351 (commit)
       via  898c7aaba55cb348d4a94286cbaf7e2920f0cd82 (commit)
       via  f98eafbd5d7714c75a101bb2c44ccfdc4b3b8464 (commit)
       via  ac4ea442f3c70254def5c2f8aee592cddb5eef51 (commit)
      from  0f48659e36e72c091f988d9ea5a2dd505960ab0f (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=b3404dbdebb977f0f8d6099fa466ebbe6eb9157e

commit b3404dbdebb977f0f8d6099fa466ebbe6eb9157e
Author: Pino Toscano <toscano.pino@tiscali.it>
Date:   Sat Jul 21 00:16:11 2012 +0200

    Hurd: compliance fixes for getlogin_r
    
    - make LOGIN non-static, as it would make getlogin_r no more reentrant; change its type to string_t
    - fail with ERANGE if NAME has not enough space for the actual login string
    - copy with memcpy only the chars of the string

diff --git a/ChangeLog b/ChangeLog
index 560bb95..f50bf6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,10 @@
 	* sysdeps/mach/hurd/getgroups.c: Return -1 and set EINVAL for
 	negative N or less than NGIDS.
 
+	* sysdeps/mach/hurd/getlogin_r.c: Make LOGIN non-static and change its
+	type to string_t.  Set ERANGE as errno and return it if NAME is not big
+	enough.  Use memcpy instead of strncpy.
+
 2012-07-20  Joseph Myers  <joseph@codesourcery.com>
 
 	* elf/Makefile (check-data): Remove.
diff --git a/sysdeps/mach/hurd/getlogin_r.c b/sysdeps/mach/hurd/getlogin_r.c
index 2539e6b..5410709 100644
--- a/sysdeps/mach/hurd/getlogin_r.c
+++ b/sysdeps/mach/hurd/getlogin_r.c
@@ -29,13 +29,20 @@ getlogin_r (name, name_len)
      char *name;
      size_t name_len;
 {
-  static char login[1024];	/* XXX */
+  string_t login;
   error_t err;
 
   if (err = __USEPORT (PROC, __proc_getlogin (port, login)))
     return errno = err;
 
-  strncpy (name, login, name_len);
+  size_t len = __strnlen (login, sizeof login - 1) + 1;
+  if (len > name_len)
+    {
+      errno = ERANGE;
+      return errno;
+    }
+
+  memcpy (name, login, len);
   return 0;
 }
 libc_hidden_def (getlogin_r)

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0ced335ac081474e12c89709c81cf2f2094c5351

commit 0ced335ac081474e12c89709c81cf2f2094c5351
Author: Pino Toscano <toscano.pino@tiscali.it>
Date:   Sat Jul 21 00:06:33 2012 +0200

    Hurd: compliance fixes for getgroups
    
    Fail with EINVAL when the requested number of groups is negative,
    or when it is positive but less than the actual number of groups.

diff --git a/ChangeLog b/ChangeLog
index a804f2c..560bb95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@
 	* sysdeps/mach/hurd/lremovexattr.c: New file, copied from removexattr.c
 	with O_NOLINK passed to __file_name_lookup.
 
+	* sysdeps/mach/hurd/getgroups.c: Return -1 and set EINVAL for
+	negative N or less than NGIDS.
+
 2012-07-20  Joseph Myers  <joseph@codesourcery.com>
 
 	* elf/Makefile (check-data): Remove.
diff --git a/sysdeps/mach/hurd/getgroups.c b/sysdeps/mach/hurd/getgroups.c
index 157a981..35b219e 100644
--- a/sysdeps/mach/hurd/getgroups.c
+++ b/sysdeps/mach/hurd/getgroups.c
@@ -30,6 +30,9 @@ __getgroups (n, gidset)
   int ngids;
   void *crit;
 
+  if (n < 0)
+    return __hurd_fail (EINVAL);
+
   crit = _hurd_critical_section_lock ();
   __mutex_lock (&_hurd_id.lock);
 
@@ -53,7 +56,7 @@ __getgroups (n, gidset)
       /* Now that the lock is released, we can safely copy the
 	 group set into the user's array, which might fault.  */
       if (ngids > n)
-	ngids = n;
+	return __hurd_fail (EINVAL);
       memcpy (gidset, gids, ngids * sizeof (gid_t));
     }
   else

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=898c7aaba55cb348d4a94286cbaf7e2920f0cd82

commit 898c7aaba55cb348d4a94286cbaf7e2920f0cd82
Author: Pino Toscano <toscano.pino@tiscali.it>
Date:   Sat Jul 21 00:01:57 2012 +0200

    Hurd: provide lremovexattr
    
    Add an implementation of lremovexattr based on removexattr.

diff --git a/ChangeLog b/ChangeLog
index dda1dc6..a804f2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@
 	* sysdeps/mach/hurd/llistxattr.c: New file, copied from listxattr.c
 	with O_NOLINK passed to __file_name_lookup.
 
+	* sysdeps/mach/hurd/lremovexattr.c: New file, copied from removexattr.c
+	with O_NOLINK passed to __file_name_lookup.
+
 2012-07-20  Joseph Myers  <joseph@codesourcery.com>
 
 	* elf/Makefile (check-data): Remove.
diff --git a/sysdeps/mach/hurd/lremovexattr.c b/sysdeps/mach/hurd/lremovexattr.c
new file mode 100644
index 0000000..32a96ac
--- /dev/null
+++ b/sysdeps/mach/hurd/lremovexattr.c
@@ -0,0 +1,35 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2005-2012 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <fcntl.h>
+
+ssize_t
+lremovexattr (const char *path, const char *name)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, O_NOLINK, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_remove (port, name);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return __hurd_fail (err);
+}

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f98eafbd5d7714c75a101bb2c44ccfdc4b3b8464

commit f98eafbd5d7714c75a101bb2c44ccfdc4b3b8464
Author: Pino Toscano <toscano.pino@tiscali.it>
Date:   Sat Jul 21 00:00:20 2012 +0200

    Hurd: provide llistxattr
    
    Add an implementation of llistxattr based on listxattr.

diff --git a/ChangeLog b/ChangeLog
index 03baa69..dda1dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
 	(__sendto): Use create_address_port.  Initialize APORT and deallocate
 	it if not null.
 
+	* sysdeps/mach/hurd/llistxattr.c: New file, copied from listxattr.c
+	with O_NOLINK passed to __file_name_lookup.
+
 2012-07-20  Joseph Myers  <joseph@codesourcery.com>
 
 	* elf/Makefile (check-data): Remove.
diff --git a/sysdeps/mach/hurd/llistxattr.c b/sysdeps/mach/hurd/llistxattr.c
new file mode 100644
index 0000000..23fb165
--- /dev/null
+++ b/sysdeps/mach/hurd/llistxattr.c
@@ -0,0 +1,35 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2005-2012 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <fcntl.h>
+
+ssize_t
+llistxattr (const char *path, char *list, size_t size)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, O_NOLINK, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_list (port, list, &size);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return err ? __hurd_fail (err) : size;
+}

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ac4ea442f3c70254def5c2f8aee592cddb5eef51

commit ac4ea442f3c70254def5c2f8aee592cddb5eef51
Author: Pino Toscano <toscano.pino@tiscali.it>
Date:   Fri Jul 20 23:56:58 2012 +0200

    Hurd: sendto: do not crash when ADDR is null
    
    Create a new create_address_port subroutine to isolate the address port creation
    (for both local and remove sockets), and use it inside HURD_DPORT_USE.
    Also intialize APORT to MACH_PORT_NULL and make sure to always deallocate it,
    when not null.

diff --git a/ChangeLog b/ChangeLog
index cb1dfaf..03baa69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-20  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/hurd/sendto.c (create_address_port): New subroutine.
+	(__sendto): Use create_address_port.  Initialize APORT and deallocate
+	it if not null.
+
 2012-07-20  Joseph Myers  <joseph@codesourcery.com>
 
 	* elf/Makefile (check-data): Remove.
diff --git a/sysdeps/mach/hurd/sendto.c b/sysdeps/mach/hurd/sendto.c
index c641757..bd4123e 100644
--- a/sysdeps/mach/hurd/sendto.c
+++ b/sysdeps/mach/hurd/sendto.c
@@ -33,37 +33,50 @@ __sendto (int fd,
 	  const struct sockaddr_un *addr,
 	  socklen_t addr_len)
 {
-  addr_port_t aport;
+  addr_port_t aport = MACH_PORT_NULL;
   error_t err;
   size_t wrote;
 
-  if (addr->sun_family == AF_LOCAL)
+  /* Get an address port for the desired destination address.  */
+  error_t create_address_port (io_t port,
+			       const struct sockaddr_un *addr,
+			       socklen_t addr_len,
+			       addr_port_t *aport)
     {
-      /* For the local domain, we must look up the name as a file and talk
-	 to it with the ifsock protocol.  */
-      file_t file = __file_name_lookup (addr->sun_path, 0, 0);
-      if (file == MACH_PORT_NULL)
-	return -1;
-      err = __ifsock_getsockaddr (file, &aport);
-      __mach_port_deallocate (__mach_task_self (), file);
-      if (err == MIG_BAD_ID || err == EOPNOTSUPP)
-	/* The file did not grok the ifsock protocol.  */
-	err = ENOTSOCK;
-      if (err)
-	return __hurd_fail (err);
+      error_t err_port;
+
+      if (addr->sun_family == AF_LOCAL)
+	{
+	  /* For the local domain, we must look up the name as a file and talk
+	     to it with the ifsock protocol.  */
+	  file_t file = __file_name_lookup (addr->sun_path, 0, 0);
+	  if (file == MACH_PORT_NULL)
+	    return errno;
+	  err_port = __ifsock_getsockaddr (file, aport);
+	  __mach_port_deallocate (__mach_task_self (), file);
+	  if (err_port == MIG_BAD_ID || err_port == EOPNOTSUPP)
+	    /* The file did not grok the ifsock protocol.  */
+	    err_port = ENOTSOCK;
+	}
+      else
+	{
+	  err_port = __socket_create_address (port,
+					      addr->sun_family,
+					      (char *) addr,
+					      addr_len,
+					      aport);
+	}
+
+      return err_port;
     }
-  else
-    err = EIEIO;
 
-  /* Get an address port for the desired destination address.  */
   err = HURD_DPORT_USE (fd,
 			({
-			  if (err)
-			    err = __socket_create_address (port,
-							   addr->sun_family,
-							   (char *) addr,
-							   addr_len,
-							   &aport);
+			  if (addr != NULL)
+			    err = create_address_port (port, addr, addr_len,
+						       &aport);
+			  else
+			    err = 0;
 			  if (! err)
 			    {
 			      /* Send the data.  */
@@ -72,12 +85,13 @@ __sendto (int fd,
 						   NULL,
 						   MACH_MSG_TYPE_COPY_SEND, 0,
 						   NULL, 0, &wrote);
-			      __mach_port_deallocate (__mach_task_self (),
-						      aport);
 			    }
 			  err;
 			}));
 
+  if (aport != MACH_PORT_NULL)
+    __mach_port_deallocate (__mach_task_self (), aport);
+
   return err ? __hurd_sockfail (fd, flags, err) : wrote;
 }
 

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

Summary of changes:
 ChangeLog                                          |   19 ++++++
 sysdeps/mach/hurd/getgroups.c                      |    5 +-
 sysdeps/mach/hurd/getlogin_r.c                     |   11 +++-
 sysdeps/mach/hurd/{lgetxattr.c => llistxattr.c}    |    6 +-
 .../mach/hurd/{removexattr.c => lremovexattr.c}    |    7 +-
 sysdeps/mach/hurd/sendto.c                         |   64 ++++++++++++--------
 6 files changed, 78 insertions(+), 34 deletions(-)
 copy sysdeps/mach/hurd/{lgetxattr.c => llistxattr.c} (86%)
 copy sysdeps/mach/hurd/{removexattr.c => lremovexattr.c} (85%)


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]