Date: Wed, 27 Sep 2006 15:06:56 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 106780 for review Message-ID: <200609271506.k8RF6uEx001900@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/ioccom.h> #include <sys/malloc.h> #include <sys/mbuf.h> +#include <sys/priv.h> #include <sys/tty.h> #include <sys/ttycom.h> #include <netgraph/ng_message.h> @@ -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 <sys/malloc.h> #include <sys/mbuf.h> #include <sys/mutex.h> +#include <sys/priv.h> #include <sys/protosw.h> #include <sys/queue.h> #include <sys/socket.h> @@ -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 <sys/malloc.h> #include <sys/mbuf.h> #include <sys/mutex.h> +#include <sys/priv.h> #include <sys/protosw.h> #include <sys/queue.h> #include <sys/socket.h> @@ -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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609271506.k8RF6uEx001900>