92 Commits

Author SHA1 Message Date
matt335672 63afb676e6 drdynvc: Improve dynamic channel support
The dynamic channel handler in xrdp_channel.c is updated to allow
the procs `data_first` pointer to be NULL. If this is done, the
channel handler performs all the dechunking necessary for the channel,
and only complete data PDUs are passed to procs 'data' callback.

This facility is applied to the dynamic channels supported by xrdp_mm.c.
The incoming callbacks for these channels now provide complete support
for the specification in [MS-RDPEDYC]. The existing channels were
incomplete in these respects:
1) The "Microsoft::Windows::RDS::Graphics" channel handler did not
   support incoming PDUs between 1591 and 1600 bytes. The specification
   calls for these to be sent as a single DATA_FIRST PDU.
2) The "Microsoft::Windows::RDS::DisplayControl" channel handler did
   not support incoming PDUs over 1590 bytes.
2026-08-12 11:31:47 +01:00
matt335672 f745c9152d drdynvc: Change channel processing to use streams
The channel processor in xrdp_channel.c for dynamic streams uses
a data pointer and a length for passing PDUs or PDU fragments. We
replace this with a standard stream pointer, so that the usual
facilities can be used for checking length violcations.
2026-08-12 11:31:47 +01:00
matt335672 be95ba3017 dechunker: Create separate module for dechunking
The code in xrdp_channel.c to handle dechunking on a virtual channel is
moved to a separate module to allow for better sharing of logic.
2026-07-23 19:20:28 +01:00
matt335672 c646002779 Code quality: Remove 'struct xrdp_process *' casts
The first argument to libxrdp_init() is a intptr_t / tbus value. This
represents the xrdp instance which is using the library, but this value
is always a 'struct xrdp_process' pointer.

This PR replaces the intptr_t with an incomplete type declaration at
the interface between xrdp and libxrdp.

The original intention was probably to provide some separation from
xrdp and the libxrdp code, but in practice this has turned out not to be
useful.
2025-11-03 10:34:42 +00: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 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 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 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
a1346054 7fe18cc1c0 fix typos 2022-09-03 02:01:48 +00:00
matt335672 d5445e9dc1 Parse more physical monitor size information
To implement a scalable login screen, we need to be able to ascertain
the DPI of the connected primary monitor.

At present, in a multi-monitor situation, this information is available in
the struct display_size_description, which can be searched for the primary
monitor. This is only the case however if the Display Control Channel
Extension is in use ([MS-RDPEDISP]), and a DISPLAYCONTROL_MONITOR_LAYOUT
has been received.

This PR retrieves physical monitor size information from the following
two additional places.

1) The TS_UD_CS_CORE PDU. Physical size information is optionally
   included in this PDU for single-screen configurations.
2) The TS_UD_CS_MONITOR_EX PDU. This includes physical size
   information for multiple-screen configurations.
2022-07-29 10:48:04 +01:00
matt335672 8fdc1ba216 Relaxed Channel Join PDU requirements for non-TLS
Windows 10 RDS is quite relaxed about missing channel join PDUs,
whereas we have to adhere quite tightly to the specification to
make sure we get a TLS "Client hello" where appropriate. This makes
us incompatible with older RDP clients. For example, the Wyse sx0
thin client does not send a channel join PDU for the user channel.
Older, non-TLS versions of xrdp supported these devices.

This commit re-implements the xrdp v0.6.1 behaviour for non-TLS
connections only, allowing system administrators to use these devices
on trusted networks. These devices are in any case too old to
establish a modern TLS connection.
2022-05-18 12:18:23 +01:00
Christopher Pitstick bd9147d18f Updating to refactor xrdp_client_info
- Eliminate duplicaiton for display_size_description
- monitorCount needs to be uint32_t
- width/height -> session_width/session_height
- Update CLIENT_INFO_CURRENT_VERSION
- Also some misc unit test updates.
- Minor log updates.
2022-03-27 16:38:32 -04:00
Christopher Pitstick 4a0db63be7 Unify monitor processing logic.
There are two places where monitor descriptions are passed through the
RDP protocol:

- TS_UD_CS_MONITOR ([MS-RDPBCGR] 2.2.1.3.6 Client Monitor Data)
- DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT ([MS-RDPEDISP] 2.2.2.2)

The processing logic for both of them is similar enough that they should be unified.

Also update to define the constants for the maximum and minimum desktop width/height for monitors and total area.

Also a large number of clarifications for the constants and protocol
requirements.

Note that this is also the first step to making resizing work with the extension GFX channel as well as an important
foundational step to enable HiDPI compatibility.

