From 2edb61e3f955bfcc9dd3cb6b3b1acfe4806234a6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 20 Sep 2004 00:16:11 +0000 Subject: Update. * sysdeps/unix/sysv/linux/setegid.c [HAVE_PTR__NPTL_SETXID]: Call callback to set IDs in all other threads as well. * sysdeps/unix/sysv/linux/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/setuid.c: New file. * sysdeps/unix/sysv/linux/setgid.c: New file. * sysdeps/unix/sysv/linux/setreuid.c: New file. * sysdeps/unix/sysv/linux/setregid.c: New file. * sysdeps/unix/sysv/linux/setresuid.c: New file. * sysdeps/unix/sysv/linux/setresgid.c: New file. * sysdeps/unix/sysv/linux/i386/sysdep.h: Define INTERNAL_SYSCALL_NCS. * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Use x86 version. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Remove setresgid and setresuid. * nscd/aicache.c: Use pthread_seteuid_np instead of seteuid. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/pwdcache.c: Likewise. --- linuxthreads/ChangeLog | 22 ++++++++++++++++++++++ linuxthreads/Makefile | 6 +++++- linuxthreads/Versions | 6 ++++++ linuxthreads/pthread_setegid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_seteuid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_setgid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_setregid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_setresgid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_setresuid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_setreuid.c | 27 +++++++++++++++++++++++++++ linuxthreads/pthread_setuid.c | 27 +++++++++++++++++++++++++++ linuxthreads/sysdeps/pthread/pthread.h | 30 ++++++++++++++++++++++++++++++ 12 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 linuxthreads/pthread_setegid.c create mode 100644 linuxthreads/pthread_seteuid.c create mode 100644 linuxthreads/pthread_setgid.c create mode 100644 linuxthreads/pthread_setregid.c create mode 100644 linuxthreads/pthread_setresgid.c create mode 100644 linuxthreads/pthread_setresuid.c create mode 100644 linuxthreads/pthread_setreuid.c create mode 100644 linuxthreads/pthread_setuid.c (limited to 'linuxthreads') diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index e31fd400e5..4a107da62a 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,25 @@ +2004-09-19 Ulrich Drepper + + * sysdeps/pthread/pthread.h: Declare pthread_setgid_np, + pthread_setuid_np, pthread_setegid_np, pthread_seteuid_np, + pthread_setregid_np, pthread_setreuid_np, pthread_setresgid_np, + and pthread_setresuid_np. + * pthread_setgid_np.c: New file. + * pthread_setuid_np.c: New file. + * pthread_setegid_np.c: New file. + * pthread_seteuid_np.c: New file. + * pthread_setregid_np.c: New file. + * pthread_setreuid_np.c: New file. + * pthread_setresgid_np.c: New file. + * pthread_setresuid_np.c: New file. + * Versions [libpthread, GLIBC_2.3.4]: Add pthread_setgid_np, + pthread_setuid_np, pthread_setegid_np, pthread_seteuid_np, + pthread_setregid_np, pthread_setreuid_np, pthread_setresgid_np, + and pthread_setresuid_np. + * Makefile (libpthread-routines): Add pthread_setuid, pthread_seteuid, + pthread_setreuid, pthread_setresuid, pthread_setgid, pthread_setegid, + pthread_setregid, and pthread_setresgid. + 2004-09-12 Ulrich Drepper * sysdeps/pthread/pthread.h: Make rwlock prototypes available also diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile index 926de32913..79d412df91 100644 --- a/linuxthreads/Makefile +++ b/linuxthreads/Makefile @@ -51,7 +51,11 @@ libpthread-routines := attr cancel condvar join manager mutex ptfork \ ptw-open ptw-open64 ptw-pause ptw-pread ptw-pread64 \ ptw-pwrite ptw-pwrite64 ptw-tcdrain ptw-wait \ ptw-waitpid pt-system old_pthread_atfork pthread_atfork \ - ptcleanup + ptcleanup \ + pthread_setuid pthread_seteuid pthread_setreuid \ + pthread_setresuid \ + pthread_setgid pthread_setegid pthread_setregid \ + pthread_setresgid # Don't generate deps for calls with no sources. See sysdeps/unix/Makefile. omit-deps = $(unix-syscalls:%=ptw-%) diff --git a/linuxthreads/Versions b/linuxthreads/Versions index b9de1612c3..51896974e5 100644 --- a/linuxthreads/Versions +++ b/linuxthreads/Versions @@ -172,6 +172,12 @@ libpthread { pthread_cond_wait; pthread_cond_timedwait; pthread_cond_signal; pthread_cond_broadcast; } + GLIBC_2.3.4 { + pthread_setuid_np; pthread_seteuid_np; pthread_setreuid_np; + pthread_setresuid_np; + pthread_setgid_np; pthread_setegid_np; pthread_setregid_np; + pthread_setresgid_np; + } GLIBC_PRIVATE { # Internal libc interface to libpthread __pthread_initialize; diff --git a/linuxthreads/pthread_setegid.c b/linuxthreads/pthread_setegid.c new file mode 100644 index 0000000000..9e16828fa5 --- /dev/null +++ b/linuxthreads/pthread_setegid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setegid_np (gid_t gid) +{ + return setegid (gid); +} diff --git a/linuxthreads/pthread_seteuid.c b/linuxthreads/pthread_seteuid.c new file mode 100644 index 0000000000..9d29d81118 --- /dev/null +++ b/linuxthreads/pthread_seteuid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_seteuid_np (uid_t uid) +{ + return seteuid (uid); +} diff --git a/linuxthreads/pthread_setgid.c b/linuxthreads/pthread_setgid.c new file mode 100644 index 0000000000..db37dd1465 --- /dev/null +++ b/linuxthreads/pthread_setgid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setgid_np (gid_t gid) +{ + return setgid (gid); +} diff --git a/linuxthreads/pthread_setregid.c b/linuxthreads/pthread_setregid.c new file mode 100644 index 0000000000..bd75154c50 --- /dev/null +++ b/linuxthreads/pthread_setregid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setregid_np (gid_t rgid, gid_t egid) +{ + return setregid (rgid, egid); +} diff --git a/linuxthreads/pthread_setresgid.c b/linuxthreads/pthread_setresgid.c new file mode 100644 index 0000000000..b5702804ee --- /dev/null +++ b/linuxthreads/pthread_setresgid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setresgid_np (gid_t rgid, gid_t egid, gid_t sgid) +{ + return setresgid (rgid, egid, sgid); +} diff --git a/linuxthreads/pthread_setresuid.c b/linuxthreads/pthread_setresuid.c new file mode 100644 index 0000000000..ceb724deaf --- /dev/null +++ b/linuxthreads/pthread_setresuid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setresuid_np (uid_t ruid, uid_t euid, uid_t suid) +{ + return setresuid (ruid, euid, suid); +} diff --git a/linuxthreads/pthread_setreuid.c b/linuxthreads/pthread_setreuid.c new file mode 100644 index 0000000000..ae8933ece5 --- /dev/null +++ b/linuxthreads/pthread_setreuid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setreuid_np (uid_t ruid, uid_t euid) +{ + return setreuid (ruid, euid); +} diff --git a/linuxthreads/pthread_setuid.c b/linuxthreads/pthread_setuid.c new file mode 100644 index 0000000000..f82ccc1a2f --- /dev/null +++ b/linuxthreads/pthread_setuid.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +int +pthread_setuid_np (uid_t uid) +{ + return setuid (uid); +} diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h index 86c7ff7391..9589e968b5 100644 --- a/linuxthreads/sysdeps/pthread/pthread.h +++ b/linuxthreads/sysdeps/pthread/pthread.h @@ -681,6 +681,36 @@ extern int pthread_atfork (void (*__prepare) (void), extern void pthread_kill_other_threads_np (void) __THROW; + +#ifdef __USE_GNU +/* Change UID of calling thread. */ +extern int pthread_setuid_np (__uid_t __uid) __THROW; + +/* Change effective UID of calling thread. */ +extern int pthread_seteuid_np (__uid_t __uid) __THROW; + +/* Change real and effective UID of calling thread. */ +extern int pthread_setreuid_np (__uid_t __ruid, __uid_t __euid) __THROW; + +/* Change real, effective, and saved UID of calling thread. */ +extern int pthread_setresuid_np (__uid_t __ruid, __uid_t __euid, + __uid_t __suid) __THROW; + + +/* Change GID of calling thread. */ +extern int pthread_setgid_np (__gid_t __gid) __THROW; + +/* Change effective GID of calling thread. */ +extern int pthread_setegid_np (__gid_t __gid) __THROW; + +/* Change real and effective GID of calling thread. */ +extern int pthread_setregid_np (__gid_t __rgid, __gid_t __egid) __THROW; + +/* Change real, effective, and saved GID of calling thread. */ +extern int pthread_setresgid_np (__gid_t __rgid, __gid_t __egid, + __gid_t __sgid) __THROW; +#endif + __END_DECLS #endif /* pthread.h */ -- cgit v1.2.3