Blame SOURCES/glibc-rh736346.patch

b40826
2011-01-14  Ulrich Drepper  <drepper@gmail.com>
b40826
b40826
	[BZ #10563]
b40826
	* sysdeps/unix/sysv/linux/i386/setgroups.c: Use INLINE_SETXID_SYSCALL
b40826
	to make the syscall.
b40826
	* sysdeps/unix/sysv/linux/setgroups.c: New file.
b40826
b40826
2011-01-14  Ulrich Drepper  <drepper@gmail.com>
b40826
b40826
	[BZ #10563]
b40826
	* sysdeps/pthread/setxid.h (__SETXID_1): Add cast to assignment.
b40826
	(__SETXID_2): Likewise.
b40826
	(__SETXID_3): Likewise.
b40826
b40826
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/pthread/setxid.h
b40826
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
b40826
@@ -20,11 +20,11 @@
b40826
 #include <sysdep.h>
b40826
 
b40826
 #define __SETXID_1(cmd, arg1) \
b40826
-  cmd.id[0] = arg1
b40826
+  cmd.id[0] = (long int) arg1
b40826
 #define __SETXID_2(cmd, arg1, arg2) \
b40826
-  __SETXID_1 (cmd, arg1); cmd.id[1] = arg2
b40826
+  __SETXID_1 (cmd, arg1); cmd.id[1] = (long int) arg2
b40826
 #define __SETXID_3(cmd, arg1, arg2, arg3) \
b40826
-  __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = arg3
b40826
+  __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = (long int) arg3
b40826
 
b40826
 #ifdef SINGLE_THREAD
b40826
 # define INLINE_SETXID_SYSCALL(name, nr, args...) \
b40826
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/i386/setgroups.c
b40826
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
b40826
@@ -25,6 +25,7 @@
b40826
 #include <sys/syscall.h>
b40826
 #include <bp-checks.h>
b40826
 
b40826
+#include <setxid.h>
b40826
 #include <linux/posix_types.h>
b40826
 #include <kernel-features.h>
b40826
 
b40826
@@ -44,7 +45,7 @@ int
b40826
 setgroups (size_t n, const gid_t *groups)
b40826
 {
b40826
 #if __ASSUME_32BITUIDS > 0
b40826
-  return INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
b40826
+  return INLINE_SETXID_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
b40826
 #else
b40826
   if (n > (size_t) __sysconf (_SC_NGROUPS_MAX))
b40826
     {
b40826
@@ -62,7 +63,8 @@ setgroups (size_t n, const gid_t *groups
b40826
 	  int result;
b40826
 	  int saved_errno = errno;
b40826
 
b40826
-	  result = INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
b40826
+	  result = INLINE_SETXID_SYSCALL (setgroups32, 2, n,
b40826
+					  CHECK_N (groups, n));
b40826
 	  if (result == 0 || errno != ENOSYS)
b40826
 	    return result;
b40826
 
b40826
@@ -80,7 +82,8 @@ setgroups (size_t n, const gid_t *groups
b40826
 	    }
b40826
 	}
b40826
 
b40826
-      return INLINE_SYSCALL (setgroups, 2, n, CHECK_N (kernel_groups, n));
b40826
+      return INLINE_SETXID_SYSCALL (setgroups, 2, n,
b40826
+				    CHECK_N (kernel_groups, n));
b40826
     }
b40826
 #endif
b40826
 }
b40826
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
b40826
===================================================================
b40826
--- /dev/null
b40826
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
b40826
@@ -0,0 +1,37 @@
b40826
+/* Copyright (C) 1997,1998,2000,2002,2004,2006,2011
b40826
+   Free Software Foundation, Inc.
b40826
+   This file is part of the GNU C Library.
b40826
+
b40826
+   The GNU C Library is free software; you can redistribute it and/or
b40826
+   modify it under the terms of the GNU Lesser General Public
b40826
+   License as published by the Free Software Foundation; either
b40826
+   version 2.1 of the License, or (at your option) any later version.
b40826
+
b40826
+   The GNU C Library is distributed in the hope that it will be useful,
b40826
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
b40826
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b40826
+   Lesser General Public License for more details.
b40826
+
b40826
+   You should have received a copy of the GNU Lesser General Public
b40826
+   License along with the GNU C Library; if not, write to the Free
b40826
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
b40826
+   02111-1307 USA.  */
b40826
+
b40826
+#include <errno.h>
b40826
+#include <grp.h>
b40826
+#include <setxid.h>
b40826
+#include <sysdep.h>
b40826
+
b40826
+
b40826
+/* Set the group set for the current user to GROUPS (N of them).  For
b40826
+   Linux we must convert the array of groups into the format that the
b40826
+   kernel expects.  */
b40826
+int
b40826
+setgroups (size_t n, const gid_t *groups)
b40826
+{
b40826
+#ifdef __NR_setgroups32
b40826
+# error "wrong setgroups.c file used"
b40826
+#endif
b40826
+  return INLINE_SETXID_SYSCALL (setgroups, 2, n, groups);
b40826
+}
b40826
+libc_hidden_def (setgroups)