Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Pass NOCRED instead of NULL for credentials. These ...



details:   https://anonhg.NetBSD.org/src/rev/89a036b69367
branches:  trunk
changeset: 971052:89a036b69367
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 12 13:12:42 2020 +0000

description:
Pass NOCRED instead of NULL for credentials. These routines are supposed
to be accessing system ACL's on behalf of the kernel. This code appears
to be copied from FreeBSD, but there it works because in FreeBSD NOCRED
is 0, ours is -1. I guess nobody has used system extended attributes on
NetBSD yet :-)

diffstat:

 sys/kern/vfs_vnops.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 73193236f0fb -r 89a036b69367 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Sun Apr 12 12:13:52 2020 +0000
+++ b/sys/kern/vfs_vnops.c      Sun Apr 12 13:12:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.207 2020/02/27 22:12:54 ad Exp $       */
+/*     $NetBSD: vfs_vnops.c,v 1.208 2020/04/12 13:12:42 christos Exp $ */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.207 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.208 2020/04/12 13:12:42 christos Exp $");
 
 #include "veriexec.h"
 
@@ -1105,7 +1105,9 @@
        if ((ioflg & IO_NODELOCKED) == 0)
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 
-       error = VOP_GETEXTATTR(vp, attrnamespace, attrname, &auio, NULL, NULL);
+       error = VOP_GETEXTATTR(vp, attrnamespace, attrname, &auio, NULL,
+           NOCRED);
+       printf("%s: %d\n", __func__, error);
 
        if ((ioflg & IO_NODELOCKED) == 0)
                VOP_UNLOCK(vp);
@@ -1141,7 +1143,7 @@
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        }
 
-       error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio, NULL);
+       error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio, NOCRED);
 
        if ((ioflg & IO_NODELOCKED) == 0) {
                VOP_UNLOCK(vp);
@@ -1162,7 +1164,8 @@
 
        error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, NULL);
        if (error == EOPNOTSUPP)
-               error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, NULL);
+               error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
+                   NOCRED);
 
        if ((ioflg & IO_NODELOCKED) == 0) {
                VOP_UNLOCK(vp);



Home | Main Index | Thread Index | Old Index