Module Name:    src
Committed By:   christos
Date:           Tue Sep 21 15:00:34 UTC 2021

Modified Files:
        src/sys/net80211: ieee80211_ioctl.c

Log Message:
don't opencode kauth_cred_get()


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net80211/ieee80211_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net80211/ieee80211_ioctl.c
diff -u src/sys/net80211/ieee80211_ioctl.c:1.68 src/sys/net80211/ieee80211_ioctl.c:1.69
--- src/sys/net80211/ieee80211_ioctl.c:1.68	Sat Jul 24 17:31:38 2021
+++ src/sys/net80211/ieee80211_ioctl.c	Tue Sep 21 11:00:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_ioctl.c,v 1.68 2021/07/24 21:31:38 andvar Exp $	*/
+/*	$NetBSD: ieee80211_ioctl.c,v 1.69 2021/09/21 15:00:34 christos Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.68 2021/07/24 21:31:38 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.69 2021/09/21 15:00:34 christos Exp $");
 #endif
 
 /*
@@ -367,7 +367,7 @@ ieee80211_cfgget(struct ieee80211com *ic
 	case WI_RID_DEFLT_CRYPT_KEYS:
 		keys = (struct wi_ltv_keys *)wreq;
 		/* do not show keys to non-root user */
-		error = kauth_authorize_network(curlwp->l_cred,
+		error = kauth_authorize_network(kauth_cred_get(),
 		    KAUTH_NETWORK_INTERFACE,
 		    KAUTH_REQ_NETWORK_INTERFACE_GETPRIV, ifp,
 		    NULL, NULL);
@@ -904,7 +904,8 @@ ieee80211_ioctl_getkey(struct ieee80211c
 	ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV);
 	if (wk->wk_keyix == ic->ic_def_txkey)
 		ik.ik_flags |= IEEE80211_KEY_DEFAULT;
-	if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_INTERFACE,
+	if (kauth_authorize_network(kauth_cred_get(),
+	    KAUTH_NETWORK_INTERFACE,
 	    KAUTH_REQ_NETWORK_INTERFACE_GETPRIV, ic->ic_ifp, NULL, NULL) == 0) {
 		/* NB: only root can read key data */
 		ik.ik_keyrsc = wk->wk_keyrsc;
@@ -1357,7 +1358,7 @@ ieee80211_ioctl_get80211_fbsd(struct iee
 			return EINVAL;
 		len = (u_int) ic->ic_nw_keys[kid].wk_keylen;
 		/* NB: only root can read WEP keys */
-		if (kauth_authorize_network(curlwp->l_cred,
+		if (kauth_authorize_network(kauth_cred_get(),
 		    KAUTH_NETWORK_INTERFACE,
 		    KAUTH_REQ_NETWORK_INTERFACE_GETPRIV, ifp, NULL,
 		    NULL) == 0) {
@@ -2582,7 +2583,7 @@ ieee80211_ioctl(struct ieee80211com *ic,
 				(struct ieee80211req *) data);
 		break;
 	case SIOCS80211:
-		if ((error = kauth_authorize_network(curlwp->l_cred,
+		if ((error = kauth_authorize_network(kauth_cred_get(),
 		    KAUTH_NETWORK_INTERFACE,
 		    KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
 		    NULL)) != 0)
@@ -2722,7 +2723,8 @@ ieee80211_ioctl(struct ieee80211com *ic,
 			if (nwkey->i_key[i].i_keydat == NULL)
 				continue;
 			/* do not show any keys to non-root user */
-			if ((error = kauth_authorize_network(curlwp->l_cred,
+			if ((error = kauth_authorize_network(
+			    kauth_cred_get(),
 			    KAUTH_NETWORK_INTERFACE,
 			    KAUTH_REQ_NETWORK_INTERFACE_GETPRIV, ifp,
 			    (void *)cmd, NULL)) != 0)
@@ -2836,7 +2838,7 @@ ieee80211_ioctl(struct ieee80211com *ic,
 		error = ieee80211_cfgget(ic, 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, (void *)cmd,
 		    NULL);

Reply via email to