| Index: remoting/host/curtain_mode_linux.cc
|
| diff --git a/remoting/host/curtain_mode_linux.cc b/remoting/host/curtain_mode_linux.cc
|
| index 05031bfec1b255b300d521dfde30b5686b785fa0..b99ae2dfffd3babb4cf3fd52a27c76dc0b7fa592 100644
|
| --- a/remoting/host/curtain_mode_linux.cc
|
| +++ b/remoting/host/curtain_mode_linux.cc
|
| @@ -23,8 +23,8 @@ class CurtainModeLinux : public CurtainMode {
|
| bool Activate() override;
|
|
|
| private:
|
| - // Returns true if the host is running under an Xvfb session.
|
| - bool IsXvfbSession();
|
| + // Returns true if the host is running under a virtual session.
|
| + bool IsVirtualSession();
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CurtainModeLinux);
|
| };
|
| @@ -34,25 +34,25 @@ CurtainModeLinux::CurtainModeLinux() {
|
|
|
| bool CurtainModeLinux::Activate() {
|
| // We can't curtain the session in run-time in Linux.
|
| - // Either the session is running on Xvfb (i.e. always curtained), or it is
|
| - // attached to the physical console (i.e. impossible to curtain).
|
| - bool activated = IsXvfbSession();
|
| - if (!activated) {
|
| - LOG(ERROR) << "Curtain-mode is not supported when running on non-Xvfb "
|
| + // Either the session is running in a virtual session (i.e. always curtained),
|
| + // or it is attached to the physical console (i.e. impossible to curtain).
|
| + if (!IsVirtualSession()) {
|
| + LOG(ERROR) << "Curtain-mode is not supported when running on non-virtual "
|
| "X server";
|
| + return false;
|
| }
|
|
|
| - return activated;
|
| + return true;
|
| }
|
|
|
| -bool CurtainModeLinux::IsXvfbSession() {
|
| - // Try to identify an Xvfb session. There's no way to query what X server we
|
| - // are running under, so we check for the Xvfb input devices.
|
| +bool CurtainModeLinux::IsVirtualSession() {
|
| + // Try to identify a virtual session. Since there's no way to tell from the
|
| + // vendor string, we check for known virtual input devices.
|
| // TODO(rmsousa): Find a similar way to determine that the *output* is secure.
|
| Display* display = XOpenDisplay(nullptr);
|
| int opcode, event, error;
|
| if (!XQueryExtension(display, "XInputExtension", &opcode, &event, &error)) {
|
| - // If XInput is not available, assume it is not an Xvfb session.
|
| + // If XInput is not available, assume it is not a virtual session.
|
| LOG(ERROR) << "X Input extension not available: " << error;
|
| XCloseDisplay(display);
|
| return false;
|
| @@ -61,6 +61,7 @@ bool CurtainModeLinux::IsXvfbSession() {
|
| XDeviceInfo* devices;
|
| bool found_xvfb_mouse = false;
|
| bool found_xvfb_keyboard = false;
|
| + bool found_crd_void_input = false;
|
| bool found_other_devices = false;
|
| devices = XListInputDevices(display, &num_devices);
|
| for (int i = 0; i < num_devices; i++) {
|
| @@ -68,9 +69,12 @@ bool CurtainModeLinux::IsXvfbSession() {
|
| if (device_info->use == IsXExtensionPointer) {
|
| if (strcmp(device_info->name, "Xvfb mouse") == 0) {
|
| found_xvfb_mouse = true;
|
| + } else if (strcmp(device_info->name,
|
| + "Chrome Remote Desktop Input") == 0) {
|
| + found_crd_void_input = true;
|
| } else if (strcmp(device_info->name, "Virtual core XTEST pointer") != 0) {
|
| found_other_devices = true;
|
| - HOST_LOG << "Non Xvfb mouse found: " << device_info->name;
|
| + HOST_LOG << "Non-virtual mouse found: " << device_info->name;
|
| }
|
| } else if (device_info->use == IsXExtensionKeyboard) {
|
| if (strcmp(device_info->name, "Xvfb keyboard") == 0) {
|
| @@ -78,26 +82,27 @@ bool CurtainModeLinux::IsXvfbSession() {
|
| } else if (strcmp(device_info->name,
|
| "Virtual core XTEST keyboard") != 0) {
|
| found_other_devices = true;
|
| - HOST_LOG << "Non Xvfb keyboard found: " << device_info->name;
|
| + HOST_LOG << "Non-virtual keyboard found: " << device_info->name;
|
| }
|
| } else if (device_info->use == IsXPointer) {
|
| if (strcmp(device_info->name, "Virtual core pointer") != 0) {
|
| found_other_devices = true;
|
| - HOST_LOG << "Non Xvfb mouse found: " << device_info->name;
|
| + HOST_LOG << "Non-virtual mouse found: " << device_info->name;
|
| }
|
| } else if (device_info->use == IsXKeyboard) {
|
| if (strcmp(device_info->name, "Virtual core keyboard") != 0) {
|
| found_other_devices = true;
|
| - HOST_LOG << "Non Xvfb keyboard found: " << device_info->name;
|
| + HOST_LOG << "Non-virtual keyboard found: " << device_info->name;
|
| }
|
| } else {
|
| found_other_devices = true;
|
| - HOST_LOG << "Non Xvfb device found: " << device_info->name;
|
| + HOST_LOG << "Non-virtual device found: " << device_info->name;
|
| }
|
| }
|
| XFreeDeviceList(devices);
|
| XCloseDisplay(display);
|
| - return found_xvfb_mouse && found_xvfb_keyboard && !found_other_devices;
|
| + return ((found_xvfb_mouse && found_xvfb_keyboard) || found_crd_void_input)
|
| + && !found_other_devices;
|
| }
|
|
|
| // static
|
|
|