Commit Graph

568 Commits

Author SHA1 Message Date
matt335672 2759680b8b ms-rdpbcgr.h: Rename incorrect PDUTYPE2_ defines
Rename the defines from [MS-RDPBCGR] 2.2.8.1.1.1.2 to
match the documentation.
2025-09-09 15:14:28 +01:00
matt335672 557b580cb0 ms-rdpbcgr.h : Rename incorrect pointer update constants
Rename the defines from [MS-RDPBCGR] 2.2.9.1.1.4 and
2.2.9.1.1.4.3 to match the documentation.
2025-09-09 15:11:45 +01:00
matt335672 aade869fb7 Merge pull request #3607 from matt335672/fix_incorrect_control_pdu_vals
Fix more inconsistencies with [MS-RDPBCGR]
2025-09-06 10:04:35 +01:00
matt335672 fa6ed3c702 Fix more inconsistencies with [MS-RDPBCGR] 2025-09-05 12:19:56 +01:00
matt335672 4c8f2abf6d Fill in all fields for TS_DEACTIVATE_ALL_PDU 2025-09-05 11:42:44 +01:00
matt335672 ac95cdffc3 Rename client_info hostname to client_name
This name better matches the name from [MS-RDPBCGR]. Also, the size
of the UTF-8 buffer allocated for the client name is not large
enough for some of the names which could potentially be passed across
in UTF-16 from the client.
2025-07-21 11:30:14 +01:00
matt335672 d015535065 Add CCP support to xrdp
This allows sesexec to send a reason for a connection close
request to xrdp.

xrdp is also updated to support server initiated disconnection sequences
from [MS-RDPBCGR] 1.3.1.4, along with reporting a reason to the client
for the disconnection.
2025-07-21 11:30:14 +01:00
matt335672 b2892fbe5e Factor out xup_client_info for xorgxrdp
The data in 'struct xrdp_client_info' which is shared with xorgxrdp
is separated out into a separate structure. This makes it simpler to
change 'struct xrdp_client_info' without affecting xorgxrdp.
2025-05-28 11:53:21 +01:00
matt335672 6ba1503b6a Disable vmconnect mode for non-vsock connections 2025-05-08 11:51:32 +01:00
gpotter2 09e1173259 Apply suggestions
Co-Authored-By: matt335672 <30179339+matt335672@users.noreply.github.com>
2025-05-08 06:45:05 +02:00
gpotter2 f0bae0050c vmconnect mode: support all security modes when used in Hyper-V environment 2025-05-06 21:49:56 +02:00
matt335672 463e500f77 Security improvements
1) In FIPS mode, Classic RDP security is not allowed at all.
2) In FIPS mode xrdp-keygen creates an empty file
3) Documentation wording improved around the security_level setting
4) Logging improved around the security negotiation
5) Warnings now generated if Classic RDP security is negotiated
2025-05-06 11:30:36 +01:00
matt335672 554515e39c Refactor static channel name handling
1) Remove 'magic numbers' related to static channel name lengths, and
   replace with CHANNEL_NAME_LEN, or CHANNEL_NAME_LEN+1, as appropriate.
2) Always add static channel definitions, even if they are malformed.
3) Log channels which the client sends, which aren't named in
   the [Channels] section of xrdp.ini.

(cherry picked from commit 9092d898b7dceda713bd05b296ea8e8213ee614b)
2025-04-26 17:06:10 +01:00
matt335672 ffe9ac9122 Coverity CID 468130
g_bitmask_to_str() can return < 0 on error. This is not adequately
catered for.
2025-04-22 14:51:26 +01:00
Jay Sorg 522b5750d9 add system pointer 2025-03-21 23:04:15 -07:00
Koichiro Iwao 75736f4853 Allow to change config file (sub)directory
This allows the `xrdp` part of the path `/etc/xrdp` where config files
are placed to be customizable. This change is useful when trying the
stable version and the devel version alternately.
2024-12-27 10:53:31 +09:00
matt335672 28ad8c6ee1 Merge pull request #3261 from matt335672/skip_channeljoin
Improve channel join request processing
2024-10-21 16:00:04 +01:00
matt335672 10cf8f2d1c Remove xrdp_sec_in_mcs_data() function
THe function xrdp_sec_in_mcs_data() parses data within the
TS_UD_CS_CORE struct which could just as easily be parsed
when xrdp_sec_process_mcs_data_CS_CORE() is called.

Currently the contents of the MSC Connect Initial PDU are stored within
the client_mcs_data member of the xrdp_sec struct. This stream is parsed
once by xrdp_sec_process_mcs_data() and then separately by
xrdp_sec_in_mcs_data(). There is no reason not to perform the parse in
a single pass through the stream.

This commit folds the functionality in xrdp_sec_in_mcs_data() into
xrdp_sec_process_mcs_data_CS_CORE() and removes xrdp_sec_in_mcs_data()
2024-09-30 14:59:43 +01:00
matt335672 f4d73054a9 Use client earlyCapabilities to determine channel join count
We always now indicate we support skipping channel joins. If the client
indicates this too, expect no channel join requests from the client.

