Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 2008 17:34:16 +0200
From:      Olivier Smedts <olivier@gid0.org>
To:        freebsd-usb@freebsd.org
Subject:   Re: [usb2] new usb stack and suser in CURRENT
Message-ID:  <20080919153415.GA1178@q.gid0.org>
In-Reply-To: <20080919145320.GA2444@q.gid0.org>
References:  <20080919145320.GA2444@q.gid0.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Sep 19, 2008 at 04:53:22PM +0200, Olivier Smedts wrote:
> Since the suser interface has been removed from HEAD
> (http://www.freebsd.org/cgi/getmsg.cgi?fetch=284102+0+current/cvs-src)
> I use the following patch to use the new usb2 stack with
> latest CURRENT. Of course, PRIV_ROOT is not the right one to use,
> see include/sys/priv.h.

Attachment seems to have been removed. Retrying with a different content-type
and disposition (mutt is so great).

-- 
Olivier Smedts                                              _
                          ASCII ribbon campaign            ( )
e-mail: olivier at gid0.org - against HTML email & vCards   X
www: http://www.gid0.org - against proprietary attachments / \

 "Il y a seulement 10 sortes de gens dans le monde :
 ceux qui comprennent le binaire,
 et ceux qui ne le comprennent pas."

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline; filename=diff
Content-Transfer-Encoding: 8bit

Index: i4b/src/sys/dev/usb2/core/usb2_dev.c
===================================================================
--- i4b/src/sys/dev/usb2/core/usb2_dev.c	(révision 880)
+++ i4b/src/sys/dev/usb2/core/usb2_dev.c	(copie de travail)
@@ -262,7 +262,7 @@
 	int error;
 
 	/* only super-user can set permissions */
-	error = suser(curthread);
+	error = priv_check(curthread, PRIV_ROOT);
 	if (error) {
 		return (error);
 	}
Index: i4b/src/sys/dev/usb2/core/usb2_generic.c
===================================================================
--- i4b/src/sys/dev/usb2/core/usb2_generic.c	(révision 880)
+++ i4b/src/sys/dev/usb2/core/usb2_generic.c	(copie de travail)
@@ -878,7 +878,7 @@
 	    (req->bRequest == UR_SET_CONFIG)) ||
 	    ((req->bmRequestType == UT_WRITE_INTERFACE) &&
 	    (req->bRequest == UR_SET_INTERFACE))) {
-		if (suser(curthread)) {
+		if (priv_check(curthread, PRIV_ROOT)) {
 			return (EPERM);
 		}
 	}
@@ -887,7 +887,7 @@
 	 * not update the data toggle value in "struct usb2_pipe" !
 	 */
 	if (req->bmRequestType == UT_WRITE_ENDPOINT) {
-		if (suser(curthread)) {
+		if (priv_check(curthread, PRIV_ROOT)) {
 			return (EPERM);
 		}
 	}
@@ -946,7 +946,7 @@
 		/* control endpoint only */
 		return (EINVAL);
 	}
-	if (suser(curthread)) {
+	if (priv_check(curthread, PRIV_ROOT)) {
 		return (EPERM);
 	}
 	mtx_lock(f->priv_mtx);
@@ -1738,7 +1738,7 @@
 	    (udev->parent_hub == NULL)) {
 		return (EINVAL);
 	}
-	if (suser(curthread)) {
+	if (priv_check(curthread, PRIV_ROOT)) {
 		return (EPERM);
 	}
 	switch (mode) {
@@ -1805,7 +1805,7 @@
 	struct usb2_hub *hub;
 	int err;
 
-	if (suser(curthread)) {
+	if (priv_check(curthread, PRIV_ROOT)) {
 		return (EPERM);
 	}
 	if (port_no == 0) {
@@ -2115,7 +2115,7 @@
 
 	case USB_IFACE_DRIVER_DETACH:
 		/* TODO */
-		if (suser(curthread))
+		if (priv_check(curthread, PRIV_ROOT))
 			error = EPERM;
 		else
 			error = EINVAL;

--BOKacYhQ+x31HxR3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080919153415.GA1178>