Bug 491514

Summary: Gateway settings not used for RDP
Product: [Applications] krdc Reporter: Roeland <roeland>
Component: RDPAssignee: Urs Wolfer <uwolfer>
Status: RESOLVED FIXED    
Severity: normal CC: bizyaev, ctrlaltca
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 24.12
Sentry Crash Report:

Description Roeland 2024-08-10 07:56:33 UTC
SUMMARY
In 'rdp/rdpsession.cpp' the code to use the gateway settings looks wrong to me.
Instead of checking if the gatewayServer is empty, there is a check for proxyHost. Copy/paste error?
The gatewayPort also seems wrong to me. 
If I try the freerdp client directly I don't need to specify a port.

STEPS TO REPRODUCE
Try to make an RDP connection with gateway

OBSERVED RESULT
The gateway is not used

EXPECTED RESULT
Use the gateway settings

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.9.12-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × 12th Gen Intel® Core™ i7-1260P
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
The same RDP settings work in Remmina and with the FreeRDP cli.
I tried to create a fix, but I have no KDE/C++ experience.
This didn't work:

-    const auto gatewayServerAddress = QUrl(m_preferences->proxyHost());
+    const auto gatewayServerAddress = m_preferences->gatewayServer();
     if (!gatewayServerAddress.isEmpty()) {
-        settings->GatewayHostname = gatewayServerAddress.host().toLocal8Bit().data();
-        settings->GatewayPort = gatewayServerAddress.port(3389);
+        settings->GatewayHostname = gatewayServerAddress.toLocal8Bit().data();
         settings->GatewayUsername = m_preferences->gatewayUsername().toLocal8Bit().data();
         settings->GatewayPassword = m_preferences->gatewayPassword().toLocal8Bit().data();
         settings->GatewayDomain = m_preferences->gatewayDomain().toLocal8Bit().data();

The error and crash:

[09:54:39:394] [626433:626433] [ERROR][com.freerdp.core] - freerdp_tcp_is_hostname_resolvable:freerdp_set_last_error_ex ERRCONNECT_DNS_NAME_NOT_FOUND [0x00020005]
KRDC: Unable to connect
munmap_chunk(): invalid pointer
Comment 1 Fabio 2024-11-23 17:44:52 UTC
Will be fixed in v24.12, thank you
Commit: https://invent.kde.org/network/krdc/-/commit/a51c6201f292740eb51b741bc5d97b9be658d7cd