PERFORCE change 106780 for review
Robert Watson
rwatson at FreeBSD.org
Wed Sep 27 08:08:48 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106780
Change 106780 by rwatson at 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. */
More information about the trustedbsd-cvs
mailing list