Commit Graph

125 Commits

Author SHA1 Message Date
matt335672
78fa1c15b2 Replace select() system call with poll()
poll() is specified in POSIX.1-2001 as a simpler interface for
multiplexed file descriptors than select(). It also provides more
functionality.

This PR replaces the select() calls used in xrdp with poll()
equivalents.
2023-02-13 14:28:29 +00:00
Derek Schrock
1e5b42893c Add g_set_alarm to set an alarm calling func after secs seconds 2023-02-11 18:01:12 -05:00
matt335672
a5034e3572 Implement g_sck_send_fd_set() and g_sck_recv_fd_set() 2023-01-30 14:31:16 +00:00
matt335672
1fbcdffff1 Use unsigned int for some data lengths 2023-01-30 14:31:16 +00:00
matt335672
48e46d183a Add g_setallusercontext() for *BSD systems 2023-01-05 10:52:08 +00:00
matt335672
a16e56f711 Add function to get user information by UID
Moving to a uid_t to store the user information makes a lot
of sense. When doing this, we need a function to get information
about a user from the uid_t

As well as creating the function g_getuser_info_by_uid() we also
rename g_getuser_info() to g_getuser_info_by_name() and make the
parameter ordering more usual.
2022-12-22 11:35:02 +00:00
matt335672
df83fbf9bf Fix const-correctness for g_system() 2022-12-12 19:52:27 +00:00
matt335672
3a0a932472 Add --reload option to sesman
Adds a --reload switch to sesman and plumbs this in
to systemctl reload xrdp-sesman.service
2022-11-09 09:46:36 +00:00
matt335672
9875f0c0d8 Add g_memmove() to os_calls 2022-09-06 09:31:47 +01:00
matt335672
79bec8110c Unify connection fields for the connected client
The connected client is currently described in two places in
the xrdp_client_info structure:-

1) In the connection_description field. This was introduced as
   field client_ip by commit d797b2cf49
   for xrdp v0.6.0

2) In the client_addr and client_port fields introduced by commit
   25369460a1 for xrdp v0.8.0

This commit unifies these two sets of fields into a single
set of fields describing the connection IP and port (for
AF_INET/AF_INET6 connections only) and a connection description
for all connection types.

The code in os_calls to provide client logging has been simplified
somewhat which should make it easier to add new connection types (e.g.
AF_VSOCK).

