Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/sys/miscfs/genfs Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/c7b7c8c14291
branches:  netbsd-10
changeset: 373827:c7b7c8c14291
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 05 14:34:59 2023 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #111):

        sys/miscfs/genfs/genfs_vnops.c: revision 1.220

Fix genfs_can_chtimes() to also handle the condition:

  If the time pointer is null, then write permission
  on the file is also sufficient.

>From FreeBSD.

Should fix PR kern/57246 "NFS group permissions regression"

diffstat:

 sys/miscfs/genfs/genfs_vnops.c |  25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diffs (48 lines):

diff -r 16d05f68c636 -r c7b7c8c14291 sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c    Sun Mar 05 14:32:41 2023 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c    Sun Mar 05 14:34:59 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_vnops.c,v 1.219 2022/03/27 17:10:55 christos Exp $       */
+/*     $NetBSD: genfs_vnops.c,v 1.219.4.1 2023/03/05 14:34:59 martin Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.219 2022/03/27 17:10:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.219.4.1 2023/03/05 14:34:59 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1315,23 +1315,14 @@
         * will be allowed to set the times [..] to the current 
         * server time.
         */
-       if ((error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred)) != 0)
+       error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred);
+       if (error != 0 && (vaflags & VA_UTIMES_NULL) != 0)
+               error = VOP_ACCESS(vp, VWRITE, cred);
+
+       if (error)
                return (vaflags & VA_UTIMES_NULL) == 0 ? EPERM : EACCES;
 
-       /* Must be owner, or... */
-       if (kauth_cred_geteuid(cred) == owner_uid)
-               return (0);
-
-       /* set the times to the current time, and... */
-       if ((vaflags & VA_UTIMES_NULL) == 0)
-               return (EPERM);
-
-       /* have write access. */
-       error = VOP_ACCESS(vp, VWRITE, cred);
-       if (error)
-               return (error);
-
-       return (0);
+       return 0;
 }
 
 /*



Home | Main Index | Thread Index | Old Index