From owner-p4-projects@FreeBSD.ORG Wed Sep 27 15:06:57 2006 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 38D4316A407; Wed, 27 Sep 2006 15:06:57 +0000 (UTC) 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 EFCFA16A417 for ; Wed, 27 Sep 2006 15:06:56 +0000 (UTC) (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 9A69F43D46 for ; Wed, 27 Sep 2006 15:06:56 +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.6/8.13.6) with ESMTP id k8RF6urO001903 for ; Wed, 27 Sep 2006 15:06:56 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8RF6uEx001900 for perforce@freebsd.org; Wed, 27 Sep 2006 15:06:56 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 27 Sep 2006 15:06:56 GMT Message-Id: <200609271506.k8RF6uEx001900@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 106780 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: Wed, 27 Sep 2006 15:06:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=106780 Change 106780 by rwatson@rwatson_zoo on 2006/09/27 15:06:09 Add privilege and privilege checks for Bluetooth. Reported by: wkoszek Affected files ... .. //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/drivers/h4/ng_h4.c#2 edit .. //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c#2 edit .. //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c#2 edit .. //depot/projects/trustedbsd/priv/sys/sys/priv.h#3 edit Differences ... ==== //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/drivers/h4/ng_h4.c#2 (text+ko) ==== @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -156,7 +157,7 @@ int s, error; /* Super-user only */ - error = suser(curthread); /* XXX */ + error = priv_check(curthread, PRIV_NETGRAPH_TTY); /* XXX */ if (error != 0) return (error); ==== //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c#2 (text+ko) ==== @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -916,7 +917,7 @@ so->so_pcb = (caddr_t) pcb; pcb->so = so; - if (suser(td) == 0) + if (priv_check(td, PRIV_NETBLUETOOTH_RAW) == 0) pcb->flags |= NG_BTSOCKET_HCI_RAW_PRIVILEGED; /* ==== //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c#2 (text+ko) ==== @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -620,7 +621,7 @@ so->so_pcb = (caddr_t) pcb; pcb->so = so; - if (suser(td) == 0) + if (priv_check(td, PRIV_NETBLUETOOTH_RAW) == 0) pcb->flags |= NG_BTSOCKET_L2CAP_RAW_PRIVILEGED; mtx_init(&pcb->pcb_mtx, "btsocks_l2cap_raw_pcb_mtx", NULL, MTX_DEF); ==== //depot/projects/trustedbsd/priv/sys/sys/priv.h#3 (text+ko) ==== @@ -213,6 +213,7 @@ PRIV_NETATM_ADD, PRIV_NETATM_DEL, PRIV_NETATM_SET, + PRIV_NETBLUETOOTH_RAW, /* Open raw bluetooth socket. */ PRIV_NETGRAPH_CONTROL, /* Open netgraph control socket. */ PRIV_NETGRAPH_TTY, /* Configure tty for netgraph. */ PRIV_NETINET_RESERVEDPORT, /* Bind low port number. */