Commit Graph

1188 Commits

Author SHA1 Message Date
matt335672
514c62c7c1
Merge pull request #3275 from matt335672/move_to_fuse3
Move to fuse3
2024-10-23 10:12:35 +01:00
matt335672
c46eece00f Add support for creating sockdir to chansrv
Chansrv now checks for the user sockdir being present. If it
isn't, it connects to chansrv and requests it be created.

This also needs the sesman port to be added to the chansrv
config struct.
2024-10-22 12:21:25 +01:00
matt335672
661885f71d Add support for SCP create_sockdir message to sesman 2024-10-22 12:21:25 +01:00
matt335672
4d80cf6d77 Move SCP synch calls from sesman tools to library
The sesman tools have some private functions to make syncronous calls
to sesman over SCP. This commit moves these calls to a new module
scp_sync in libipm so that they can be utilised by other parts of
xrdp (i.e. chansrv)
2024-10-22 12:21:25 +01:00
matt335672
dd1dc7c630 Use proper define for sesman listen_port size
The size of the listen_port for sesman cannot exceed
XRDP_SOCKETS_MAXPATH. We should use this value rather than
an arbitrary value of 256.
2024-10-22 12:21:25 +01:00
matt335672
b5772cef91 Only use fuse_set_log_func() for libfuse >= 3.7 2024-10-21 16:55:24 +01:00
matt335672
edd4276633 Migrate chansrv to FUSE3 interface 2024-10-15 11:44:16 +01:00
matt335672
b9703af7ee Pick up correct includes/libraries for FUSE3 2024-10-14 16:44:09 +01:00
Bob Carroll
89a4a1b8f7 update man page and fix code style issue 2024-09-24 18:03:40 -07:00
Bob Carroll
66e5eebb1c add option to enable FUSE direct i/o on file open 2024-09-20 20:23:47 -07:00
matt335672
7efcaaf027 Minor update to policy description in sesman.ini 2024-09-05 11:24:17 +01:00
matt335672
0f6e731524 clipboard: Allow a file read to return 0 for EOF
When used with a FreeRDP client on Linux, a file copy operation from
the clipboard detects end-of-file by a read returning 0 bytes. This is
currently marked as an error.

It is assumed that mstsc.exe detects end-of-file in another way, which
is why this has not been found before.
2024-08-02 12:41:20 +01:00
matt335672
34b5582460 Remove unnecessary copy from clipboard_get_files()
The routine clipboard_get_files() parses a potentially long string,
and copies portions of it into a temporary buffer. This buffer is then
passed to clipboard_get_file() as pointer + length;

The buffer is inadequately sized for very long filenames which may
approach XFS_MAXFILENAMELEN in length. This can cause chansrv to fail
when the user copies such filenames.

It turns out the buffer is unnecessary, as the filenames can be
passed directly into clipboard_get_file() from the source string,
using pointer + length. This avoids the length limitation entirely.
2024-08-02 12:41:20 +01:00
matt335672
c3f7eec4f5 Allow for longer filenames from the redirector.
This commit ensures that filenames up to the maximum size supported
by our xfs can be supported.
2024-08-02 12:41:20 +01:00
matt335672
a90228241d Remove hard-coded filename limit for clipboard file lists
The limit of 256 characters for clipboard files is limiting for
many Asian locales, particularly as '%xx' notation is used to
communicate bytes with bit 7 set.
2024-08-02 12:41:20 +01:00
matt335672
d8b5435710 Dynamically allocate XFS filesystem names
Replace the 256 byte buffer used for names in the XFS filesystem with a
dynamically allocated buffer.

The define XFS_MAXFILENAMELEN which used to be 255 has been retained,
but bumped to 1023. This value is no longer used for long-lived
allocations, but is used in chansrv_fuse.c for maintaining state
information for in-fligh I/O requests.
2024-08-02 12:41:20 +01:00
metalefty
f1d3b21177
Merge pull request #3189 from metalefty/tarball
Include {xrdp,sesman}.ini.in instead of substituted .ini in tarball
2024-08-01 21:17:43 +09:00
Koichiro Iwao
5e95fc0cb3 Include {xrdp,sesman}.ini.in instead of substituted .ini in tarball
These config files are intended to be substituted during the build
process. The substituted .ini files should not be included in release
tarballs.

Fixes:  #3187
(cherry picked from commit 19bacc6e49)
2024-08-01 20:40:25 +09:00
matt335672
c9e84dc16c Fix potential name buffer overflows in redirector
The state buffers used by the following structs in chansrv_fuse.c
are one byte too small for filenames of length XFS_MAXFILENAMELEN:-
- struct state_lookup
- struct state_create
- struct state_rename

