Page MenuHomeFreeBSD
Paste P649

Command-Line Input
ActivePublic

Authored by jhb on Oct 4 2024, 8:57 PM.
Tags
None
Referenced Files
F98818479: Command-Line Input
Oct 4 2024, 8:57 PM
Subscribers
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index 33ca58472490..0453b2f68972 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -120,7 +120,7 @@ cd9660_access(struct vop_access_args *ap)
struct vnode *vp = ap->a_vp;
struct iso_node *ip = VTOI(vp);
accmode_t accmode = ap->a_accmode;
- accmode_t file_mode;
+ accmode_t file_mode, mask;
uid_t uid;
gid_t gid;
@@ -144,8 +144,9 @@ cd9660_access(struct vop_access_args *ap)
}
}
- file_mode = ip->inode.iso_mode;
- file_mode &= (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask;
+ mask = (ALLPERMS & ~ACCESSPERMS) |
+ (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask;
+ file_mode = ip->inode.iso_mode & mask;
uid = (ip->i_mnt->im_flags & ISOFSMNT_UID) ?
ip->i_mnt->im_uid : ip->inode.iso_uid;
@@ -176,12 +177,14 @@ cd9660_getattr(struct vop_getattr_args *ap)
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
struct iso_node *ip = VTOI(vp);
+ mode_t mask;
vap->va_fsid = dev2udev(ip->i_mnt->im_dev);
vap->va_fileid = ip->i_number;
- vap->va_mode = ip->inode.iso_mode;
- vap->va_mode &= (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask;
+ mask = (ALLPERMS & ~ACCESSPERMS) |
+ (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask;
+ vap->va_mode = ip->inode.iso_mode & mask;
vap->va_nlink = ip->inode.iso_links;
vap->va_uid = (ip->i_mnt->im_flags & ISOFSMNT_UID) ?

Event Timeline

Why not simply use ALLPERMS as the default for im_[df]mask? the above would then be unnecessary, the behavior would be backwards compatible, and anyone who wants to disable setuid can just use 'mask=0777'

I'm not opposed to that necessarily. We discussed this a bit more in the review at D46948 if you'd like to chime in there.