From owner-p4-projects@FreeBSD.ORG Tue Jul 5 11:57:06 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 29C7716A420; Tue, 5 Jul 2005 11:57:06 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 00D8016A41C for ; Tue, 5 Jul 2005 11:57:06 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B852643D49 for ; Tue, 5 Jul 2005 11:57:05 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j65Bv5OP076520 for ; Tue, 5 Jul 2005 11:57:05 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j65Bv53H076517 for perforce@freebsd.org; Tue, 5 Jul 2005 11:57:05 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 5 Jul 2005 11:57:05 GMT Message-Id: <200507051157.j65Bv53H076517@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 79598 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2005 11:57:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=79598 Change 79598 by rwatson@rwatson_paprika on 2005/07/05 11:56:13 Use CAP_NET_ADMIN instead of suser() for configuring 802.11, both in the net80211 code, and also in the older wireless drivers that implement parts of 802.11 themselves. Affected files ... .. //depot/projects/trustedbsd/sebsd/sys/dev/if_ndis/if_ndis.c#6 edit .. //depot/projects/trustedbsd/sebsd/sys/dev/owi/if_owi.c#7 edit Differences ... ==== //depot/projects/trustedbsd/sebsd/sys/dev/if_ndis/if_ndis.c#6 (text+ko) ==== @@ -2458,7 +2458,7 @@ uint32_t foo; int error, len; - error = suser(curthread); + error = cap_check(curthread, CAP_NET_ADMIN); if (error) return (error); @@ -2916,7 +2916,7 @@ rt_ieee80211msg(ifp, RTM_IEEE80211_SCAN, NULL, 0); break; case IEEE80211_IOC_STATIONNAME: - error = suser(curthread); + error = cap_check(curthread, CAP_NET_ADMIN); if (error) break; if (ireq->i_val != 0 || ==== //depot/projects/trustedbsd/sebsd/sys/dev/owi/if_owi.c#7 (text+ko) ==== @@ -1391,7 +1391,8 @@ break; } /* Don't show WEP keys to non-root users. */ - if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser(td)) + if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && + cap_check(td, CAP_NET_ADMIN)) break; if (wreq.wi_type == WI_RID_IFACE_STATS) { bcopy((char *)&sc->wi_stats, (char *)&wreq.wi_val, @@ -1403,7 +1404,7 @@ } #ifdef WICACHE else if (wreq.wi_type == WI_RID_ZERO_CACHE) { - error = suser(td); + error = cap_check(td, CAP_NET_ADMIN); if (error) break; sc->wi_sigitems = sc->wi_nextitem = 0; @@ -1441,7 +1442,7 @@ error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; case SIOCSWAVELAN: - if ((error = suser(td))) + if ((error = cap_check(td, CAP_NET_ADMIN))) goto out; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) @@ -1516,7 +1517,7 @@ break; } len = sc->wi_keys.wi_keys[ireq->i_val].wi_keylen; - if (suser(td)) + if (cap_check(td, CAP_NET_ADMIN)) bcopy(sc->wi_keys.wi_keys[ireq->i_val].wi_keydat, tmpkey, len); else @@ -1569,7 +1570,7 @@ } break; case SIOCS80211: - if ((error = suser(td))) + if ((error = cap_check(td, CAP_NET_ADMIN))) goto out; switch(ireq->i_type) { case IEEE80211_IOC_SSID: