aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_acl_posix1e.c
diff options
context:
space:
mode:
authorJaakko Heinonen <jh@FreeBSD.org>2010-08-30 16:30:18 +0000
committerJaakko Heinonen <jh@FreeBSD.org>2010-08-30 16:30:18 +0000
commitde478dd4b427a1f2c667af80784c58e5d73892e3 (patch)
tree74e3c2e0dd77b8186e54fea709c4eef6f29e2ae5 /sys/kern/subr_acl_posix1e.c
parente7fb66340e060b9837c228fde0b7155592cb42b2 (diff)
downloadsrc-de478dd4b427a1f2c667af80784c58e5d73892e3.tar.gz
src-de478dd4b427a1f2c667af80784c58e5d73892e3.zip
Notes
Diffstat (limited to 'sys/kern/subr_acl_posix1e.c')
-rw-r--r--sys/kern/subr_acl_posix1e.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c
index f6fc6b2f9902..311b214ff37f 100644
--- a/sys/kern/subr_acl_posix1e.c
+++ b/sys/kern/subr_acl_posix1e.c
@@ -90,8 +90,14 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, gid_t file_gid,
PRIV_VFS_LOOKUP, 0))
priv_granted |= VEXEC;
} else {
- if ((accmode & VEXEC) && !priv_check_cred(cred,
- PRIV_VFS_EXEC, 0))
+ /*
+ * Ensure that at least one execute bit is on. Otherwise,
+ * a privileged user will always succeed, and we don't want
+ * this to happen unless the file really is executable.
+ */
+ if ((accmode & VEXEC) && (acl_posix1e_acl_to_mode(acl) &
+ (S_IXUSR | S_IXGRP | S_IXOTH)) != 0 &&
+ !priv_check_cred(cred, PRIV_VFS_EXEC, 0))
priv_granted |= VEXEC;
}