Commit Graph

31 Commits

Author SHA1 Message Date
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 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
matt335672 98d6545566 Don't use DEAD_PROCESS/USER_PROCESS for add_xtmp_entry
If we're not compiling with USE_UTMP, these defines will not
be available
2024-02-21 09:24:48 +00:00
matt335672 3b6c9bcba3 Add --enable-utmp to configure.ac 2024-02-21 09:24:48 +00:00
matt335672 bf53a76ea1 Remove wtmp updating code 2024-02-21 09:24:48 +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
BLINDAUER Emmanuel da0f3cefd7 Move some definitions, and small fixes 2024-02-20 17:37:11 +00:00
BLINDAUER Emmanuel 22f17ad123 More g_* functions usage
Follow coding standard
2024-02-20 17:37:11 +00:00
BLINDAUER Emmanuel 58b3989655 don't forget a free
use g_*
2024-02-20 17:37:11 +00:00
Blindauer Emmanuel 547388ddce Add support for FreeBSD 2024-02-20 17:37:11 +00:00
Koichiro IWAO eaffeaf53f cosmetic changes 2024-02-20 17:37:10 +00:00
Koichiro IWAO e32671cd79 Include sys/time.h to use gettimeofday() 2024-02-20 17:37:10 +00:00
BLINDAUER Emmanuel bacda80492 WIP utmp/wtmp
- renamed the two files, including the header was conflicting with official headers
- configure look for utmp/utmpx headers, wo we know which struct to use
- reworked the usage for linux, works mostly (last still showing 'gone' for loggued users)
2024-02-20 17:37:10 +00:00
Koichiro IWAO 56eec32b7e os_calls.h needs to be included to use g_snprintf() 2024-02-20 17:37:10 +00:00
Koichiro IWAO 3ea306249b don't forget include utmp.h 2024-02-20 17:37:10 +00:00
Koichiro IWAO c103d2308b sesman: add utmp files to makefile 2024-02-20 17:37:10 +00:00
Koichiro IWAO 42388ca009 remove trailing space 2024-02-20 17:37:10 +00:00
BLINDAUER Emmanuel 895fe28961 Initial support for utmp/wtmp on linux 2024-02-20 17:37:10 +00: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
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 25a1fab5b6 Check auth_start_session() result 2023-08-19 13:35:26 +01: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
matt335672 7cf9101407 Fix compile errors detected by the older gcc 4.8.5 compiler:-
sesexec.c: In function ‘main’:
sesexec.c:521:1: error: control reaches end of non-void function [-Werror=return-type]

sound.c: In function ‘process_pcm_message’:
sound.c:1123:21: error: ‘for’ loop initial declarations are only allowed in C99 mode
                     for (int i = 0; i < send_silence_times; i++)
                     ^
sound.c:1123:21: note: use option -std=c99 or -std=gnu99 to compile your code

These fixes are in line with our coding standard and have no functional change.
2023-06-07 20:21:54 +01:00
Daniel Richard G fdfe47668b Add XorgNoNewPrivileges configuration option
This allows Linux's no_new_privs restriction to be disabled when starting
the X server, which may be desirable if xrdp is running inside a kernel
confinement framework such as AppArmor or SELinux.
2023-05-15 17:40:46 -04:00
Daniel Richard G b191d87e33 Move Linux's no_new_privs call into os_calls
This helps keep the application code free of platform-specific cruft.
Also remove a needless #include<sys/prctl.h> from sesman/session_list.c.
2023-05-15 17:40:46 -04:00
matt335672 8853b1c4ee New files for sesexec 2023-05-02 11:55:23 +01:00
matt335672 c5971b535d sesexec: Changes to existing files from sesman
env.c : The value of XRDP_SESSION in the environment is now set to the
        PID of the sesexec process, which ties up the session with the
        output of "xrdp-sesadmin -c=list".

        Later versions of xrdp-sesadmin can use this value to get
        information about the current process.
2023-05-02 11:55:23 +01:00
matt335672 9c2c43693c Move files from sesman to sesexec directory 2023-05-02 11:55:22 +01:00