diff options
author | 2016-05-21 18:11:36 +0000 | |
---|---|---|
committer | 2016-05-21 18:11:36 +0000 | |
commit | c8faf75d9456cfa0ba46385821c80693228e2764 (patch) | |
tree | 0145b933b0a36eee8ced9f37c9ea5aa8324e7489 | |
parent | Simple sync with NetBSD, mostly to avoid confusion of arguments and (diff) | |
download | wireguard-openbsd-c8faf75d9456cfa0ba46385821c80693228e2764.tar.xz wireguard-openbsd-c8faf75d9456cfa0ba46385821c80693228e2764.zip |
Remove the -x flag from mount_msdos and always assume the execute bit
for readable directories, while making it subject to the mask option
(-m in mount_msdos), so it is still possible to mount with
non-executable directories, but with semantics that are easier to
comprehend.
This makes directory listings with default mount options work again.
ok deraadt@
-rw-r--r-- | sbin/mount/mount.c | 4 | ||||
-rw-r--r-- | sbin/mount_msdos/mount_msdos.8 | 16 | ||||
-rw-r--r-- | sbin/mount_msdos/mount_msdos.c | 7 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 22 | ||||
-rw-r--r-- | sys/msdosfs/msdosfsmount.h | 6 | ||||
-rw-r--r-- | sys/sys/mount.h | 3 |
6 files changed, 19 insertions, 39 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index b868dbd8b58..04420c68e34 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.c,v 1.61 2015/11/23 23:26:59 deraadt Exp $ */ +/* $OpenBSD: mount.c,v 1.62 2016/05/21 18:11:36 natano Exp $ */ /* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */ /* @@ -588,8 +588,6 @@ prmount(struct statfs *sf) (void)printf("%s%s", !f++ ? " (" : ", ", "long"); if (msdosfs_args->flags & MSDOSFSMNT_NOWIN95) (void)printf("%s%s", !f++ ? " (" : ", ", "nowin95"); - if (msdosfs_args->flags & MSDOSFSMNT_ALLOWDIRX) - (void)printf("%s%s", !f++ ? " (" : ", ", "direxec"); } else if (strcmp(sf->f_fstypename, MOUNT_CD9660) == 0) { struct iso_args *iso_args = &sf->mount_info.iso_args; diff --git a/sbin/mount_msdos/mount_msdos.8 b/sbin/mount_msdos/mount_msdos.8 index 5e8bf65bd71..21010296f0d 100644 --- a/sbin/mount_msdos/mount_msdos.8 +++ b/sbin/mount_msdos/mount_msdos.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mount_msdos.8,v 1.27 2010/10/14 07:05:43 jmc Exp $ +.\" $OpenBSD: mount_msdos.8,v 1.28 2016/05/21 18:11:36 natano Exp $ .\" $NetBSD: mount_msdos.8,v 1.10 1996/01/19 21:14:43 leo Exp $ .\" .\" Copyright (c) 1993,1994 Christopher G. Demetriou @@ -29,7 +29,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: October 14 2010 $ +.Dd $Mdocdate: May 21 2016 $ .Dt MOUNT_MSDOS 8 .Os .Sh NAME @@ -139,8 +139,6 @@ Set the owner of the files in the file system to .Ar uid . The default owner is the owner of the directory on which the file system is being mounted. -.It Fl x -If a directory is readable, it inherits the x attribute as well. .El .Pp File permissions for FAT file systems are imitated, @@ -162,15 +160,7 @@ or unset using .Li chmod +w . .Pp File modes work the same way for directories. -However if a directory is mounted with -.Fl x , -it will inherit the executable bit if it is readable. -This can be useful for making files non-executable -and directories executable: -using -.Li -x -m 644 -will in most cases give permissions of 755 for directories -and 644 for files. +However a directory will inherit the executable bit if it is readable. See .Xr chmod 1 for more information about octal file modes. diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index a7d353518d6..021cb2a1013 100644 --- a/sbin/mount_msdos/mount_msdos.c +++ b/sbin/mount_msdos/mount_msdos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_msdos.c,v 1.31 2015/11/02 01:22:37 chl Exp $ */ +/* $OpenBSD: mount_msdos.c,v 1.32 2016/05/21 18:11:36 natano Exp $ */ /* $NetBSD: mount_msdos.c,v 1.16 1996/10/24 00:12:50 cgd Exp $ */ /* @@ -71,7 +71,7 @@ main(int argc, char **argv) mntflags = set_gid = set_uid = set_mask = 0; (void)memset(&args, '\0', sizeof(args)); - while ((c = getopt(argc, argv, "sl9xu:g:m:o:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:o:")) != -1) { switch (c) { case 's': args.flags |= MSDOSFSMNT_SHORTNAME; @@ -82,9 +82,6 @@ main(int argc, char **argv) case '9': args.flags |= MSDOSFSMNT_NOWIN95; break; - case 'x': - args.flags |= MSDOSFSMNT_ALLOWDIRX; - break; case 'u': args.uid = a_uid(optarg); set_uid = 1; diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index c97a219f24f..b681887a31f 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.110 2016/05/21 15:11:46 deraadt Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.111 2016/05/21 18:11:36 natano Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -225,13 +225,12 @@ msdosfs_access(void *v) dosmode = (S_IRUSR|S_IRGRP|S_IROTH); if ((dep->de_Attributes & ATTR_READONLY) == 0) dosmode |= (S_IWUSR|S_IWGRP|S_IWOTH); - dosmode &= pmp->pm_mask; - if (dep->de_Attributes & ATTR_DIRECTORY - && pmp->pm_flags & MSDOSFSMNT_ALLOWDIRX) { + if (dep->de_Attributes & ATTR_DIRECTORY) { dosmode |= (dosmode & S_IRUSR) ? S_IXUSR : 0; dosmode |= (dosmode & S_IRGRP) ? S_IXGRP : 0; dosmode |= (dosmode & S_IROTH) ? S_IXOTH : 0; } + dosmode &= pmp->pm_mask; return (vaccess(ap->a_vp->v_type, dosmode, pmp->pm_uid, pmp->pm_gid, ap->a_mode, ap->a_cred)); @@ -303,17 +302,16 @@ msdosfs_getattr(void *v) } vap->va_fileid = fileid; - vap->va_mode = (S_IRUSR|S_IRGRP|S_IROTH) | - ((dep->de_Attributes & ATTR_READONLY) ? 0 : (S_IWUSR|S_IWGRP|S_IWOTH)); - vap->va_mode &= dep->de_pmp->pm_mask; + vap->va_mode = (S_IRUSR|S_IRGRP|S_IROTH); + if ((dep->de_Attributes & ATTR_READONLY) == 0) + vap->va_mode |= (S_IWUSR|S_IWGRP|S_IWOTH); if (dep->de_Attributes & ATTR_DIRECTORY) { vap->va_mode |= S_IFDIR; - if (pmp->pm_flags & MSDOSFSMNT_ALLOWDIRX) { - vap->va_mode |= (vap->va_mode & S_IRUSR) ? S_IXUSR : 0; - vap->va_mode |= (vap->va_mode & S_IRGRP) ? S_IXGRP : 0; - vap->va_mode |= (vap->va_mode & S_IROTH) ? S_IXOTH : 0; - } + vap->va_mode |= (vap->va_mode & S_IRUSR) ? S_IXUSR : 0; + vap->va_mode |= (vap->va_mode & S_IRGRP) ? S_IXGRP : 0; + vap->va_mode |= (vap->va_mode & S_IROTH) ? S_IXOTH : 0; } + vap->va_mode &= dep->de_pmp->pm_mask; vap->va_nlink = 1; vap->va_gid = dep->de_pmp->pm_gid; vap->va_uid = dep->de_pmp->pm_uid; diff --git a/sys/msdosfs/msdosfsmount.h b/sys/msdosfs/msdosfsmount.h index 5c1b67c3fc4..dc892feab1f 100644 --- a/sys/msdosfs/msdosfsmount.h +++ b/sys/msdosfs/msdosfsmount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfsmount.h,v 1.20 2015/10/23 10:45:31 krw Exp $ */ +/* $OpenBSD: msdosfsmount.h,v 1.21 2016/05/21 18:11:36 natano Exp $ */ /* $NetBSD: msdosfsmount.h,v 1.16 1997/10/17 11:24:24 ws Exp $ */ /*- @@ -96,13 +96,11 @@ struct msdosfsmount { #define MSDOSFSMNT_SHORTNAME 0x01 #define MSDOSFSMNT_LONGNAME 0x02 #define MSDOSFSMNT_NOWIN95 0x04 -#define MSDOSFSMNT_ALLOWDIRX 0x10 #endif /* All flags above: */ #define MSDOSFSMNT_MNTOPT \ - (MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \ - |MSDOSFSMNT_ALLOWDIRX) + (MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95) #define MSDOSFSMNT_RONLY 0x80000000 /* mounted read-only */ #define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */ #define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */ diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 1939f0c1e4b..caa5b08ace1 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.123 2016/02/27 18:50:38 natano Exp $ */ +/* $OpenBSD: mount.h,v 1.124 2016/05/21 18:11:36 natano Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -218,7 +218,6 @@ struct msdosfs_args { #define MSDOSFSMNT_SHORTNAME 0x01 /* Force old DOS short names only */ #define MSDOSFSMNT_LONGNAME 0x02 /* Force Win'95 long names */ #define MSDOSFSMNT_NOWIN95 0x04 /* Completely ignore Win95 entries */ -#define MSDOSFSMNT_ALLOWDIRX 0x10 /* dir is mode +x if r */ /* * Arguments to mount ntfs filesystems |