The old connection_description field used to be passed to sesman to
inform sesman of the IP address of the client, and also to provide
a string for 'C' field session policy matching. 'C' field session policy
matching does not actually need this string (see #2239), and so now only
the IP field is passed to sesman.
2022-05-18 12:35:07 +01:00
matt335672
34fe9b60eb
Merge pull request #1983 from matt335672/pam_group_fix
Moved g_initgroups() call to before auth_start_session()
2022-05-04 09:29:15 +01:00
matt335672
0a54106866 Added g_umask_hex() call 2022-04-15 11:12:01 +01:00
matt335672
4183d8ddbf Moved initgroups call to before auth_start_session()
This is required for PAM systems that depend on group membership being
available during PAM processing. This is used by pam_group on FreeBSD
and pam_group on Linux-PAM, although the functionality of both is
different.
2022-04-05 16:07:26 +01:00
matt335672
6cf053c9df Add libipm test suite 2022-03-15 10:23:27 +00:00
matt335672
ce23c824ea
Merge pull request #1976 from matt335672/fail2ban_support
Fail2ban support (#1076)
2021-11-18 10:11:12 +00:00
matt335672
50e37bf673 Add more file info functions
- g_file_get_device_number()
- g_file_get_inode_num()
2021-10-25 15:24:27 +01:00
matt335672
5fb621ca53 Logged IP address for fail2ban on login failure 2021-10-25 11:35:35 +01:00
matt335672
60016c1f75 Rename client_ip to connection_description 2021-10-25 11:35:35 +01:00
Alexandre Quesnel
52707ac686 Fixing formatting with astyle 2021-05-08 16:58:11 +00:00
Alexandre Quesnel
f5e4b53b11 Add logging to g_exec*() functions 2021-04-14 04:41:53 +00:00
Alexandre Quesnel
bb9d3079c0 Fixing formatting with astyle in common/* 2021-03-14 23:33:31 +00:00
matt335672
0a1a8f40e5 Moved a lot of string funcs to string_calls module 2020-12-22 11:57:24 +00:00
matt335672
5523847540 Allow FuseMountName for chansrv to be absolute path 2020-12-21 12:36:31 +00:00
Bolke de Bruin
a6a0e5e004 Allow domain name to be concatenated to username
If a server is multihomed (i.e. mutiple domains) the
users are identified by their domain name. This change
allows to concat the domain name to the username with
a specific separator.
2020-08-30 21:56:16 +02:00
Jay Sorg
ee65ccb31d use address for tcp:// and tcp6:// and vsock:// 2019-07-01 17:56:50 -07:00
Jay Sorg
0bc7803eaa add TCP V4 and V6 only socket functions 2019-06-29 23:59:18 -07:00
Jay Sorg
26507644e3 vsock, move some defines 2017-11-07 18:20:45 -08:00
Justin Terry (VM)
50bd624cc4 Implements XRDP over vsock
1. Implements the ability to use AV_VSOCK for the transport rather than TCP.
2. Updates the ini file to be able to conditionally turn this feature on.
2017-11-07 18:20:45 -08:00
Ian Geiser
4b87548b71 Use g_create_path instead of g_create_dir
Rename g_mk_temp_dir to g_mk_socket_path
2017-07-14 20:52:38 +09:00
Koichiro IWAO
65c1fe87d7 Log user-friendly message when certificate/privkey is inaccessible
We shouldn't assume that xrdp daemon is running under root privilege.
In many cases, root privilege is not really needed for xrdp daemon.
xrdp may fail to load certificate/privkey due to lack of permissions
when running under user privilege. Checking existence of files is not
enough and xrdp should output user-friendly log in such case.

Reported by Debian user in bug 856436 [1].

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=856436
2017-06-12 16:57:04 +09:00
Pavel Roskin
6ed4c969f4 Eliminate APP_CC and DEFAULT_CC 2017-03-14 00:21:48 -07:00
Jay Sorg
3b84314a1a arch.h changes to include stdint.h 2017-01-29 23:14:33 -08:00
Jay Sorg
9a517b34f0 vnc: code cleanup 2016-12-04 15:39:10 -08:00
Pavel Roskin
6fef1e4eb5 Use const pointers in function arguments when possible 2016-10-17 08:54:07 -07:00
jsorg71
8353baab3d Merge pull request #390 from proski/june21
Cleanups and C++ compatibility
2016-08-05 14:38:41 -07:00
speidy
c9b55e3691 sesman: env_set_user, fix potential bof issues 2016-07-22 04:48:37 -04:00
Pavel Roskin
a24df49241 Introduce glib style macros for allocating memory with type 2016-07-08 04:29:49 +00:00
Pavel Roskin
aeeb3d2c2e Fix warnings detected by -Wwrite-strings 2016-07-08 04:29:42 +00:00
Pavel Roskin
b1527b7947 Check string format in log_message
Move "printflike" definition to arch.h, it's used both by log.h and
os_calls.h.
2016-06-21 16:30:16 -07:00
Pavel Roskin
55e12a09d8 Include config_ac.h from common/os_calls.h to enable all format warnings 2016-04-21 21:20:12 -07:00
jsorg71
034ee36f9c Merge pull request #341 from proski/sanity-checks
Sanity checks
2016-03-16 20:51:58 -07:00
Jay Sorg
689ffe79d9 fix warnings, move some calls to os_calls 2016-03-16 14:32:14 -07:00
Jay Sorg
7393579205 Don't attempt to intercept SIGKILL, it doesn't work on any OS 2016-03-14 16:33:49 -07:00
Pavel Roskin
9091c3eef2 Annotate printf-like functions if supported by the compiler
Both GCC and Clang support it. Add a macro from Autoconf archive to check
for format attribute support.
2016-03-03 22:56:09 -08:00
Jay Sorg
ab3b8edf4a common: change wait objs to use 'pipe' and remove per process temp directories in /tmp/.xrdp/ 2015-10-06 20:55:47 -07:00
Jay Sorg
5c08ece708 common: add g_mirror_memcpy 2015-08-18 17:14:09 -07:00
Jay Sorg
6b0bbbeefa common: merge from a8 2014-11-07 22:10:59 -08:00
Jay Sorg
1934c9ea00 sesman: more options for session lookup from Fredy Paquet 2014-04-20 00:42:19 -07:00
Jay Sorg
374633e63f common: no logic change, update comments 2014-03-01 23:26:40 -08:00
Jay Sorg
43e388b7e5 remove some warning, move gethostname to os_calls 2014-02-08 21:48:44 -08:00