If we do get some, process them anyway.
2024-09-29 14:51:38 +01:00
matt335672 fcc82c3499 Announce server RNS_UD_SC_SKIP_CHANNELJOIN_SUPPORTED 2024-09-29 14:20:48 +01:00
matt335672 7eb586d1ae Combine code paths for handling channel joins
The existing code contains separate TLS and non-TLS code paths for
hadling channel join PDUs. This was introduced in
8fdc1ba216 and was based on a
misunderstanding of where in the connection sequence the TLS client hello
is processed (if a TLS connection is negotiated). The assumption was
the TLS client hello is received after the channel join PDUs. However,
it is actually received immediately after the X.224 Connection Confirm
PDU some time before channel join requests are processed.

Consequently, there is no reason not to adopt a single code path for
handling channel joins.
2024-09-29 14:11:02 +01:00
matt335672 3bfa59472e Fix misreported cache size
Printed offscreen bitmap cache size is in bytes, not MB.
2024-08-16 11:18:15 +01:00
matt335672 c9a2039858 Move and rename xrdp_load_keyboard_layout()
xrdp_load_keyboard_layout() is used exclusively by the xup module to
work out the parameters to pass to xorgxrdp for XKB. This function
does not need to be called locally from the SEC module.

This commit moves the function to xrdp/lang.c and renames it as
xrdp_init_xkb_layout(). The module interface is modified so that xup can
call this function. Other modules do not need to call it.
2024-08-05 10:44:10 +01:00
matt335672 ef14039c62 Use correct names for key events
Replace definitions in ms-rdpbcgr.h marked as TODO with the
names defined in [MS-RDPBCGR]

Some other simplifications around the fake Unicode event processing
have also been made.
2024-08-05 10:44:10 +01:00
matt335672 b6407a9bf9 Merge pull request #3143 from matt335672/remove_licensing_exchange
Remove Licensing exchange
2024-07-15 09:02:32 +01:00
matt335672 52dd88b576 Replace binary blob with specified data
This commit changes the license response PDU to be constructed rather
than simply being contained as a binary blob.

Some constants in common/ms-rdpbcgr.h are renamed with the values
from the specification.
2024-07-03 14:20:33 +01:00
matt335672 cc4a4c95f2 Remove Licensing exchange
Replaces the existing licensing exchange with a single PDU
saying the user will not issue a license.

This is necessary for clients on FIPS-compliant systems, as these
are unable to decode the licensing exchange packets, due to outdated
cyphers.
2024-07-03 14:19:22 +01:00
matt335672 8ac2f6db34 Enforce no login screen if require_credentials is set
If the setting require_credentials is true, there should be no way
for the user to get to a login screen.

This commit makes the following changes if this flag is active:-
- Makes the checks around TS_INFO_PACKET more explicit.
- Closes the connection if the first login attempt fails.
2024-06-27 11:53:52 +01:00
matt335672 d2bab53364 Don't use GFX if server max_bpp is <32 2024-06-17 11:53:47 +01:00
matt335672 620f3b6220 Pass KBDFLAGS_EXTENDED1 flag for FP scancode events
The current fastpath code for scancode events is not mapping
the FASTPATH_INPUT_KBDFLAGS_EXTENDED1 flag to the KBDFLAGS_EXTENDED1
flag.
2024-06-12 16:20:12 +01:00
seflerZ c53662e3c1 apply xrdp_caps.c patach written by mattt 2024-05-09 11:25:08 +08:00
matt335672 a2064e51c1 Some changes to Unicode input processing
- xrdp is not now built with XRDP_IBUS to allow other input
  methods to be more easily supported.
- chansrv is only aked to start an input method if the client
  supports it.
- chansrv sends a status report back to xrdp when asked to start
  and input method.
- ./configure without --enable-ibus now works.
2024-05-05 10:44:19 +08:00
firewave 5eed76f32b fixed -Wunused-function compiler warnings 2024-04-23 18:38:20 +02:00
firewave fb9c175b11 enabled and fixed -Wmissing-prototypes compiler warnings
Co-authored-by: matt335672 <30179339+matt335672@users.noreply.github.com>
2024-04-23 18:38:20 +02:00
matt335672 6ff99cc4b5 Load channel config in xrdp_wm_create()
This commit moves the '[Channels]' parsing code for xrdp.ini
from xrdp_wm_init() to an earlier location in xrdp_wm_create().

