From dfa7fd1d706480334ef39301e55b57481d959e72 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Wed, 10 Sep 2008 13:16:41 +0000 Subject: [PATCH] Remove VSVTX, VSGID and VSUID. This should be a no-op, as VSVTX == S_ISVTX, VSGID == S_ISGID and VSUID == S_ISUID. Approved by: rwatson (mentor) --- .../contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 4 ++-- sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h | 2 +- sys/kern/kern_exec.c | 9 +++++---- sys/security/mac_bsdextended/mac_bsdextended.c | 5 +++-- sys/sys/param.h | 2 +- sys/sys/vnode.h | 3 --- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index bb02a272cae5..7fd9a817f5eb 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -1191,8 +1191,8 @@ zfs_create(vnode_t *dvp, char *name, vattr_t *vap, int excl, int mode, top: *vpp = NULL; - if ((vap->va_mode & VSVTX) && secpolicy_vnode_stky_modify(cr)) - vap->va_mode &= ~VSVTX; + if ((vap->va_mode & S_ISVTX) && secpolicy_vnode_stky_modify(cr)) + vap->va_mode &= ~S_ISVTX; if (*name == '\0') { /* diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h b/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h index b173442a3d45..c4483eaf8d93 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h @@ -489,7 +489,7 @@ typedef struct xfs_vattr { * Check whether mandatory file locking is enabled. */ #define MANDLOCK(vp, mode) \ - ((vp)->v_vnode->v_type == VREG && ((mode) & (VSGID|(VEXEC>>3))) == VSGID) + ((vp)->v_vnode->v_type == VREG && ((mode) & (S_ISGID|(VEXEC>>3))) == S_ISGID) extern void vn_init(void); extern int vn_wait(struct xfs_vnode *); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index ab972f1a767f..9ca2f96a27f0 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef KTRACE #include #endif @@ -622,9 +623,9 @@ interpret: */ oldcred = p->p_ucred; credential_changing = 0; - credential_changing |= (attr.va_mode & VSUID) && oldcred->cr_uid != + credential_changing |= (attr.va_mode & S_ISUID) && oldcred->cr_uid != attr.va_uid; - credential_changing |= (attr.va_mode & VSGID) && oldcred->cr_gid != + credential_changing |= (attr.va_mode & S_ISGID) && oldcred->cr_gid != attr.va_gid; #ifdef MAC will_transition = mac_vnode_execve_will_transition(oldcred, imgp->vp, @@ -675,9 +676,9 @@ interpret: * Set the new credentials. */ crcopy(newcred, oldcred); - if (attr.va_mode & VSUID) + if (attr.va_mode & S_ISUID) change_euid(newcred, euip); - if (attr.va_mode & VSGID) + if (attr.va_mode & S_ISGID) change_egid(newcred, attr.va_gid); #ifdef MAC if (will_transition) { diff --git a/sys/security/mac_bsdextended/mac_bsdextended.c b/sys/security/mac_bsdextended/mac_bsdextended.c index b55056c897a5..cb993dbfba26 100644 --- a/sys/security/mac_bsdextended/mac_bsdextended.c +++ b/sys/security/mac_bsdextended/mac_bsdextended.c @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -303,7 +304,7 @@ ugidfw_rulecheck(struct mac_bsdextended_rule *rule, } if (rule->mbr_object.mbo_flags & MBO_SUID) { - match = (vap->va_mode & VSUID); + match = (vap->va_mode & S_ISUID); if (rule->mbr_object.mbo_neg & MBO_SUID) match = !match; if (!match) @@ -311,7 +312,7 @@ ugidfw_rulecheck(struct mac_bsdextended_rule *rule, } if (rule->mbr_object.mbo_flags & MBO_SGID) { - match = (vap->va_mode & VSGID); + match = (vap->va_mode & S_ISGID); if (rule->mbr_object.mbo_neg & MBO_SGID) match = !match; if (!match) diff --git a/sys/sys/param.h b/sys/sys/param.h index 4b1062b6561a..b211274420d8 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800046 /* Master, propagated to newvers */ +#define __FreeBSD_version 800047 /* Master, propagated to newvers */ #ifndef LOCORE #include diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index b523bf5a4134..990b5dfde7ef 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -314,9 +314,6 @@ struct vattr { #define VEXEC 000100 /* execute/search permission */ #define VWRITE 000200 /* write permission */ #define VREAD 000400 /* read permission */ -#define VSVTX 001000 /* save swapped text even after use */ -#define VSGID 002000 /* set group id on execution */ -#define VSUID 004000 /* set user id on execution */ #define VADMIN 010000 /* permission to administer */ #define VSTAT 020000 /* permission to retrieve attrs */ #define VAPPEND 040000 /* permission to write/append */