r4934 - in glibc-package/trunk/debian: . patches/kfreebsd
Author: ps-guest
Date: 2011-09-04 14:06:29 +0000 (Sun, 04 Sep 2011)
New Revision: 4934
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff
Log:
wrap faccessat() X_OK testing for superuser
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2011-09-04 08:07:26 UTC (rev 4933)
+++ glibc-package/trunk/debian/changelog 2011-09-04 14:06:29 UTC (rev 4934)
@@ -21,8 +21,9 @@
detection.
[ Petr Salinger ]
- * kfreebsd/local-sysdeps.diff: update to revision 3696 (from glibc-bsd).
- Fixes ld.so location used inside ldd on kfreebsd-amd64. Closes #640156.
+ * kfreebsd/local-sysdeps.diff: update to revision 3697 (from glibc-bsd).
+ - fixes ld.so location used inside ldd on kfreebsd-amd64. Closes #640156.
+ - wrap faccessat() X_OK testing for superuser. Closes #640325.
-- Aurelien Jarno <aurel32@debian.org> Wed, 24 Aug 2011 12:34:56 +0200
Modified: glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff
===================================================================
--- glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff 2011-09-04 08:07:26 UTC (rev 4933)
+++ glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff 2011-09-04 14:06:29 UTC (rev 4934)
@@ -8933,7 +8933,7 @@
+#endif
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/faccessat.c
-@@ -0,0 +1,171 @@
+@@ -0,0 +1,198 @@
+/* Test for access to file, relative to open directory. Linux version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
@@ -8968,6 +8968,16 @@
+extern int __syscall_faccessat (int fd, const char *path, int mode, int flag);
+libc_hidden_proto (__syscall_faccessat)
+
++/*
++ The FreeBSD kernel do not test file access correctly when the
++ process' real user ID is superuser. In particular, they always return
++ zero when testing execute permissions without regard to whether the
++ file is executable.
++
++ While this behaviour conforms to POSIX.1-2008, it is explicitely
++ discouraged. This wrapper implements the recommended behaviour.
++ */
++
+int
+faccessat (fd, file, mode, flag)
+ int fd;
@@ -8985,7 +8995,24 @@
+ __have_atfcts = -1;
+ else
+# endif
++ {
++ if ((result == 0) && (mode & X_OK))
++ {
++ uid_t uid = (flag & AT_EACCESS) ? __geteuid () : __getuid ();
++ if (uid == 0)
++ {
++ struct stat64 stats;
++ if (fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
++ return -1;
++ if ((stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0)
++ {
++ __set_errno (EACCES);
++ return -1;
++ }
++ }
++ }
+ return result;
++ }
+ }
+
+#ifndef __ASSUME_ATFCTS
Reply to: