Commit Graph

234 Commits

Author SHA1 Message Date
matt335672 d712f3527a os_calls: Add g_get_open_fds() 2023-04-24 11:57:38 +01:00
matt335672 b811fdb36b os_calls: Add g_file_{get,set}_cloexec() functions
Allows us to avoid file descriptor leaks when running a new executable
2023-04-24 11:11:04 +01:00
matt335672 3ee8eb9c9e
Merge pull request #2592 from matt335672/restructure_session_start
Restructure session start
2023-03-27 10:38:37 +01:00
Jay Sorg 2d8b52f744 common: change g_malloc, g_free, g_memset, g_memcpy, and g_memmove to macros 2023-03-25 12:22:19 -07:00
matt335672 8b9f9b40c8 os_calls changes
- Add g_pipe()
- Add g_file_duplicate_on()
- Rework struct exit_status to make it easier to parse
- Add optional status return to g_waitchild()
2023-03-23 18:12:06 +00:00
matt335672 3bd1820407 Fix regression caused by move to poll() 2023-03-13 20:02:05 +00:00
matt335672 621b3fc6dc Add g_execvp_list() to os_calls 2023-03-06 16:03:55 +00:00
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
Nexarian db5ea2f214 Initial EGFX tests.
- Rearranging imports.
- Remove unnecessary check to g_is_wait_obj_set.
- Use g_get_term everywhere.
- Misc updates.
2023-01-23 23:05:24 -05:00
matt335672 48e46d183a Add g_setallusercontext() for *BSD systems 2023-01-05 10:52:08 +00:00
matt335672 47ace4acfd Fix g_sck_get_peer_cred() on FreeBSD
Socket level should be SOL_LOCAL rather than SOL_SOCKET - See
'man unix'.
2022-12-22 11:35:02 +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
a1346054 7fe18cc1c0
fix typos 2022-09-03 02:01:48 +00: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
zbstao 1309ea405e Fixed g_waitpid function
Fixed g_waitpid function
2022-02-15 22:32:46 +08: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 f5e4b53b11 Add logging to g_exec*() functions 2021-04-14 04:41:53 +00:00
Alexandre Quesnel 2ab3b97ba0 Migrating logging to LOG() and LOG_DEVEL() in common/* 2021-03-14 23:33:31 +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
matt335672 27653f97f2 Code changes for cppcheck 2.1 warnings 2020-06-19 11:07:23 +01:00
Koichiro IWAO e8c845e78b
common: switch _exit to exit
mentioned in #1472.
2020-01-08 09:21:39 +09:00
Koichiro IWAO e928d8baf2
common: flush stream in g_deinit()
unless flushing stream before exitting, `xrdp --version | cat` will
show empty output.

Fixes #1471.
2020-01-07 19:24:17 +09: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
Justin Terry (VM) d7d14d7462 Implements the accept/close logic for vsock 2017-11-17 20:23:20 -08:00
Jay Sorg 285465a1f5 common, return -1 for bad socket 2017-11-07 18:20:45 -08:00
Jay Sorg c6c513b23c use g_memcpy, braces 2017-11-07 18:20:45 -08: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
Koichiro IWAO 00bf62bd42 common: prevent raw use of snprintf 2017-10-03 21:55:08 +09:00
Koichiro IWAO f9ab4df7f2 common: fix g_write_ip_address() didn't return correct IP address
Fixes: #878.
2017-09-26 10:54:08 +09:00
Ian Geiser 324a334315 append a / to ensure the full path is created even when the config variable lacks a trailing / 2017-07-19 10:35:37 +09:00
Koichiro IWAO aa0721a90e common: fix more glitches in IPv4 initialization 2017-07-14 21:21:15 +09: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