lkml.org 
[lkml]   [2014]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 08/18] usbip: Handle usbip being started as user
usbip now prints an error message when started as user and requiring
root access. Also, some debug messages are changed to error messages so
the command line utilities now print less confusing (and more verbose)
error messages when not used correctly.

Signed-off-by: Maximilian Eschenbacher <maximilian@eschenbacher.email>
Signed-off-by: Fjodor Schelichow <fjodor.schelichow@hotmail.com>
Signed-off-by: Johannes Stadlinger <johannes.stadlinger@fau.de>
Signed-off-by: Dominik Paulus <dominik.paulus@fau.de>
Signed-off-by: Tobias Polzer <tobias.polzer@fau.de>
---
tools/usb/usbip/src/usbip_attach.c | 3 +++
tools/usb/usbip/src/usbip_bind.c | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/usb/usbip/src/usbip_attach.c b/tools/usb/usbip/src/usbip_attach.c
index 51c67a2..fcc3efb 100644
--- a/tools/usb/usbip/src/usbip_attach.c
+++ b/tools/usb/usbip/src/usbip_attach.c
@@ -210,6 +210,9 @@ int usbip_attach(int argc, char *argv[])
int opt;
int ret = -1;

+ if (geteuid() != 0)
+ err("not running as root?");
+
for (;;) {
opt = getopt_long(argc, argv, "r:b:", opts, NULL);

diff --git a/tools/usb/usbip/src/usbip_bind.c b/tools/usb/usbip/src/usbip_bind.c
index 3f8c7a3..6f5d3c2 100644
--- a/tools/usb/usbip/src/usbip_bind.c
+++ b/tools/usb/usbip/src/usbip_bind.c
@@ -102,19 +102,19 @@ static int unbind_other(char *busid)
/* Get the device. */
dev = udev_device_new_from_subsystem_sysname(udev, "usb", busid);
if (!dev) {
- dbg("unable to find device with bus ID %s", busid);
+ err("unable to find device with bus ID %s", busid);
goto err_close_busid_dev;
}

/* Check what kind of device it is. */
bDevClass = udev_device_get_sysattr_value(dev, "bDeviceClass");
if (!bDevClass) {
- dbg("unable to get bDevClass device attribute");
+ err("unable to get bDevClass device attribute");
goto err_close_busid_dev;
}

if (!strncmp(bDevClass, "09", strlen(bDevClass))) {
- dbg("skip unbinding of hub");
+ err("skip unbinding of hub");
goto err_close_busid_dev;
}

@@ -212,6 +212,9 @@ int usbip_bind(int argc, char *argv[])

allow[0] = 0;

+ if (geteuid() != 0)
+ err("not running as root?");
+
for (;;) {
opt = getopt_long(argc, argv, "a:b:", opts, NULL);

--
2.1.0


\
 
 \ /
  Last update: 2014-09-17 00:41    [W:0.771 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site