aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-16 16:33:36 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-16 16:33:36 +0000
commit9ffbb61221fd5d0ee2b7989d2e5c785efee8cc02 (patch)
tree5c9b303b79c188e0f33571a09c2975ae8eb0e3ce
parent39e4f7f84ec269a2d86a060d417ceaeb21f53305 (diff)
downloadglibc-9ffbb61221fd5d0ee2b7989d2e5c785efee8cc02.tar.xz
glibc-9ffbb61221fd5d0ee2b7989d2e5c785efee8cc02.zip
Update.
* sysdeps/unix/opendir.c: Use O_DIRECTORY if available. If not available double check to verify it's a directory. * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Add O_DIRECTORY. * sysdeps/unix/sysv/linux/mips/bits/fcntl: Likewise. * sysdeps/unix/sysv/linux/bits/fcntl.h: Remove O_* constants which are not generally available. * sysdeps/unix/sysv/linux/i386/bits/fcntl.h: New file. * sysdeps/unix/sysv/linux/i386/setgroups.c: Add range check for values. * sysdeps/unix/sysv/linux/arm/Makefile: New file. * sysdeps/unix/sysv/linux/arm/setegid.c: New file. * sysdeps/unix/sysv/linux/arm/seteuid.c: New file. * sysdeps/unix/sysv/linux/arm/setfsgid.c: New file. * sysdeps/unix/sysv/linux/arm/setfsuid.c: New file. * sysdeps/unix/sysv/linux/arm/setgid.c: New file. * sysdeps/unix/sysv/linux/arm/setgroups.c: New file. * sysdeps/unix/sysv/linux/arm/setresgid.c: New file. * sysdeps/unix/sysv/linux/arm/setresuid.c: New file. * sysdeps/unix/sysv/linux/arm/setuid.c: New file. * sysdeps/unix/sysv/linux/i386/setegid.c: New file. * sysdeps/unix/sysv/linux/i386/seteuid.c: New file. * sysdeps/unix/sysv/linux/i386/setfsgid.c: New file. * sysdeps/unix/sysv/linux/i386/setfsuid.c: New file. * sysdeps/unix/sysv/linux/i386/setgid.c: New file. * sysdeps/unix/sysv/linux/i386/setgroups.c: New file. * sysdeps/unix/sysv/linux/i386/setresgid.c: New file. * sysdeps/unix/sysv/linux/i386/setresuid.c: New file. * sysdeps/unix/sysv/linux/i386/setuid.c: New file. * sysdeps/unix/sysv/linux/m68k/setegid.c: New file. * sysdeps/unix/sysv/linux/m68k/seteuid.c: New file. * sysdeps/unix/sysv/linux/m68k/setfsgid.c: New file. * sysdeps/unix/sysv/linux/m68k/setfsuid.c: New file. * sysdeps/unix/sysv/linux/m68k/setgid.c: New file. * sysdeps/unix/sysv/linux/m68k/setgroups.c: New file. * sysdeps/unix/sysv/linux/m68k/setresgid.c: New file. * sysdeps/unix/sysv/linux/m68k/setresuid.c: New file. * sysdeps/unix/sysv/linux/m68k/setuid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setfsgid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setfsuid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: New file. * 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/setuid.c: New file. * sysdeps/unix/sysv/linux/arm/syscalls.list: Add s_setgid, s_setresuid, s_setresgid, and s_setuid. * sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/Makefile [subdir=misc] (sysdep_routines): Add setfsgid, setfsuid, setresgid, and setresuid. * sysdeps/unix/sysv/linux/m68k/Makefile: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: Likewise. 1998-10-16 Ulrich Drepper <drepper@cygnus.com> * iconv/skeleton.c: Include ELF header only of STATIC_GCONV is not
-rw-r--r--ChangeLog62
-rw-r--r--sysdeps/unix/opendir.c28
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h1
-rw-r--r--sysdeps/unix/sysv/linux/arm/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/arm/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h6
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h138
-rw-r--r--sysdeps/unix/sysv/linux/i386/setegid.c37
-rw-r--r--sysdeps/unix/sysv/linux/i386/seteuid.c53
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsgid.c47
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsuid.c47
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgid.c40
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgroups.c12
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c46
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresuid.c47
-rw-r--r--sysdeps/unix/sysv/linux/i386/setuid.c40
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list6
40 files changed, 645 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index bf6b048d94..d0d34a8e59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,65 @@
1998-10-16 Ulrich Drepper <drepper@cygnus.com>
+ * sysdeps/unix/opendir.c: Use O_DIRECTORY if available. If not
+ available double check to verify it's a directory.
+
+ * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Add O_DIRECTORY.
+ * sysdeps/unix/sysv/linux/mips/bits/fcntl: Likewise.
+ * sysdeps/unix/sysv/linux/bits/fcntl.h: Remove O_* constants which
+ are not generally available.
+ * sysdeps/unix/sysv/linux/i386/bits/fcntl.h: New file.
+
+ * sysdeps/unix/sysv/linux/i386/setgroups.c: Add range check for values.
+ * sysdeps/unix/sysv/linux/arm/Makefile: New file.
+ * sysdeps/unix/sysv/linux/arm/setegid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/seteuid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setfsgid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setfsuid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setgid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setgroups.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setresgid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setresuid.c: New file.
+ * sysdeps/unix/sysv/linux/arm/setuid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setegid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/seteuid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setfsgid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setfsuid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setgid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setgroups.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setresgid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setresuid.c: New file.
+ * sysdeps/unix/sysv/linux/i386/setuid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setegid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/seteuid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setfsgid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setfsuid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setgid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setgroups.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setresgid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setresuid.c: New file.
+ * sysdeps/unix/sysv/linux/m68k/setuid.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/setfsgid.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/setfsuid.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: New file.
+ * 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/setuid.c: New file.
+
+ * sysdeps/unix/sysv/linux/arm/syscalls.list: Add s_setgid, s_setresuid,
+ s_setresgid, and s_setuid.
+ * sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
+ * sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise.
+ * sysdeps/unix/sysv/linux/i386/Makefile [subdir=misc]
+ (sysdep_routines): Add setfsgid, setfsuid, setresgid, and setresuid.
+ * sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: Likewise.
+
+1998-10-16 Ulrich Drepper <drepper@cygnus.com>
+
* time/mktime.c: Define _POSIX_THREAD_SAFE_FUNCTIONS to get
localtime_t declaration on some systems.
@@ -7,7 +67,7 @@
* iconv/Makefile [! elf]: Define CFLAGS-gconv_simple.c to
-DSTATIC_GCONV.
- * iconv/skeleton.c: Include ELF header only of STATIC?GCONV is not
+ * iconv/skeleton.c: Include ELF header only of STATIC_GCONV is not
defined. Avoid using DL_CLL_FCT if it is not defined.
1998-10-16 10:40 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 77f2a0a490..657ad176a8 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -29,6 +29,30 @@
#include <dirstream.h>
+
+/* We want to be really safe the file we opened is a directory. Some systems
+ have support for this, others don't. */
+#ifdef O_DIRECTORY
+# define OPENDIR(NAME) \
+ do { \
+ fd = __open (NAME, O_RDONLY|O_NDELAY|O_DIRECTORY); \
+ if (fd < 0) \
+ return NULL; \
+ } while (0)
+#else
+# define OPENDIR(NAME) \
+ do { \
+ fd = __open (NAME, O_RDONLY|O_NDELAY); \
+ if (fd < 0 || __fstat (fd, &statbuf) < 0 || ! S_ISDIR (statbuf.st_mode)) \
+ { \
+ if (fd >= 0) \
+ __close (fd); \
+ return NULL; \
+ } \
+ } while (0)
+#endif
+
+
/* Open a directory stream on NAME. */
DIR *
__opendir (const char *name)
@@ -58,9 +82,7 @@ __opendir (const char *name)
return NULL;
}
- fd = __open (name, O_RDONLY|O_NDELAY);
- if (fd < 0)
- return NULL;
+ OPENDIR (name);
if (__fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
goto lose;
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index 7cd32a34a3..e67ad19f65 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -45,6 +45,7 @@
#ifdef __USE_GNU
# define O_DIRECT 040000 /* Direct disk access. */
+# define O_DIRECTORY 0100000 /* Must be a directory. */
#endif
/* Not necessary, files are always with 64bit off_t. */
diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
new file mode 100644
index 0000000000..e65a5c1fa3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),misc)
+sysdep_routines += setfsgid setfsuid setresgid setresuid
+endif
diff --git a/sysdeps/unix/sysv/linux/arm/setegid.c b/sysdeps/unix/sysv/linux/arm/setegid.c
new file mode 100644
index 0000000000..2e3a54c893
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/seteuid.c b/sysdeps/unix/sysv/linux/arm/seteuid.c
new file mode 100644
index 0000000000..18e41d08c1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/seteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setfsgid.c b/sysdeps/unix/sysv/linux/arm/setfsgid.c
new file mode 100644
index 0000000000..0886712569
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setfsgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setfsuid.c b/sysdeps/unix/sysv/linux/arm/setfsuid.c
new file mode 100644
index 0000000000..a9f22eb8ab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setfsuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setgid.c b/sysdeps/unix/sysv/linux/arm/setgid.c
new file mode 100644
index 0000000000..377021d9ec
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setgroups.c b/sysdeps/unix/sysv/linux/arm/setgroups.c
new file mode 100644
index 0000000000..0e7086278f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type. */
+#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setresgid.c b/sysdeps/unix/sysv/linux/arm/setresgid.c
new file mode 100644
index 0000000000..daca1a4833
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setresuid.c b/sysdeps/unix/sysv/linux/arm/setresuid.c
new file mode 100644
index 0000000000..3aeabe9ad7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setuid.c b/sysdeps/unix/sysv/linux/arm/setuid.c
new file mode 100644
index 0000000000..de394379be
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/setuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index a3ecdd7d73..3adc087d15 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -2,6 +2,10 @@
s_getgroups getgroups getgroups 2 __syscall_getgroups
s_llseek llseek _llseek 5 __sys_llseek
+s_setgid setgid setgid 1 __syscall_setgid
s_setgroups setgroups setgroups 2 __syscall_setgroups
+s_setresuid setresuid setresuid 3 __syscall_setresuid
+s_setresgid setresgid setresgid 3 __syscall_setresgid
+s_setuid setuid setuid 1 __syscall_setuid
vm86 - vm86 1 __vm86 vm86
syscall - syscall 5 syscall
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index c2a8ee91ac..42ad79f6ab 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -42,7 +42,7 @@
#define O_ASYNC 020000
#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
+# define O_DIRECTORY 040000 /* Must be a directory. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -53,10 +53,6 @@
# define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0100000
-#endif
-
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index c27f390b59..29011fd22e 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,5 +1,6 @@
ifeq ($(subdir),misc)
-sysdep_routines += ioperm iopl vm86 s_pread64 s_pwrite64
+sysdep_routines += ioperm iopl vm86 s_pread64 s_pwrite64 setfsgid setfsuid \
+ setresgid setresuid
sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h
endif
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
new file mode 100644
index 0000000000..0c8afd22fa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -0,0 +1,138 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+<