summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-28 16:11:54 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-28 16:11:54 +0000
commit2f51b3bf3752c5774fc7a8bcd564eef3a3cb7c70 (patch)
tree125062b0171030e0719cc14bfd0d619ed359dcfa /bin
parentd9cc6ef5d52ad0239fa17c7bedb3529f1922809c (diff)
downloadportage-2f51b3bf3752c5774fc7a8bcd564eef3a3cb7c70.tar.gz
portage-2f51b3bf3752c5774fc7a8bcd564eef3a3cb7c70.tar.bz2
portage-2f51b3bf3752c5774fc7a8bcd564eef3a3cb7c70.zip
Bug #203323 - Fix the FEATURES=sfperms code so that it doesn't chmod
g-r on binaries that are both setuid and setgid. In that case, just chmod o-r. (trunk r9061) svn path=/main/branches/2.1.2/; revision=9075
Diffstat (limited to 'bin')
-rwxr-xr-xbin/misc-functions.sh25
1 files changed, 19 insertions, 6 deletions
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 3fe748760..1395ff29c 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -422,15 +422,28 @@ preinst_sfperms() {
fi
# Smart FileSystem Permissions
if hasq sfperms $FEATURES; then
+ local i
for i in $(find "${D}" -type f -perm -4000); do
- ebegin ">>> SetUID: [chmod go-r] $i "
- chmod go-r "$i"
- eend $?
+ if [ -n "$(find "$i" -perm -2000)" ] ; then
+ ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${D}}"
+ chmod o-r "$i"
+ eend $?
+ else
+ ebegin ">>> SetUID: [chmod go-r] /${i#${D}}"
+ chmod go-r "$i"
+ eend $?
+ fi
done
for i in $(find "${D}" -type f -perm -2000); do
- ebegin ">>> SetGID: [chmod o-r] $i "
- chmod o-r "$i"
- eend $?
+ if [ -n "$(find "$i" -perm -4000)" ] ; then
+ # This case is already handled
+ # by the SetUID check above.
+ true
+ else
+ ebegin ">>> SetGID: [chmod o-r] /${i#${D}}"
+ chmod o-r "$i"
+ eend $?
+ fi
done
fi
}