Commit Graph

149 Commits

Author SHA1 Message Date
matt335672 984b71449e Regression: Support fixed-size VNC sessions
This is a regression introduced in v0.10.x

This version introduced a state machine to handle resizes requested
by the client and the server. Most configurations support resizeable
sessions, but one that doesn't is xrdp connecting to x11vnc on (e.g.) a
Raspberry PI.

If the session size requested by a client is differnt from the x11vnc
size, an error is logged and the state machine fails to complete,
resulting in a black screen.

This PR handles the problem by queueing a resize to the supported
server size and then continuing with the state machine. It's not an
optimal solution, but involves the least change to v0.10.x code.
2024-09-09 15:07:31 +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 7fe5b3ea34 Move pause key processing from xorgxrdp
This commit moves processing of the pause key from xorgxrdp
back to xrdp itself, so that the key can be passed to the VNC
backend.
2024-08-05 10:44:10 +01:00
firewave 5db94568ec vnc/vnc.c: fixed `-Wmaybe-uninitialized` warnings
vnc.c: In function ‘lib_framebuffer_update’:
vnc.c:816:37: error: ‘b’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  816 |         return (r << 16) | (g << 8) | b;
      |                ~~~~~~~~~~~~~~~~~~~~~^~~
vnc.c:1301:9: note: ‘b’ was declared here
 1301 |     int b;
      |         ^
vnc.c:816:31: error: ‘g’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  816 |         return (r << 16) | (g << 8) | b;
      |                            ~~~^~~~~
vnc.c:1300:9: note: ‘g’ was declared here
 1300 |     int g;
      |         ^
vnc.c:816:19: error: ‘r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  816 |         return (r << 16) | (g << 8) | b;
      |                ~~~^~~~~~
vnc.c:1299:9: note: ‘r’ was declared here
 1299 |     int r;
      |         ^
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 e27c634970 Update VNC module resize functionality
Significant updates for the VNC module:-
1) Support for the new API calls allowing both server and client
   multi-monitor resizes.
2) The s member variable of the vnc_screen_layout structure is no longer
   dynamically allocated.
3) The module server_width and server_height member variables are
   removed as these are just duplicating server_layout.total_width and
   server_layout.total_height.
4) When the server screens are resized, there is no need to restart the
   entire resize state machine as we already know at this point that
   the server supports resizing.
2024-02-15 16:48:13 +00:00
matt335672 ae836fb543 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-15 16:48:13 +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
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 c52a173db0 Use symbolic constants in the modules for WM events 2023-11-27 15:42:24 +00:00
Koichiro IWAO 2b0c903afe vnc: add mouse button 6, 7, 8 support 2022-11-14 22:23:29 +09:00
Koichiro IWAO 70bc5ea092 vnc: Constify existing use of magic numbers 2022-11-14 22:23:29 +09:00
a1346054 7fe18cc1c0
fix typos 2022-09-03 02:01:48 +00:00
matt335672 275eaf7683 Rework transport connect logic
There are a number of ways the existing transport connect logic in
trans_connect could be improved for POSIX compatibility, and also
slightly tidied up:-
1) The same socket is re-used for multiple connect attempts following
   failure which isn't behaviour defined by POSIX.1-2017 (although it
   works on Linux).
2) An asynchronous connect is started, and then after a short
   delay connect() is called again on the same socket. POSIX.1-2017
   is clear that in this situation EALREADY is returned before the
   connection is established, but is silent on the behaviour expected
   when the connection is established. Returning success is an option,
   but so is returning EISCONN. The current code assumes the connect()
   call will succeed.
3) The code contains two virtually identical, quite complex loops for
   TCP and UNIX sockets, differing only in the calls to create a socket
   and connect it.
4) trans_connect() contains looping and retry logic, but this isn't
   seen as sufficient by the chansrv connect code in xrdp/xrdp_mm.c and
   the Xorg connect code in xup/xup.c. Both of these implement their own
   looping and retry logic on top of the logic in trans_connect(),
   resulting in slightly unpredictable behaviour with regard to
   timeouts.
5) A socket number can technically be zero, but in a couple of places
   this isn't allowed for.

This PR attempts to correct the implementation of trans_connect(),
and also to simplify the areas it is called from.

