Source-Changes-HG archive

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

[src/trunk]: src/sys/kern don't opencode kauth_cred_get()



details:   https://anonhg.NetBSD.org/src/rev/a8abf02aef33
branches:  trunk
changeset: 1023669:a8abf02aef33
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Sep 21 14:49:01 2021 +0000

description:
don't opencode kauth_cred_get()

diffstat:

 sys/dev/ic/wi.c                            |   6 +++---
 sys/dev/usb/if_umb.c                       |   8 ++++----
 sys/external/bsd/ipf/netinet/ip_nat.c      |  11 +++++------
 sys/external/isc/atheros_hal/ic/ah_osdep.c |   6 +++---
 sys/kern/kern_event.c                      |   8 ++++----
 5 files changed, 19 insertions(+), 20 deletions(-)

diffs (150 lines):

diff -r 9fd524bf7658 -r a8abf02aef33 sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c   Tue Sep 21 14:47:28 2021 +0000
+++ b/sys/dev/ic/wi.c   Tue Sep 21 14:49:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wi.c,v 1.256 2021/06/16 00:21:18 riastradh Exp $       */
+/*     $NetBSD: wi.c,v 1.257 2021/09/21 14:50:12 christos Exp $        */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.256 2021/06/16 00:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.257 2021/09/21 14:50:12 christos Exp $");
 
 #define WI_HERMES_AUTOINC_WAR  /* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR    /* Work around stats counter bug. */
@@ -1459,7 +1459,7 @@
                error = wi_get_cfg(ifp, cmd, data);
                break;
        case SIOCSIFGENERIC:
-               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);
diff -r 9fd524bf7658 -r a8abf02aef33 sys/dev/usb/if_umb.c
--- a/sys/dev/usb/if_umb.c      Tue Sep 21 14:47:28 2021 +0000
+++ b/sys/dev/usb/if_umb.c      Tue Sep 21 14:49:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_umb.c,v 1.20 2021/06/16 00:21:19 riastradh Exp $ */
+/*     $NetBSD: if_umb.c,v 1.21 2021/09/21 14:49:01 christos Exp $ */
 /*     $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.20 2021/06/16 00:21:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.21 2021/09/21 14:49:01 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -773,7 +773,7 @@
                usb_add_task(sc->sc_udev, &sc->sc_umb_task, USB_TASKQ_DRIVER);
                break;
        case SIOCGUMBINFO:
-               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);
@@ -783,7 +783,7 @@
                    sizeof(sc->sc_info));
                break;
        case SIOCSUMBPARAM:
-               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);
diff -r 9fd524bf7658 -r a8abf02aef33 sys/external/bsd/ipf/netinet/ip_nat.c
--- a/sys/external/bsd/ipf/netinet/ip_nat.c     Tue Sep 21 14:47:28 2021 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_nat.c     Tue Sep 21 14:49:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_nat.c,v 1.24 2021/05/26 14:48:02 christos Exp $     */
+/*     $NetBSD: ip_nat.c,v 1.25 2021/09/21 14:50:53 christos Exp $     */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -112,7 +112,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.24 2021/05/26 14:48:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.25 2021/09/21 14:50:53 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c     1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp";
@@ -988,10 +988,9 @@
 
 #if BSD_GE_YEAR(199306) && defined(_KERNEL)
 # if NETBSD_GE_REV(399002000)
-       if ((mode & FWRITE) &&
-            kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_FIREWALL,
-                                    KAUTH_REQ_NETWORK_FIREWALL_FW,
-                                    NULL, NULL, NULL))
+       if ((mode & FWRITE) && kauth_authorize_network(
+           kauth_cred_get(), KAUTH_NETWORK_FIREWALL,
+           KAUTH_REQ_NETWORK_FIREWALL_FW, NULL, NULL, NULL))
 # else
 #  if defined(__FreeBSD_version) && (__FreeBSD_version >= 500034)
        if (securelevel_ge(curthread->td_ucred, 3) && (mode & FWRITE))
diff -r 9fd524bf7658 -r a8abf02aef33 sys/external/isc/atheros_hal/ic/ah_osdep.c
--- a/sys/external/isc/atheros_hal/ic/ah_osdep.c        Tue Sep 21 14:47:28 2021 +0000
+++ b/sys/external/isc/atheros_hal/ic/ah_osdep.c        Tue Sep 21 14:49:01 2021 +0000
@@ -26,11 +26,11 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: ah_osdep.c,v 1.6 2012/04/11 13:48:11 nakayama Exp $
+ * $Id: ah_osdep.c,v 1.7 2021/09/21 14:51:28 christos Exp $
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ah_osdep.c,v 1.6 2012/04/11 13:48:11 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ah_osdep.c,v 1.7 2021/09/21 14:51:28 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_athhal.h"
@@ -211,7 +211,7 @@
        int error;
 
        if (enable) {
-               error = kauth_authorize_network(curlwp->l_cred,
+               error = kauth_authorize_network(kauth_cred_get(),
                    KAUTH_NETWORK_INTERFACE,
                    KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, NULL, NULL, NULL);
                if (error == 0) {
diff -r 9fd524bf7658 -r a8abf02aef33 sys/kern/kern_event.c
--- a/sys/kern/kern_event.c     Tue Sep 21 14:47:28 2021 +0000
+++ b/sys/kern/kern_event.c     Tue Sep 21 14:49:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_event.c,v 1.118 2021/05/02 19:13:43 jdolecek Exp $        */
+/*     $NetBSD: kern_event.c,v 1.119 2021/09/21 14:52:40 christos Exp $        */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.118 2021/05/02 19:13:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.119 2021/09/21 14:52:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -546,8 +546,8 @@
         */
        mutex_enter(p->p_lock);
        mutex_exit(&proc_lock);
-       if (kauth_authorize_process(curl->l_cred, KAUTH_PROCESS_KEVENT_FILTER,
-           p, NULL, NULL, NULL) != 0) {
+       if (kauth_authorize_process(curl->l_proc, curl->l_cred,
+           KAUTH_PROCESS_KEVENT_FILTER, p, NULL, NULL, NULL) != 0) {
                mutex_exit(p->p_lock);
                return EACCES;
        }



Home | Main Index | Thread Index | Old Index