Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys don't opencode kauth_cred_get()
details: https://anonhg.NetBSD.org/src/rev/43f7f53c6830
branches: trunk
changeset: 1023671:43f7f53c6830
user: christos <christos%NetBSD.org@localhost>
date: Tue Sep 21 14:54:26 2021 +0000
description:
don't opencode kauth_cred_get()
diffstat:
sys/kern/kern_entropy.c | 12 ++++++------
sys/kern/subr_time.c | 6 +++---
sys/kern/vfs_cache.c | 9 +++++----
sys/net/if.c | 12 ++++++------
4 files changed, 20 insertions(+), 19 deletions(-)
diffs (159 lines):
diff -r 962a1f873e57 -r 43f7f53c6830 sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c Tue Sep 21 14:54:02 2021 +0000
+++ b/sys/kern/kern_entropy.c Tue Sep 21 14:54:26 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_entropy.c,v 1.30 2021/02/12 19:48:26 jmcneill Exp $ */
+/* $NetBSD: kern_entropy.c,v 1.31 2021/09/21 14:54:26 christos Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.30 2021/02/12 19:48:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.31 2021/09/21 14:54:26 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -2070,18 +2070,18 @@
case RNDGETSRCNAME:
case RNDGETESTNUM:
case RNDGETESTNAME:
- error = kauth_authorize_device(curlwp->l_cred,
+ error = kauth_authorize_device(kauth_cred_get(),
KAUTH_DEVICE_RND_GETPRIV, NULL, NULL, NULL, NULL);
break;
case RNDCTL:
- error = kauth_authorize_device(curlwp->l_cred,
+ error = kauth_authorize_device(kauth_cred_get(),
KAUTH_DEVICE_RND_SETPRIV, NULL, NULL, NULL, NULL);
break;
case RNDADDDATA:
- error = kauth_authorize_device(curlwp->l_cred,
+ error = kauth_authorize_device(kauth_cred_get(),
KAUTH_DEVICE_RND_ADDDATA, NULL, NULL, NULL, NULL);
/* Ascertain whether the user's inputs should be counted. */
- if (kauth_authorize_device(curlwp->l_cred,
+ if (kauth_authorize_device(kauth_cred_get(),
KAUTH_DEVICE_RND_ADDDATA_ESTIMATE,
NULL, NULL, NULL, NULL) == 0)
privileged = true;
diff -r 962a1f873e57 -r 43f7f53c6830 sys/kern/subr_time.c
--- a/sys/kern/subr_time.c Tue Sep 21 14:54:02 2021 +0000
+++ b/sys/kern/subr_time.c Tue Sep 21 14:54:26 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_time.c,v 1.30 2021/03/18 14:05:37 nia Exp $ */
+/* $NetBSD: subr_time.c,v 1.31 2021/09/21 14:55:14 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.30 2021/03/18 14:05:37 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.31 2021/09/21 14:55:14 christos Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -278,7 +278,7 @@
mutex_exit(&proc_lock);
// XXX: Perhaps create a special kauth type
- error = kauth_authorize_process(curlwp->l_cred,
+ error = kauth_authorize_process(kauth_cred_get(),
KAUTH_PROCESS_PTRACE, p,
KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_ENTRY), NULL, NULL);
if (error)
diff -r 962a1f873e57 -r 43f7f53c6830 sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c Tue Sep 21 14:54:02 2021 +0000
+++ b/sys/kern/vfs_cache.c Tue Sep 21 14:54:26 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_cache.c,v 1.150 2021/07/21 06:35:45 skrll Exp $ */
+/* $NetBSD: vfs_cache.c,v 1.151 2021/09/21 14:56:08 christos Exp $ */
/*-
* Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.150 2021/07/21 06:35:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.151 2021/09/21 14:56:08 christos Exp $");
#define __NAMECACHE_PRIVATE
#ifdef _KERNEL_OPT
@@ -701,7 +701,8 @@
return false;
}
KASSERT(dvi->vi_nc_uid != VNOVAL && dvi->vi_nc_gid != VNOVAL);
- error = kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(VEXEC,
+ error = kauth_authorize_vnode(cred,
+ KAUTH_ACCESS_ACTION(VEXEC,
dvp->v_type, dvi->vi_nc_mode & ALLPERMS), dvp, NULL,
genfs_can_access(dvp, cred, dvi->vi_nc_uid, dvi->vi_nc_gid,
dvi->vi_nc_mode & ALLPERMS, NULL, VEXEC));
@@ -796,7 +797,7 @@
return -1;
}
KASSERT(vi->vi_nc_uid != VNOVAL && vi->vi_nc_gid != VNOVAL);
- error = kauth_authorize_vnode(curlwp->l_cred,
+ error = kauth_authorize_vnode(kauth_cred_get(),
KAUTH_ACCESS_ACTION(VEXEC, vp->v_type, vi->vi_nc_mode &
ALLPERMS), vp, NULL, genfs_can_access(vp, curlwp->l_cred,
vi->vi_nc_uid, vi->vi_nc_gid, vi->vi_nc_mode & ALLPERMS,
diff -r 962a1f873e57 -r 43f7f53c6830 sys/net/if.c
--- a/sys/net/if.c Tue Sep 21 14:54:02 2021 +0000
+++ b/sys/net/if.c Tue Sep 21 14:54:26 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.488 2021/09/16 20:17:47 andvar Exp $ */
+/* $NetBSD: if.c,v 1.489 2021/09/21 14:56:42 christos Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.488 2021/09/16 20:17:47 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.489 2021/09/21 14:56:42 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -3163,7 +3163,7 @@
ifp->if_mtu = ifr->ifr_mtu;
return ENETRESET;
case SIOCSIFDESCR:
- error = kauth_authorize_network(curlwp->l_cred,
+ error = kauth_authorize_network(kauth_cred_get(),
KAUTH_NETWORK_INTERFACE,
KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd),
NULL);
@@ -3232,7 +3232,7 @@
switch (cmd) {
case SIOCSIFADDRPREF:
- error = kauth_authorize_network(curlwp->l_cred,
+ error = kauth_authorize_network(kauth_cred_get(),
KAUTH_NETWORK_INTERFACE,
KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd),
NULL);
@@ -3346,7 +3346,7 @@
bound = curlwp_bind();
if (l != NULL) {
ifp = if_get(ifr->ifr_name, &psref);
- error = kauth_authorize_network(l->l_cred,
+ error = kauth_authorize_network(l->l_proc, l->l_cred,
KAUTH_NETWORK_INTERFACE,
KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp,
KAUTH_ARG(cmd), NULL);
@@ -3411,7 +3411,7 @@
case SIOCS80211CHANNEL:
case SIOCSLINKSTR:
if (l != NULL) {
- error = kauth_authorize_network(l->l_cred,
+ error = kauth_authorize_network(l->l_proc, l->l_cred,
KAUTH_NETWORK_INTERFACE,
KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp,
KAUTH_ARG(cmd), NULL);
Home |
Main Index |
Thread Index |
Old Index