In practice, there is no runtime danger, as XFS_MAXFILENAMELEN is 255,
and these buffers will be followed by non-byte aligned data. Nevertheless
this should be fixed to prevent problems if the value is changed.
2024-07-22 14:44:58 +01:00
matt335672
a4f57572e6 sesman: Copy IP address to pre_session_item struct
struct pre_session_item has an entry for the start_ip_addr which is not
being filled in. This is not normally needed, as the IP address of the
session is passed into the session another way, but it is needed if the
session selection Policy contains the 'I' selector.
2024-07-19 11:57:55 +01:00
matt335672
17a56567d2 Add params to allow xrdp to be run as non-root
runtime_user and runtime_group are added to the xrdp.ini file
so that the service knows how to reduce privilege
2024-07-01 11:11:21 +01:00
Koichiro Iwao
a6199e8510
clipboard: tidy up bmp file header assembly
Sponsored by:   Krämer Pferdesport GmbH & Co KG

(cherry picked from commit e070902310)
2024-06-18 21:56:30 +09:00
Koichiro Iwao
57cf5c19b7
clipboard: fix a bug when pasting image to LibreOffice
While here, embed correct file size in BMP file header.

Fixes:          #3102
Sponsored by:   Krämer Pferdesport GmbH & Co KG

(cherry picked from commit 4968a34cd6)
2024-06-18 21:56:19 +09:00
matt335672
c98289732e
Merge pull request #3103 from matt335672/fix_display_list
Fix session list processing
2024-06-03 09:42:28 +01:00
matt335672
70f1b685ba Fix session list processing
The get_sorted_session_displays() is broken in that it
doesn't produce a sorted list of displays.

The problem is the qsort comparison function which has 2 errors in 4 lines:-
1) The test is the wrong way round (i.e. arg1 < arg2 produces a +ve
   result instead of -ve)
2) Subtracting two unsigned ints in C will never return < 0

The broken function has been masked by other display checks which mean
that it is only visible in a few situations:-
1) Starting two sessions very closely to each other may allocate the
   same display to both sessions.
2) If /tmp is namespaced, the other display checks do not work, and
   more than two sessions cannot be started.
2024-06-01 10:31:58 +01:00
matt335672
5f91eec695 Remove duplicate enable&disable func registration 2024-05-30 12:19:20 +01:00
matt335672
f0069456f9 Remove the wait for the ibus daemon to start
The initial implementation of Uinicode input via IBus used a startup delay
of 3 seconds to wait for the daemon to be ready before connecting to it.

This commit introduces a poll-wait loop which can remove the delay
entirely if the daemon is up when chansrv starts the interface.
2024-05-23 16:35:53 +01:00
matt335672
e0a1339b34 chansrv FUSE fixes
1) [Regression] If the specified mountpoint is not immediately below an
   existing directory, the directory is not created.
2) The message to ask the user to unmount an existing mounted directory
   has been moved to the right place.
2024-05-21 12:33:17 +01:00
sefler
4599ac7bf6 apply patch generated by matt 2024-05-05 10:44:19 +08:00
seflerZ
c42a09709e fix a bug in returning the init result. 2024-05-05 10:44:19 +08:00
matt335672
1e78b42022 Fix CI errors using C++ compiler 2024-05-05 10:44:19 +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
seflerZ
b623766503 remote uncessary conditional compilation 2024-05-05 10:44:19 +08:00
seflerZ
8c98ed4a58 add conditional compilation annotations 2024-05-05 10:44:19 +08:00
seflerZ
bcd690f037 code refactored 2024-05-05 10:44:19 +08:00
seflerZ
3b1cc551e4 format code 2024-05-05 10:44:19 +08:00
seflerZ
d4e2e0a093 It works now 2024-05-05 10:44:19 +08:00
seflerZ
bea72150fb change parameter types 2024-05-05 10:44:19 +08:00
seflerZ
a8c075e84e refine makefile 2024-05-05 10:44:19 +08:00
seflerZ
97138d5bad add missing code 2024-05-05 10:44:19 +08:00
sefler
7bea1f9d56 compile suscceed 2024-05-05 10:44:19 +08:00
matt335672
20b90c1098 Initial support for ibus input from chansrv 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
200e4d84f4 Fix permissions on user socket directory
The user socket directory needs to be SGID so that they inherit
the group ownnership. Then xrdp can write to them.
2024-03-22 10:44:19 +00:00
matt335672
b2c0c506e8
Merge pull request #2745 from matt335672/wtmp
Add utmp/wtmp support
2024-02-21 14:22:16 +00:00
Koichiro Iwao
ae249c6755 Bump copyright year and make easier to bump 2024-02-21 19:09:34 +09:00
matt335672
8cea9b03ab Replace g_strncpy() with str2memcpy()
g_strncpy() is the wrong function for copying strings in struct utmp[x]
as it always terminates strings.

strncpy() itself would be a good choice, but is marked by many compilers
as being unsafe to use.

str2memcpy() is taken from util-linux, and is exactly right for this
application.
2024-02-21 09:24:48 +00:00
matt335672
b53c683edf Allow some utmpx fields to be optional
POSIX.1 doesn't define ut_host in struct utmpx. Also, Linux has support
for an exit status value in ut_exit. This commit adds conditional code
for both ut_host and ut_exit to maximise portability.
2024-02-21 09:24:48 +00:00
matt335672
04c67a5039 Set ut_id field
The utmp record is generally looked up by the ut_id field. Setting
this field means we can use a blank username and host when the
session exits
2024-02-21 09:24:48 +00:00