Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Feb 2010 02:23:28 +0300
From:      "Alexander Zagrebin" <alexz@visp.ru>
To:        <freebsd-fs@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   ZFS allows deletion of files in a sticky directory
Message-ID:  <3A28259E0677447BBFDECFCCDBD97FD5@vosz.local>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
I have found that directory entry may be deleted from a ZFS directory
with the sticky bit, if "the entry is a plain file and you have write
access"
(this is citation from a comments in zfs_dir.c)
But this behavior isn't described in the sticky(8) and isn't allowed on a
UFS.
The attached patch provides the UFS-like behavior of a sticky directories on
a ZFS.
Is this bug or feature?

-- 
Alexander Zagrebin

[-- Attachment #2 --]
--- /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c.orig	2009-07-20 23:16:42.000000000 +0400
+++ /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c	2010-02-20 01:23:45.112613715 +0300
@@ -962,7 +962,6 @@
  *
  *	you own the directory,
  *	you own the entry,
- *	the entry is a plain file and you have write access,
  *	or you are privileged (checked in secpolicy...).
  *
  * The function returns 0 if remove access is granted.
@@ -984,9 +983,7 @@
 	downer = zfs_fuid_map_id(zfsvfs, zdp->z_phys->zp_uid, cr, ZFS_OWNER);
 	fowner = zfs_fuid_map_id(zfsvfs, zp->z_phys->zp_uid, cr, ZFS_OWNER);
 
-	if ((uid = crgetuid(cr)) == downer || uid == fowner ||
-	    (ZTOV(zp)->v_type == VREG &&
-	    zfs_zaccess(zp, ACE_WRITE_DATA, 0, B_FALSE, cr) == 0))
+	if ((uid = crgetuid(cr)) == downer || uid == fowner)
 		return (0);
 	else
 		return (secpolicy_vnode_remove(ZTOV(zp), cr));

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A28259E0677447BBFDECFCCDBD97FD5>