summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-06-24 08:21:43 +0000
committerkib <kib@FreeBSD.org>2014-06-24 08:21:43 +0000
commit3b207676966493f5897b60f1575ca81297373eb4 (patch)
tree245675f195f5eed0fb417672371ef12b73f813c6 /sys/ufs
parentcf140f008f5d28d6463422c17af1c4a6013dd0d6 (diff)
downloadFreeBSD-src-3b207676966493f5897b60f1575ca81297373eb4.zip
FreeBSD-src-3b207676966493f5897b60f1575ca81297373eb4.tar.gz
MFC r267564:
In msdosfs_setattr(), add a check for result of the utimes(2) permissions test. Refactor the permission checks for utimes(2).
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_vnops.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 56e24a3..3504f0e 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -635,35 +635,8 @@ ufs_setattr(ap)
return (EROFS);
if ((ip->i_flags & SF_SNAPSHOT) != 0)
return (EPERM);
- /*
- * From utimes(2):
- * If times is NULL, ... The caller must be the owner of
- * the file, have permission to write the file, or be the
- * super-user.
- * If times is non-NULL, ... The caller must be the owner of
- * the file or be the super-user.
- *
- * Possibly for historical reasons, try to use VADMIN in
- * preference to VWRITE for a NULL timestamp. This means we
- * will return EACCES in preference to EPERM if neither
- * check succeeds.
- */
- if (vap->va_vaflags & VA_UTIMES_NULL) {
- /*
- * NFSv4.1, draft 21, 6.2.1.3.1, Discussion of Mask Attributes
- *
- * "A user having ACL_WRITE_DATA or ACL_WRITE_ATTRIBUTES
- * will be allowed to set the times [..] to the current
- * server time."
- *
- * XXX: Calling it four times seems a little excessive.
- */
- error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred, td);
- if (error)
- error = VOP_ACCESS(vp, VWRITE, cred, td);
- } else
- error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred, td);
- if (error)
+ error = vn_utimes_perm(vp, vap, cred, td);
+ if (error != 0)
return (error);
if (vap->va_atime.tv_sec != VNOVAL)
ip->i_flag |= IN_ACCESS;
OpenPOWER on IntegriCloud