Commit Graph

1195 Commits

Author SHA1 Message Date
Koichiro Iwao 75736f4853 Allow to change config file (sub)directory
This allows the `xrdp` part of the path `/etc/xrdp` where config files
are placed to be customizable. This change is useful when trying the
stable version and the devel version alternately.
2024-12-27 10:53:31 +09:00
matt335672 162153ab6f Move LogFilePath parameter to [ChansrvLogging]
This seems a better fit than having it in the [Chansrv] section.

Also fixed a minor logging error relating to the parameter in
chansrv_config.c

(cherry picked from commit 6d2fd1be8451418f01dfbb203929e2838c1a979f)
2024-12-16 10:55:30 +00:00
matt335672 2f7be3f634 Allow a path to be specified for the chansrv log
This is useful for NFS-mounted home directories, where hosts
may otherwise produce colliding chansrv log file names

(cherry picked from commit cfc2e362b47103bc2c786252f331bb26b6ddecb5)
2024-12-16 10:55:21 +00:00
matt335672 31a09f5100 Merge pull request #3304 from matt335672/add_statfs_to_fuse
Add support for statvfs() to FUSE
2024-12-13 11:41:09 +00:00
matt335672 2a190a2264 Fix regression in opening local display in waitforx
Commit 80fab03198 introduced a way to
prevent waitforx going to the network when trying to open a display,
and hence potentially blocking.

This method turned out to be invalidated by libxcb version 1.16 and
1.17

This change adds an explicit check that the Unix socket for the display
in /tmp/.X11-unix/Xn is open before trying to connect to display ':n'.
This has the same effect.
2024-12-11 11:52:06 +00:00
matt335672 6a49ff9946 Add fix for chromium saving files to FUSE filesys
Chromium 130 won't save to our filesystem if we don't return a
max filename length.

Dummy parameters were tried for inode counts, but these do not seem to
be necessary. Not also that btrfs foes not return values for these
fields.
2024-11-11 12:15:23 +00:00
matt335672 5dc4fdbc2c Add support for statvfs() to FUSE
Some desktop environments are now checking for free space before
copying files to a destination.

To support this, the FUSE filesystem needs to convert the statvfs()
system call to the relevent PDUs from [MS-RDPEFS]
2024-11-08 15:57:40 +00:00
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 19bacc6e4967231557c69b536ac083a5bd4471c7)
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 e070902310a46c0fd9b47e3e6c24f0d3bfcb05b7)
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 4968a34cd62fe740abc612c581e6faa705f12bd1)
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