As part of the PR, the signature of the server_is_term member of the
xrdp module interface is changed to match the signature expected by the
is_term member of a struct trans. This allows for trans_connect()
in xrdp modules to directly access g_is_term() within the main xrdp
executable. At the moment this functionality is only used by the xup
module.
2022-03-31 20:48:07 +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
matt335672 e6c098e750 Remove s_check() macro 2022-02-09 10:18:15 +00:00
matt335672 d02059d967 Add missing ssl_sha1_clear()/ssl_md5_clear() calls 2022-01-20 16:43:00 +00:00
matt335672 ab0e141fa9
Merge pull request #2011 from matt335672/unify_scpv0_code
Unify scpv0 code #2011
2022-01-05 11:06:42 +00:00
matt335672 67bf23feee Fix gcc11.1 uninitialised var warning 2022-01-04 10:09:33 +00:00
matt335672 8b9b22c773 Create shared GUID module to simplify session guid handling 2021-11-25 13:29:55 +00:00
matt335672 15b7f18ede Minor memory leaks found with valgrind 2021-10-21 15:24:39 +01:00
matt335672 0c605a3cc4
Merge pull request #2014 from matt335672/xrdp_leaks
Fix definitely lost memory leaks #2014
2021-10-20 10:23:09 +01:00
matt335672 0b5445b676 Remove unnecessary error from neutrinordp log 2021-10-12 14:37:28 +01:00
matt335672 b0f3b13cff Fix minor memory leaks 2021-10-11 19:30:47 +01:00
matt335672 ae45344a45 Add missing rfb.c to the VNC module makefile 2021-09-08 09:46:29 +01:00
matt335672 ce27e25dcc Rename misnamed function get_eds_status_msg 2021-09-06 10:33:09 +01:00
matt335672 f55a8fbfc5 Cater for RFB clip size of zero bytes 2021-08-05 16:06:10 +01:00
matt335672 87bbfd96ca Use symbolic names for static virtual channel name strings 2021-06-08 14:11:17 +01:00
matt335672 f52d038d3e Don't tell the RDP client about unchanged clip data from the RFB side 2021-06-08 14:11:17 +01:00
matt335672 fe28af93e8 Split up vnc.c into modules and re-implement clipboard functions 2021-06-08 14:11:17 +01:00
matt335672 949a81443b Add server_chansrv_in_use() to module interface 2021-06-08 14:11:17 +01:00
matt335672 52a52daddd Split development option into separate things 2021-05-28 10:57:12 +01:00
Alexandre Quesnel 52707ac686 Fixing formatting with astyle 2021-05-08 16:58:11 +00:00
Christopher Pitstick deb66ce766 Resolution switching without reconnecting.
- Based on https://github.com/jsorg71/xrdp/tree/dynamic_monitor
- Tested with xorgxrdp
- Tested with vnc
- Only works with single monitor.
- Update documentation to clarify the difference between MSTSC and
Microsoft Remote Desktop.
- Does not include compatibility with /gfx at this time, which is still
in testing.
- Updates to include ms-rdpedisp.h header for the 2.2.2 specification of
the protocol.
- Adds new dynamic_monitor_layout struct that shares the number of
monitors with xrdp_client_info.h
- Does not allow for BPP changes because the RDP protocol doesn't
support it.
- Option to disable feature as NeutrinoRDP doesn't support it (It was
based on FreeRDP 1.0.1 which didn't yet have this feature.)
- Add CLIENT_MONITOR_DATA_MAXIMUM_MONITORS constant and reference
spec definition.

Depends on https://github.com/neutrinolabs/xorgxrdp/pull/183
2021-04-22 01:34:03 -04:00
aquesnel def72ac4be
Unify logging in vnc/* (#1811)
* Migrating logging to LOG() and LOG_DEVEL() in vnc/* (#1811)
2021-03-01 10:11:11 +00:00
matt335672 0a1a8f40e5 Moved a lot of string funcs to string_calls module 2020-12-22 11:57:24 +00:00
Matt Burt 1f8bb57fd6 Improve source_info commenting and fix neutrino slow link 2020-10-20 09:55:17 +01:00
matt335672 3c4b42b1aa Implemented resize and multimon support for VNC backend 2020-06-04 15:10:35 +01:00
Jay Sorg eb56683df0 update the module version 2019-04-25 14:54:25 -07:00
Jay Sorg 4cbf84d99b vnc: implement suppress output 2019-04-25 14:54:25 -07:00
Vraiment 4cee6726f8 Make changes to generate dylibs in mac again 2018-01-30 01:21:07 -08:00
Pavel Roskin 6ed4c969f4 Eliminate APP_CC and DEFAULT_CC 2017-03-14 00:21:48 -07:00
Pavel Roskin b2d3dcf169 Include config_ac.h from all source files 2017-03-04 00:52:34 -08:00
Pavel Roskin b8ed23daab Constify the value argument to mod_set_param 2017-01-11 11:59:11 -08:00
Pavel Roskin f25659d2ee Suppress versioning for modules, tell libtool they are modules
Versioning is for libraries. Modules are not libraries; no code is linked
against them.

Libtool makes sure the modules can be opened by dlopen(). That is already
true for ELF format, but other file formats may need special processing.
2017-01-06 10:52:44 -08:00
volth 26a26ef906 fix build with --enable-xrdpdebug=yes 2017-01-04 19:20:44 +00:00
volth 37b4a14b54 fix build with --enable-xrdpdebug=yes 2017-01-04 13:00:01 +00:00
Pavel Roskin a8fcbf8c2d Fix support for 32-bpp clients connecting to 16-bpp VNC 2016-12-09 08:43:07 -08:00
Jay Sorg 9a517b34f0 vnc: code cleanup 2016-12-04 15:39:10 -08:00
Jay Sorg 57905d71ad vnc: change password file to use guid hash 2016-12-03 23:12:48 -08:00