Commit Graph

916 Commits

Author SHA1 Message Date
Koichiro Iwao
4d4ecdcaa4 GFX: selectable lossy compression levels
(cherry picked from commit e3c83c544c)
2024-07-30 10:45:41 +09:00
matt335672
61b509f1d5 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.

(cherry picked from commit 8ac2f6db34)
2024-06-27 11:55:26 +01:00
matt335672
029059ef3d Fix min/max monitor placing issue
when a multi-monitor session has the top-left vertex of the primary
monitor at a desktop location other than (0,0), minimising and maximising
the session results in the (0,0) co-ordinate of the entire desktop being
placed at the top-left of the primary monitor.

The implementation seems to be at odds with [MS-RDPEGFX] 2.2.2.14 which
suggests the monitorDefArray of the RDPGFX_RESET_GRAPHICS_PDU should be
the same as that in the Monitor Layout PDU ([MS-RDPBCGR] 2.2.12.1)

(cherry picked from commit 095f0d0e4c)
2024-06-19 09:12:19 +01:00
matt335672
2319f56268 Replace 'dvorak' keyboard description with 'us(dvorak)'
In the words of @iskunk

It is no longer possible to refer to the Dvorak layout as just "dvorak"
(as when one would run "setxkbmap dvorak"); one must now use either
"us dvorak" or "us(dvorak)"

See https://bugs.debian.org/1063725

(cherry picked from commit a1b7c17906)
2024-06-12 14:09:31 +01:00
matt335672
a5ec4a3817 Add explicit object for the encoder finishing
On a resize, the encoder is deleted. At present this is done by asking
the encoder to exit, and then waiting a second.

- On slower systems, a second may not be enough, and so the encoder
  data structures are freed while they are still being used by the
  encoder.
- On quicker systems, resizes are delayed by hundreds of milliseconds
  longer than they need to be.

This commit adds a wait object which the encoder can use to signal it
has actually finished.

(cherry picked from commit 985b0de35e)
2024-06-10 18:54:26 +01:00
matt335672
a430eb93cb Prevent SEGV when resizing with GFX
The xrdp_enc_data contains a union for handling surface commands
and gfx commands. Memory processing is different for these two
options.

The default destructor for the encoder FIFO only knows about surface
commands. Consequently, if the encoder has queued GFX data when the
encoder is closed, the destructor processes the queued data as if
it contained surface commands rather than GFX commands. This typically
causes a SEGV as the drects field of the overlaid surface command
structure is not pointing at anything valid when it is freed.

(cherry picked from commit 809df89c08)
2024-06-10 18:54:18 +01:00
Jay Sorg
dfa52c1183 format change
(cherry picked from commit 898e1ca135)
2024-04-15 19:26:48 +01:00
Jay Sorg
7030a74ab9 gfx send multiple wire to surface messages when compressed data is larger than max_compressed_bytes
(cherry picked from commit 95bfb349a8)
2024-04-15 19:26:35 +01:00
Jay Sorg
9dbe504878 remove per frame log entry when client frame acks is off
(cherry picked from commit 651fcf85b7)
2024-03-27 09:49:57 +00:00
matt335672
40b0eaf455 Improve performance on long fat networks (LFNs)
On Linux, the TCP send buffer size is increased to 32768 if it is less
that this (which it normally is). This however has the effect of disabling
dynamic buffer sizing, leading to a maximum available bandwidth of

max_bandwidth = 262144 (bits) / round_trip_time (secs)

This is not noticeable on a LAN with an RTT of around 0.5ms, but
very noticeable on a WAN with an RTT of 0.25s.

Comments in the config file and manpage in this area are improved, as
is the logging if the parameters are actually set.

(cherry picked from commit b23d6f89d5)
2024-03-27 09:48:16 +00:00
matt335672
68f6113430 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-15 10:31:58 +00:00
matt335672
84fd2a510b 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-15 10:31:46 +00:00
rowlap
790834a947 Remove duplicate DEBUG output
allow_multimon and new_cursors are printed twice

(cherry picked from commit bf81557cdc)
2024-03-06 17:20:47 +09:00
matt335672
d6cf81a4da Increase GFX output buffer size
Size the GFX output buffer pessimistically based on the largest monitor
in the configuration.

(cherry picked from commit 90e4aca26a)
2024-03-03 10:04:28 +09:00
Koichiro Iwao
ab2430ac76 Suppress some logs when no errors
This outputs per-frame logs when using VNC backend and on login screen.

(cherry picked from commit 0b4150ff48)
2024-03-01 00:06:14 +09:00
rowlap
72d30061b0 Remove tcutils channel from xrdp.ini
According to #1943 tcutils was removed, so update the channel section to match.

