https://bugs.kde.org/show_bug.cgi?id=525833

            Bug ID: 525833
           Summary: RDP disconnect after login on invalid RDPDR device
                    0xffffffff; IgnoreInvalidDevices workaround prevents
                    it
    Classification: Applications
           Product: krdc
      Version First 26.04.3
       Reported In:
          Platform: Flatpak
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: RDP
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
KRDC intermittently disconnects immediately after successful RDP authentication
when the server sends an I/O request for invalid device 0xffffffff. KRDC window
itself stays open, and doesn't crash/close. In my testing, enabling
FreeRDP_IgnoreInvalidDevices prevents the disconnect.

STEPS TO REPRODUCE
Start KRDC (flatpak release) and connect to an RDP server using a saved RDP
profile.
Complete normal authentication (and optional MFA/OTP).
Wait for the Windows desktop to initialize.
Repeat several times because the problematic server request is intermittent.

OBSERVED RESULT
Initial part of connection looks normal, up to and including the login screen.
Login info is entered in the RDP login screen (meaning the RDP streamed native
Windows login screen), and in my case OTP is entered, all fine. Authentication
completes successfully and the remote desktop begins initializing. But when the
server sends DEVICE_IOREQUEST for device 0xffffffff, KRDC's RDP connection
immediately closes. The KRDC main window remains open. FreeRDP reports RDPDR
error 55.

EXPECTED RESULT
An invalid/nonexistent RDPDR device request should not terminate the complete
RDP session.
FreeRDP already has FreeRDP_IgnoreInvalidDevices, which handles this situation
by sending a dummy response.
KRDC could enable this setting or expose it as a compatibility option.
I tested this manually and it helped establishing 6 sessions in a row without
closing them automatically, despite 2 sessions reporting invalid device.

SOFTWARE/OS VERSIONS
Operating System: Debian Testing (forky)
Desktop environment: GNOME 50, Wayland
KDE Plasma Version: N/A (GNOME desktop)
KRDC Version: 26.04.3
Installation: Flatpak org.kde.krdc
Flatpak runtime: org.kde.Platform/x86_64/6.10
FreeRDP bundled with KRDC Flatpak: 3.30.0
Architecture: x86_64

ADDITIONAL INFORMATION
Before coming to the conclusion several more settings were tested, as similar
options helped with other FreeRDP related projects (eg Remmina)
Drive/media redirection was disabled (shareMedia=).
Smart-card redirection was not configured (smartcardName=).
Audio was disabled.
None of those helped consistently.

The client RDPDR trace advertised only the general capability
(CLIENT_CAPABILITY [caps:1]), despite the server advertising
printer/port/drive/smartcard capabilities.

Related FreeRDP issue: FreeRDP/FreeRDP#10807 :
https://github.com/FreeRDP/FreeRDP/issues/10807

Tracing FreeRDP's RDPDR channel shows that, in failing sessions, the RDP server
sends a PAKID_CORE_DEVICE_IOREQUEST for device ID 0xffffffff. FreeRDP cannot
find that device and treats the error as fatal:

```
[WARN][com.freerdp.channels.rdpdr.client] - [devman_get_device_by_id]: could
not find device ID 0xffffffff
[ERROR][com.freerdp.channels.rdpdr.client] - [rdpdr_process_irp]: irp_new
failed with 55!
[ERROR][com.freerdp.channels.rdpdr.client] - [rdpdr_process_receive]:
rdpdr_process_irp failed with error 55
[ERROR][com.freerdp.channels.rdpdr.client] -
[rdpdr_virtual_channel_client_thread]: rdpdr_process_receive failed with error
55!
[ERROR][com.freerdp.core] - [checkChannelErrorEvent]:
rdpdr_virtual_channel_client_thread reported an error. Error was 55
```

Setting the FreeRDP option:
     FreeRDP_IgnoreInvalidDevices=TRUE

... prevented the disconnect in my testing.

Like I already mentioned, I tested six consecutive connections with that option
enabled. All six succeeded. At least two of those sessions actually received
the problematic 0xffffffff request, but FreeRDP responded with a dummy IRP
response instead of terminating the session:

```
[WARN][com.freerdp.channels.rdpdr.client] - [devman_get_device_by_id]: could
not find device ID 0xffffffff
[WARN][com.freerdp.channels.rdpdr.client] - [dummy_irp_response]: Dummy
response {DeviceId=4294967295, FileId=1, CompletionId=2}
```

The RDP desktop remained fully usable afterward and was disconnected only when
I manually logged out.

Testing with the FreeRDP option was done with flatpak using command:

```
flatpak run --command=wlfreerdp org.kde.krdc \
  /v:<my-server-hostname> \
  /u:<my-username> \
  /d:<my-domain> \
  /dynamic-resolution \
  +clipboard \
  /tune:FreeRDP_IgnoreInvalidDevices:TRUE
```

This is my first KDE bug report, so I hope I've covered everything correctly.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to