kern/114847: [PATCH]: dirmask support for NTFS ala MSDOSFS
Ighighi
ighighi at gmail.com
Tue Jul 24 05:00:16 UTC 2007
The following reply was made to PR kern/114847; it has been noted by GNATS.
From: Ighighi <ighighi at gmail.com>
To: bug-followup at freebsd.org
Cc:
Subject: Re: kern/114847: [PATCH]: dirmask support for NTFS ala MSDOSFS
Date: Tue, 24 Jul 2007 00:55:40 -0400
This is a multi-part message in MIME format.
--------------000100080803040209010208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
This patch adds search permissions to directories on NTFS volumes so you
don't need to add them
to the "-m mask" option in mount_ntfs(8) since those permissions most
likely make no sense on
regular files anyway. It preserves ABI compatibility.
To apply this patch, run:
patch -d /usr < /path/do/patch
Now, either rebuild the world and the kernel or run:
cd /usr/src/sys/modules/ntfs
make clean && make && make install clean
kldunload -v ntfs
kldload -v ntfs
Enjoy, you may now use -m644 in /etc/fstab and still browse directories:
/dev/ad0s1 /mnt/win ntfs ro,noexec,noatime,-m644 0 0
--------------000100080803040209010208
Content-Type: text/x-patch;
name="ntfs_vnops.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ntfs_vnops.c.patch"
#
# (!c) 2007 by Ighighi
#
# This patch adds search permissions to directories on NTFS volumes so
# you don't need to add them to the "-m mask" option in mount_ntfs(8)
# since those permissions most likely make no sense on files anyway...
#
# To apply this patch, run:
# patch -d /usr < /path/do/patch
# Now, either rebuild the world and the kernel or run:
# cd /usr/src/sys/modules/ntfs
# make clean && make && make install clean
# kldunload -v ntfs
# kldload -v ntfs
#
# Enjoy, you may now use -m644 in /etc/fstab and still browse directories:
# /dev/ad0s1 /mnt/win ntfs ro,noexec,noatime,-m644 0 0
#
--- src/sys/fs/ntfs/ntfs_vnops.c.orig 2006-11-15 21:47:02.000000000 -0400
+++ src/sys/fs/ntfs/ntfs_vnops.c 2007-07-23 19:29:09.000000000 -0400
@@ -187,6 +187,8 @@
vap->va_fsid = dev2udev(ip->i_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mp->ntm_mode;
+ if (vp->v_type == VDIR)
+ vap->va_mode |= (VEXEC | VEXEC >> 3 | VEXEC >> 6);
vap->va_nlink = (ip->i_nlink || ip->i_flag & IN_LOADED ? ip->i_nlink : 1);
vap->va_uid = ip->i_mp->ntm_uid;
vap->va_gid = ip->i_mp->ntm_gid;
@@ -392,13 +394,17 @@
{
struct vnode *vp = ap->a_vp;
struct ntnode *ip = VTONT(vp);
- mode_t mode = ap->a_mode;
+ mode_t file_mode, mode = ap->a_mode;
#ifdef QUOTA
int error;
#endif
dprintf(("ntfs_access: %d\n",ip->i_number));
+ file_mode = ip->i_mp->ntm_mode;
+ if (vp->v_type == VDIR)
+ file_mode |= (S_IXUSR | S_IXGRP | S_IXOTH);
+
/*
* Disallow write attempts on read-only filesystems;
* unless the file is a socket, fifo, or a block or
@@ -419,7 +425,7 @@
}
}
- return (vaccess(vp->v_type, ip->i_mp->ntm_mode, ip->i_mp->ntm_uid,
+ return (vaccess(vp->v_type, file_mode, ip->i_mp->ntm_uid,
ip->i_mp->ntm_gid, ap->a_mode, ap->a_cred, NULL));
}
--------------000100080803040209010208--
More information about the freebsd-bugs
mailing list