(cherry picked from commit 2a0c2a612f)
2024-02-27 22:32:41 +09:00
matt335672
83f9d4ec17 GFX: Fix disconnect on resize of busy windows
When a resize is underway on a busy X server, it is possible for a
queued EGFX cmd (order #62) to be processed after the decoder has been
deleted. This causes a client disconnect with no useful error message.

(cherry picked from commit 3430b8898c)
2024-02-24 00:52:00 +09:00
Koichiro Iwao
99cf0e19f7 Bump copyright year and make easier to bump
(cherry picked from commit ae249c6755)
2024-02-22 22:51:37 +09:00
Koichiro Iwao
9b33d299d0 GFX: Relegate some logs to LOG_LEVEL_DEBUG
(cherry picked from commit 7e305f9e24)
2024-02-22 22:51:14 +09:00
matt335672
d769b402bc GFX: Prevent MM screen being written to the client
In GFX mode, if we're using xorgxrdp, frame updates are send directly
from the client, bypassing the screen buffer in xrdp_mm.

This commit only allows the xrdp_mm screen buffer to be invalidated
if the painter has drawn into it since the module was loaded. This
prevents the unused (and invalid) frame buffer being pushed to the client
in GFX mode with xorgxrdp.
2024-02-21 00:14:26 +09:00
matt335672
ab698c3d58 Clear memory allocated to resized bitmaps
This prevents valgrind errors when resizing the screen to
a larger size on GFX systems.
2024-02-21 00:14:26 +09:00
matt335672
355a71fe6d Prevent EGFX drawing while channel is down
Clear egfx_up as soon as the channel starts to close so that
xrdp_mm_draw_dirty() doesn't send data to a closed channel.
2024-02-21 00:14:26 +09:00
matt335672
ee37eb2803 EGFX: Ignore incoming messages after close sent 2024-02-21 00:14:26 +09:00
matt335672
74c2f7c4a7 Rework xrdp to support new module resize interface
This commit compiles.
2024-02-21 00:14:26 +09:00
matt335672
bfecd1887b Update module interfaces with new calls for resizing
This commit DOES NOT compile.

This change alters these module interface calls:-
1) mod_server_monitor_resize() (Call from xrdp to module). Updated.
2) server_reset() (Call from module to xrdp). Replaced.

The mod_server_monitor_resize() call is updated :-
1) to allow a monitor list to be passed in for a multimon resize
2) with an 'in_progress' return value which tells the caller whether or
   not to expect a callback.

The server_reset() call served two purposes up until now:-
1) To allow a module to resize a single monitor session. There
   is no way to request a multi-monitor resize from the module
2) (with bpp == 0) To signal to the mm resize state machine that
   a server screen resize hsa finished.

This is split into two calls:-
1) client_monitor_resize() to allow a mdule to request a
   multimon resize.
2) server_monitor_resize_done(). This is called by a module
   when a resize is completed.
2024-02-21 00:14:26 +09:00
matt335672
e00236193f 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-21 00:14:26 +09:00
Koichiro Iwao
2307608cfb Apply astyle 3.4 code formatter 2024-02-08 21:53:58 +09:00
metalefty
76242bbf63
GFX: Relegate some logs to LOG_DEVEL (#2939) 2024-02-08 21:09:09 +09:00
Nexarian
8027a42497 More NPE fix 2024-02-02 21:19:49 -05:00
Nexarian
75b41afa04 Fix crash with resizing 2024-02-02 18:53:41 -05:00
jsorg71
33539c1d8b
Gfx mainline merge multimon1 (#2933)
* GFX: work on multimon

* fix for non GFX multimon
2024-02-01 10:28:30 -05: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
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
matt335672
e5d455d0be error-check xrdp_mm_egfx_send_planar_bitmap() paths
Without some checking for this call, it's possible for the xrdp
process to never end when the client goes away.
2024-01-31 19:08:29 -05:00
Jay Sorg
3fab31c644 GFX: fix multimon login screen drawing 2024-01-31 19:08:29 -05:00
Nexarian
97b2527018 Enabling RFX_PRO key frame handling.
- Also update librfxcodec
2024-01-31 19:08:29 -05:00
jsorg71
c961563403 GFX: sort versions, flags to return the highest version we support in… (#2911)
* GFX: sort versions, flags to return the highest version we support in caps advertise

* GFX: simpify swtich in caps_advertise

* GFX: log skipped capability versions in caps_advertise
2024-01-31 19:08:29 -05:00
Nexarian
1b6ca2245d Fix memory leak and RFX encoder notify 2024-01-31 19:08:29 -05:00
Nexarian
584a894490 Add 0 as valid g_obj_wait timeout instead of having it be equivalent to -1. 2024-01-31 19:08:29 -05:00
Nexarian
63e963daf6 Switching encoder logging statements to LOG not LOG_DEVEL 2024-01-31 19:08:29 -05:00
Nexarian
de2c01ad1d Updating quantization values to remove corruption. 2024-01-31 19:08:29 -05:00
Nexarian
65137e6edb More integration work from mainline_merge_shm
- Introduce functional EGFX caps.
- Prototype of RFX Progressive working.
- Update resizing to work with it.
- Refactoring
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
c52a173db0 Use symbolic constants in the modules for WM events 2023-11-27 15:42:24 +00:00
matt335672
50cff2eb75
Merge pull request #2794 from matt335672/utf_changes_new
Improve Unicode support
2023-11-02 10:57:39 +00:00
matt335672
675dd77807 Parameterise the sockdir with the UID of the user
The top level socket directory is now called XRDP_SOCKET_ROOT_PATH.
Below that are user-specific directories referred to with the
XRDP_SOCKET_PATH macro - this name is hard-coded into xorgxrdp and
the audio modules as an environment variable.

XRDP_SOCKET_PATH now looks like $XRDP_SOCKET_ROOT_PATH/<uid>

XRDP_SOCKET_PATH is only writeable by the user, and readable by the user
and the xrdp process.
2023-10-23 18:14:46 +01:00
matt335672
a50afc6500 Update xrdp font handling to use new UTF-8 calls 2023-10-23 14:15:47 +01:00
matt335672
0463e552dc Add UTF-8 / UTF-32 conversion routines
These are intended to replace non-UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672
bc3ea01b3e CVE-2023-42822
- font_items in struct xrdp_font renamed to chars to catch all
  accesses to it. This name is consistent with the type of
  the array elements (struct xrdp_font_char).
- Additional fields added to struct xrdp_font to allow for range
  checking and for a default character to be provided
- Additional checks and logic added to xrdp_font_create()
- New macro XRDP_FONT_GET_CHAR() added to perform checked access
  to chars field in struct xrdp_font
2023-09-26 09:29:56 +01:00
Jay Sorg
433c05eb36 fix valgrind warning on font 2023-09-25 20:57:07 -07:00