From owner-p4-projects@FreeBSD.ORG Mon Jul 4 12:49:55 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 EE22016A420; Mon, 4 Jul 2005 12:49:54 +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 A64A816A41C for ; Mon, 4 Jul 2005 12:49:54 +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 8FCB243D45 for ; Mon, 4 Jul 2005 12:49:54 +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 j64CnsR4081357 for ; Mon, 4 Jul 2005 12:49:54 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 j64CnsB0081351 for perforce@freebsd.org; Mon, 4 Jul 2005 12:49:54 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 4 Jul 2005 12:49:54 GMT Message-Id: <200507041249.j64CnsB0081351@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 79545 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: Mon, 04 Jul 2005 12:49:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=79545 Change 79545 by rwatson@rwatson_paprika on 2005/07/04 12:49:03 Convert new suser() checks in the network stack to either CAP_NET_ADMIN or CAP_SYS_MODULE. Affected files ... .. //depot/projects/trustedbsd/sebsd/sys/contrib/dev/ath/freebsd/ah_osdep.c#7 edit .. //depot/projects/trustedbsd/sebsd/sys/contrib/pf/net/if_pfsync.c#5 edit .. //depot/projects/trustedbsd/sebsd/sys/net80211/ieee80211_freebsd.c#2 edit Differences ... ==== //depot/projects/trustedbsd/sebsd/sys/contrib/dev/ath/freebsd/ah_osdep.c#7 (text+ko) ==== @@ -182,7 +182,8 @@ int error; if (enable) { - error = suser(curthread); + /* XXXRW: Races on /tmp/ath_hal.log? */ + error = cap_check(curthread, CAP_SYS_ADMIN); if (error == 0) { error = alq_open(&ath_hal_alq, ath_hal_logfile, curthread->td_ucred, ALQ_DEFAULT_CMODE, ==== //depot/projects/trustedbsd/sebsd/sys/contrib/pf/net/if_pfsync.c#5 (text+ko) ==== @@ -43,6 +43,9 @@ #endif #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -1016,7 +1019,7 @@ break; case SIOCSETPFSYNC: #ifdef __FreeBSD__ - if ((error = suser(curthread)) != 0) + if ((error = cap_check(curthread, CAP_NET_ADMIN)) != 0) #else if ((error = suser(p, p->p_acflag)) != 0) #endif ==== //depot/projects/trustedbsd/sebsd/sys/net80211/ieee80211_freebsd.c#2 (text+ko) ==== @@ -306,7 +306,8 @@ #ifdef notyet struct thread *td = curthread; - if (suser(td) == 0 && securelevel_gt(td->td_ucred, 0) == 0) { + if (cap_check(td, CAP_SYS_MODULE) == 0 && + securelevel_gt(td->td_ucred, 0) == 0) { mtx_lock(&Giant); (void) linker_load_module(modname, NULL, NULL, NULL, NULL); mtx_unlock(&Giant);