libxrdp can now check that drdynvc is not disabled before starting it,
and xrdp_wm can disable GFX if virtual channels are not available.
2024-03-11 14:13:44 +00:00
matt335672 697dcbb24d Start the drdynvc channel within xrdp_wm
The responsibility for starting the drdynvc channel is moved out of
libxrdp into the application. This will make it easier to allow the
application to check the channel is enabled before starting it.
2024-03-11 11:00:53 +00:00
matt335672 bc70a86de6 Rework xrdp to support new module resize interface
This commit compiles.
2024-02-15 16:48:13 +00:00
matt335672 27ad405cd8 Add a client_resize_mode field
This stores what kind of resizing (if any) can be achieved with
a Deactivation-Reactivation sequence.
2024-02-15 16:48:13 +00:00
matt335672 74598d1cc3 Fix sending of monitor layout PDU
From [MS-RCPBCGR] 3.3.5.12.1:-

> ...The contents of this PDU SHOULD NOT be compressed.
>
> This PDU MUST NOT be sent to a client that has not indicated support for
> it by setting the RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU flag (0x0040)
> in the earlyCapabilityFlags field of the Client Core Data (section
> 2.2.1.3.2).

Also, 2.2.12.1 specifies the source channel must be zero.

In testing, a compressed monitor layout PDU causes mstsc.exe
to exit with a protocol error.
2024-02-15 16:47:15 +00:00
matt335672 689269dcde Fixes some problems with monitor hotplug
This fixes some monitor hotplug issues with non-GFX codepaths.

1) The server_version_message() was working on an out-of-date
   copy of the client_info. As a result, the X server and the
   window manager did not agree on the number of windows
2) As a result of 1), a memory leak was found in the VNC module.
2024-02-15 16:47:15 +00:00
Koichiro Iwao 9ad0d6abb6 Just log Image RemoteFX codec 2024-02-15 13:21:17 +09:00
metalefty 45fd497645 Merge pull request #2891 from neutrinolabs/gfx_mainline_merge_work
Gfx mainline merge work
2024-02-08 21:50:16 +09:00
Koichiro Iwao 47d4ab1339 Apply astyle 3.4 code formatter 2024-02-08 15:52:54 +09:00
matt335672 54acca43cf Resize state machine: A fix and a question (#2929)
* Store EGFX state before entering resize state machine

At present the EGFX state is destroyed by states WMRZ_EGFX_DELETE_SURFACE
through WRMZ_EGFX_DELETE. This means that at WMRZ_EGFX_INITIALIZE we
cannot distinguish between EGFX not being ever used, and EGFX
having been torn down. Consequently, when running non-GFX, we don't
correctly recover the session.

* Allow multiple reasons for suppress_output

Replaces the single boolean for suppress_output with
a bitmask, to allow output to be suppressed for
more than one reason

* Disable output during resize

* Add states to dynamic resize

Adds states to the dynamic resize state machine so we wait for a
Deactivation-Reactivation sequence to finish before sending pointer
updates, etc.

* suppress module output during the dynamic resize

* Add support for dynamic resize to VNC backend

xrdp_mm needs to be informed when a resize has been performed so that
the resize stte machine can be updsate.
2024-01-31 19:08:29 -05:00
matt335672 d9783a9529 Don't pass drdynvc to neutrinoRDP
Since v0.9.9, xrdp has assumed that the "drdynvc" static virtual
channel is available for its exclusive use. With GFX support, it
is necessary to codify this to prevent this sequence of operations:-

- NeutrinoRDP target sends DVC Capabilities Request PDU
- target responds wih DVC Capabilities Response PDU
- xrdp processes this, starting the GFX virtual channel again

In the future, if NeutrinoRDP requires access to virtual channels,
data may somehow need to be passed through to the target while being
parsed and handled appropriately within xrdp.
2024-01-31 19:08:29 -05:00
matt335672 d23d147dc7 Don't enable GFX if client doesn't support 32 BPP
mstsc.exe indicates it supports GFX in the early capability flags, even
if it not able to support 32 BPP. This results in a session failure
if a RDPGFX_CAPS_CONFIRM_PDU is sent on the EGFX virtual channel.
2024-01-31 19:08:29 -05:00
Nexarian afa70e464a Initial rfx progressive integration
- Mostly base functions and utilities necessary to enable RFX
  Progressive
- Add more EGFX work & mode flags.
- Update encoder.
- Does not yet include caps determination to enable RFX progressive
  (yet).
- Update protocol constants
2024-01-31 19:08:29 -05:00
matt335672 cdf574cf6c Allow for empty fields in TS_EXTENDED_INFO_PACKET
Some clients appears to be sending cbClientAddress and/or cbClientDir
as 0 in the TS_EXTENDED_INFO_PACKET. This appears to be at odds with
[MS-RDPBCGR] which requires mandatory terminators for these fields.
2023-11-13 10:26:20 +00:00
matt335672 3a5b8936d1 libxrdp: Replace mbstowcs/wcstombs calls
These calls are replaced with the newer UTF-16 parsing code
withing the parse module
2023-10-23 14:15:47 +01:00
firewave 27d34e784d fixed Cppcheck unusedVariable warnings 2023-09-04 23:47:56 +02:00