Also some misc logging updates.
2022-03-26 23:45:16 -04:00
aquesnel 0ec471b02d Add detailed logging to libxrdp (#1742)
* Added s_rem(s) for getting the remaining bytes in a stream
* Added s_rem_out() macro
* Fixed 15bpp pointer error checking
* Combined the 512 and 2048 bit certificate sending  code paths
* Other detailed comments and logging added following MS-RDPBCGR
2021-02-04 10:11:54 +00:00
Alexandre Quesnel 51905d765a Migrating logging to LOG() and LOG_DEVEL() in libxrdp/* 2020-11-30 05:04:10 +00:00
jsorg71 ae1514c167 dynamic virtual channel improvements
remove not used chansrv <-> xrdp messages
move static channel disable control into libxrdp
remove some blocking read, write chansrv calls
add drdynvc calls to libxrdp
add drdynvc calls to chansrv
channel cleanup
2018-10-11 22:09:20 -07:00
Pavel Roskin 148afd1170 Rename file_loc.h to xrdp_sockets.h, install it
Include xrdp_sockets.h directly, not through headers.
2017-03-28 00:59:16 -07:00
Pavel Roskin 6ed4c969f4 Eliminate APP_CC and DEFAULT_CC 2017-03-14 00:21:48 -07:00
Pavel Roskin 30a7a947b1 Don't include config_ac.h from any header files 2017-03-04 00:52:34 -08:00
Jay Sorg 6f74efa70a add session_info
Conflicts:
	libxrdp/libxrdp.h
2017-01-15 08:20:50 +02:00
Pavel Roskin ca9cbcafc8 Typo fixes 2016-05-04 23:33:30 -07:00
Pavel Roskin 964e860072 Run through codespell 2016-01-14 08:47:50 -08:00
Jay Sorg 605df27103 libxrdp: remove a global, remove some tabs 2014-11-06 16:51:39 -08:00
Idan Freiberg afdf638c7b libxrdp, common: work on TLS mode 2014-07-23 15:31:45 +03:00
Idan Freiberg 7ab1d887ae libxrdp: work on TLS support 2014-07-17 14:29:23 +03:00
Idan Freiberg f0b6c6b1d1 libxrdp: started adding TLS support 2014-07-15 18:29:40 +03:00
Idan Freiberg 9795ce010a libxrdp: changes in rdp security layer negotiation 2014-07-10 15:40:16 +03:00
Jay Sorg bd810c0695 support 2048 bit RSA keys 2014-06-18 22:02:58 -07:00
Jay Sorg a16b83ac8a libxrdp: remove some alloc / free 2014-06-18 21:10:15 -07:00
Jay Sorg b142a59e69 libxrdp: changes for planar compression 2014-06-17 22:41:10 -07:00
Jay Sorg d672eb8995 no logic change, indent 2014-06-02 22:00:51 -07:00
Jay Sorg 6d7e315b0c work on surface command 2014-03-18 00:07:11 -07:00
speidy a801e44bfa o libxrdp: move rdp capabilites form xrdp_rdp to a new file xrdp_caps.c
o move monitor layout call to demand active.
2014-03-10 03:39:39 +02:00
Jay Sorg d18704d740 libxrdp: work on fastpath fragments 2014-03-09 12:11:36 -07:00
Jay Sorg ff8821c308 libxrdp: fastpath output, orders working 2014-03-07 12:45:33 -08:00
Jay Sorg cf39a90d80 libxrdp: detect client fastpath caps 2014-03-06 23:28:57 -08:00
speidy 866fde498e libxrdp: move fastpath callback calls from xrdp_rdp to xrdp_fastpath 2014-03-04 23:56:26 +02:00
speidy 1f1e803140 Merge ../../neutrinolabs/xrdp into fastpath
Conflicts:
	libxrdp/libxrdp.c
	libxrdp/libxrdp.h
	libxrdp/xrdp_iso.c
	libxrdp/xrdp_sec.c
	libxrdp/xrdp_tcp.c
	xrdp/xrdp.ini
2014-03-02 01:39:34 +02:00
Jay Sorg e9e14f22f9 started work on fastpath, restructure PDU in 2014-02-25 20:47:34 -08:00
Jay Sorg 950ef882f4 libxrdp: work on fips 2014-02-23 20:45:59 -08:00
Jay Sorg 8e4520b3c3 libxrdp: work on fips 2014-02-22 22:44:58 -08:00
Jay Sorg b81bd005bf libxrdp: started adding FIPS crypt 2014-02-20 00:41:53 -08:00
Jay Sorg c8579c3403 libxrdp: started adding planar bitmap compression 2014-02-15 21:19:54 -08:00
speidy f8d26973d0 libxrdp: work on fastpath input, fix length issue in fastpath_recv 2014-02-10 06:26:55 +02:00
speidy f525c0f8e7 libxrdp: work on fastpath input 2014-02-10 05:48:03 +02:00
speidy cbf5d50a5c libxrdp: work on fastpath input 2014-02-09 01:42:04 +02:00
speidy 113f2696fe libxrdp: work on fastpath 2014-02-08 13:34:01 +02:00
Laxmikant Rashinkar 6cd342a20a added code for region copy used in codec mode 2014-01-20 17:48:17 -08:00
speidy 6f7958bdcb libxrdp: move xrdp_rdp_send_monitorlayout call after demand active pdu 2013-11-19 21:34:07 +02:00
speidy 5591c19b3f libxrdp: remove old monitor_list struct 2013-10-30 21:34:51 +02:00