Commit Graph

784 Commits

Author SHA1 Message Date
matt335672
ddff9ebb32 Refactor xrdp_listen to allow for privilege drop
- xrdp_listen.c is refactored so we can create the
  listening socket(s) before dropping privileges.
- The code which reads startup params from xrdp.ini
  is moved from xrdp_listen.c to xrdp.c, so it
  is only called once if we test the listen before
  starting the daemon.
2024-07-01 11:11:21 +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
matt335672
f38e215de5 Fix build with devel logging, but without --enable-pixman
If ./configure is used with devel logging, but without --enable-pixman,
the stub pixman development files are used.

However, in this configuration, the pixman_region_selfcheck() function
is declared, but not defined.

This is a regression introduced in 7e58209b19
2024-06-03 11:46:08 +01:00
Jay Sorg
2bed4f6b9b rename old_capture_code to mark unused 2024-05-28 10:57:55 -07:00
Jay Sorg
112a534f4c change capture_code to enum 2024-05-28 10:57:55 -07:00
matt335672
fe410a595d Update genkeymap executable to use new format 2024-05-24 16:33:08 +01:00
matt335672
b0cfc1a12b Add initial scancode module 2024-05-24 16:33:08 +01:00
matt335672
98d0003715
Merge pull request #3058 from seflerZ/unicode_contr
Add ibus unicode input support
2024-05-20 12:27:52 +01:00
matt335672
4e77772ea2 Fix problems detected by -fsanitize=address 2024-05-07 12:51:30 +01: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
f5d8fe5f3d
Merge pull request #2959 from matt335672/remove_librt_from_link
Remove unnecessary '-lrt' from common lib link
2024-03-22 12:08:11 +00:00
matt335672
fb34d742bb
Merge pull request #2910 from matt335672/fix_lfn_performance
Improve performance on long fat networks (LFNs)
2024-03-22 12:07:58 +00:00
Derek Schrock
5afbca4954 Fall back to IPv4 if IPv6 capable but don't have an IPv6 address set
When xrdp is built with IPv6 support it will only fall back to IPv4 if
IPv6 is not supported (EAFNOSUPPORT).  However, if the system is IPv6
capable but doesn't have an IPv6 address set (at least inside a FreeBSD
jail) EPROTONOSUPPORT is returned from socket().
2024-02-25 17:53:44 -05:00
matt335672
e821eddb62 Remove unnecessary '-lrt' from common lib link
The '-lrt' added to the Makefile for the common library appears
to be unnecessary.

- On modern Linuxes, this library has been merged with libc, and the
  supplied library is empty.
- On older ones (e.g. Devuan 4), the library contains routines we
  do not use in xrdp (although we use 'shm_open()' in xorgxrdp).
- On FreeBSD 14 the library contains only mq_*  and timer_* routines
  which, again, are not required.
2024-02-21 12:43:53 +00:00
matt335672
bc9b35c38c Rename struct exit_status in os_calls
This conflicts with struct exit_status in <utmp.h>
2024-02-21 09:24:48 +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
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
Nexarian
2e1f7f1484 Adding KEY_FRAME_REQUESTED parameter. 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
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
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
b23d6f89d5 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.
2024-01-11 11:53:54 +00:00
matt335672
b80f07d2a7 Improve portability
- Use clearenv() if it exists
- Don't rely on <limits.h> being pulled in by <sys/param.h>
- Rename the DEFAULT_TYPE macro in sesrun.c.  This name appears to be
  used on Solaris. It's not a good choice.
2024-01-11 11:16:06 +00:00
matt335672
62a51dead9 Fix g_strtrim() regression
Commit 36ea4a3 failed to take UTF-8 characters into account on
platforms with signed char.
2024-01-02 11:07:28 +00:00
r-a-sattarov
aa8c651e38 common/arch.h: added e2k arch definition
Ref: https://en.wikipedia.org/wiki/Elbrus_(computer)
2023-12-11 22:34:17 +03:00
matt335672
c52a173db0 Use symbolic constants in the modules for WM events 2023-11-27 15:42:24 +00: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
50cff2eb75
Merge pull request #2794 from matt335672/utf_changes_new
Improve Unicode support
2023-11-02 10:57:39 +00:00
matt335672
76d12c50a8
Merge pull request #2838 from matt335672/fix_devredir_ordering
Fix message ordering in devredir
2023-10-26 15:28:10 +01:00
matt335672
7ceff70c1c Fix message ordering in devredir
The drive redirector is not compliant with the message ordering
in [MS-RDPEFS], causing FreeRDP 2.11.2 ro fail on redirecting drives.
2023-10-26 15:17:17 +01: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
547c619c2f Move g_mk_socket_path() to sesman
The sockdir is only used when sesman is active. The
call g_mk_socket_path() is removed from os_calls and moved to
sesman.

We also change the permissions on this directory to
0755 rather than 01777 (01000 is the 'sticky bit', S_ISVTX).

The behaviour of g_create_dir() has been modified to not
set S_ISVTX on Linux directories. This is implementation-defined
behaviour according to 1003.1, and is no longer required for the
sockdir.
2023-10-23 15:51:17 +01:00
matt335672
f5f67e2e80 Remove g_mbstowcs() and g_wcstombs()
These calls are now replaced with explicit UTF conversion routines in
the common/string_calls.[hc] and common/parse.[hc] modules.

Also removed:-
- The support code in common/os_calls.c to set the locale to use
  these routines.
- The twchar type in arch.h
2023-10-23 14:19:49 +01:00
matt335672
36ea4a3f86 Remove mbstowcs/wcstombs from g_strtrim()
Because of the way UTF-8 encoding works, there is no need to
use mbstowcs/wcstombs in the implementation of this function.
2023-10-23 14:15:46 +01:00
matt335672
0758fe03a6 Add UTF-16 LE I/O routines
These are intended to replace UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +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
d11617adbe Remove dependency on signal() function
Replaces uses of signal() with sigaction() which should be far
more portable.
2023-10-09 14:05:29 +01:00
matt335672
cf677da22c Add getgrouplist() support to os_calls
On enterprise systems, using getgrouplist() (if available)
is more efficient than iterating over the members of the group,
and is also more likely to work
2023-10-04 11:02:07 +01:00
Keith Gable
9305008ba8 Tolerate XRDP_ENABLE_VSOCK being defined but the platform is neither FreeBSD nor Linux 2023-09-24 12:32:10 -07:00
Keith Gable
5ffca14b2f Change indent style to allman 2023-09-24 12:27:00 -07:00
Keith Gable
572ee7686d On FreeBSD, use AF_HYPERV in place of vsock 2023-09-23 21:28:24 -07:00
matt335672
ce42e3e12d Replace g_strsignal() with g_sig2text()
This call provides a textual representation of a signal number, i.e.
SIGHUP is mapped to "SIGHUP"

Unit tests are also added.
2023-06-12 16:19:17 +01:00
matt335672
0f32661056 Add g_strsignal() to string_calls module 2023-06-08 16:32:24 +01:00