VirtualBox

Changeset 36997 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
May 6, 2011 11:30:23 PM (14 years ago)
Author:
vboxsync
Message:

Main/linux/usb: no reason not to check root paths passed in the environment

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp

    r36995 r36997  
    141141                    pcszUsbFromEnv));
    142142            fValidVBoxUSB = false;
     143            pcszUsbFromEnv = NULL;
    143144        }
    144145        if (!fValidVBoxUSB && pcszUsbRoot)
     
    160161        }
    161162    }
     163    else if (!USBProxyLinuxCheckDeviceRoot(pcszUsbRoot, fSysfsChosen))
     164        pcszUsbRoot = NULL;
    162165    if (pcszUsbRoot)
    163166    {
     
    176179    }
    177180    else
    178         mLastError =   RTDirExists("/dev/vboxusb") ? VERR_VUSB_USB_DEVICE_PERMISSION
     181        mLastError =   pcszUsbFromEnv ? VERR_NOT_FOUND
     182                     : RTDirExists("/dev/vboxusb") ? VERR_VUSB_USB_DEVICE_PERMISSION
    179183                     : RTFileExists("/proc/bus/usb/devices") ? VERR_VUSB_USBFS_PERMISSION
    180184                     : VERR_NOT_FOUND;
  • trunk/src/VBox/Main/testcase/tstUSBProxyLinux.cpp

    r36996 r36997  
    8787} s_testEnvironment[] =
    8888{
    89     /* "sysfs" and root in the environment */
    90     { "sysfs", "/dev/bus/usb", NULL, false, NULL, false, VINF_SUCCESS, "/dev/bus/usb", false, VINF_SUCCESS },
    91     /* "sysfs" and root in the environment, method-specific init failed */
    92     { "sysfs", "/dev/bus/usb", NULL, false, NULL, false, VERR_NO_MEMORY, "/dev/bus/usb", false, VERR_NO_MEMORY },
    93     /* "sysfs" and bad root in the environment (should succeed as we don't do checks if the user specifies everything) */
    94     { "sysfs", "/dev/bus/usb", "/dev/usbvbox", false, "/proc/usb/bus", false, VINF_SUCCESS, "/dev/bus/usb", false, VINF_SUCCESS },
    95     /* "sysfs" and bad root in the environment, method-specific init failed */
    96     { "sysfs", "/dev/bus/usb", "/dev/usbvbox", false, "/proc/usb/bus", false, VERR_NO_MEMORY, "/dev/bus/usb", false, VERR_NO_MEMORY },
     89    /* "sysfs" and valid root in the environment */
     90    { "sysfs", "/dev/bus/usb", "/dev/bus/usb", true, NULL, false, VINF_SUCCESS, "/dev/bus/usb", false, VINF_SUCCESS },
     91    /* "sysfs" and valid root in the environment, method-specific init failed */
     92    { "sysfs", "/dev/bus/usb",  "/dev/bus/usb", true, NULL, false, VERR_NO_MEMORY, "/dev/bus/usb", false, VERR_NO_MEMORY },
     93    /* "sysfs" and bad root in the environment */
     94    { "sysfs", "/dev/bus/usb", "/dev/vboxusb", false, "/proc/usb/bus", false, VINF_SUCCESS, "", true, VERR_NOT_FOUND },
    9795    /* "sysfs" and no root in the environment */
    9896    { "sysfs", NULL, "/dev/vboxusb", true, NULL, false, VINF_SUCCESS, "/dev/vboxusb", false, VINF_SUCCESS },
    99     /* "usbfs" and root in the environment */
    100     { "usbfs", "/dev/bus/usb", NULL, false, NULL, false, VINF_SUCCESS, "/dev/bus/usb", true, VINF_SUCCESS },
    101     /* "usbfs" and root in the environment, method-specific init failed */
    102     { "usbfs", "/dev/bus/usb", NULL, false, NULL, false, VERR_NO_MEMORY, "/dev/bus/usb", true, VERR_NO_MEMORY },
    103     /* "usbfs" and bad root in the environment (should succeed as we don't do checks if the user specifies everything) */
    104     { "usbfs", "/dev/bus/usb", "/dev/usbvbox", false, "/proc/usb/bus", false, VINF_SUCCESS, "/dev/bus/usb", true, VINF_SUCCESS },
    105     /* "usbfs" and bad root in the environment, method-specific init failed */
    106     { "usbfs", "/dev/bus/usb", "/dev/usbvbox", false, "/proc/usb/bus", false, VERR_NO_MEMORY, "/dev/bus/usb", true, VERR_NO_MEMORY },
     97    /* "usbfs" and valid root in the environment */
     98    { "usbfs", "/dev/bus/usb", NULL, false, "/dev/bus/usb", true, VINF_SUCCESS, "/dev/bus/usb", true, VINF_SUCCESS },
     99    /* "usbfs" and valid root in the environment, method-specific init failed */
     100    { "usbfs", "/dev/bus/usb", NULL, false, "/dev/bus/usb", true, VERR_NO_MEMORY, "/dev/bus/usb", true, VERR_NO_MEMORY },
     101    /* "usbfs" and bad root in the environment */
     102    { "usbfs", "/dev/bus/usb", "/dev/vboxusb", false, "/proc/usb/bus", false, VINF_SUCCESS, "", true, VERR_NOT_FOUND },
    107103    /* "usbfs" and no root in the environment */
    108104    { "usbfs", NULL, NULL, false, "/proc/bus/usb", true, VINF_SUCCESS, "/proc/bus/usb", true, VINF_SUCCESS },
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette