Commit Graph

4665 Commits

Author SHA1 Message Date
matt335672
547c619c2f Move g_mk_socket_path() to sesman
The sockdir is only used when sesman is active. The
call g_mk_socket_path() is removed from os_calls and moved to
sesman.

We also change the permissions on this directory to
0755 rather than 01777 (01000 is the 'sticky bit', S_ISVTX).

The behaviour of g_create_dir() has been modified to not
set S_ISVTX on Linux directories. This is implementation-defined
behaviour according to 1003.1, and is no longer required for the
sockdir.
2023-10-23 15:51:17 +01:00
matt335672
ee328784dc
Merge pull request #2833 from matt335672/remove_unnecessary_assignments
Remove unnecessary assignments
2023-10-23 15:42:32 +01:00
matt335672
8f73f5ba73 Remove unnecessary assignments
As per title. Assigments are made to variables which are immediately
overwritten.
2023-10-23 15:23:07 +01:00
matt335672
f5f67e2e80 Remove g_mbstowcs() and g_wcstombs()
These calls are now replaced with explicit UTF conversion routines in
the common/string_calls.[hc] and common/parse.[hc] modules.

Also removed:-
- The support code in common/os_calls.c to set the locale to use
  these routines.
- The twchar type in arch.h
2023-10-23 14:19:49 +01:00
matt335672
d722ffe357 Update smartcard code to use new UTF-8 calls 2023-10-23 14:19:49 +01:00
matt335672
1b286a0469 Update RAIL code to use new UTF-8 calls 2023-10-23 14:19:49 +01:00
matt335672
8556f83905 Update drive redirection code to use new UTF-8 calls 2023-10-23 14:19:49 +01:00
matt335672
f8e7fd4c2c Update clipboard code to use new UTF-8 calls 2023-10-23 14:15:47 +01:00
matt335672
a50afc6500 Update xrdp font handling to use new UTF-8 calls 2023-10-23 14:15:47 +01:00
matt335672
3a5b8936d1 libxrdp: Replace mbstowcs/wcstombs calls
These calls are replaced with the newer UTF-16 parsing code
withing the parse module
2023-10-23 14:15:47 +01:00
matt335672
36ea4a3f86 Remove mbstowcs/wcstombs from g_strtrim()
Because of the way UTF-8 encoding works, there is no need to
use mbstowcs/wcstombs in the implementation of this function.
2023-10-23 14:15:46 +01:00
matt335672
0758fe03a6 Add UTF-16 LE I/O routines
These are intended to replace UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672
0463e552dc Add UTF-8 / UTF-32 conversion routines
These are intended to replace non-UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672
da8fa059cd
Merge pull request #2785 from firewave/cppcheck-inc
updated Cppcheck to 2.12.1 / provide more includes to Cppcheck
2023-10-18 09:09:40 +01:00
firewave
8c214280d3 bumped Cppcheck to 2.12.1
- build Cppcheck with matchcompiler for improved performance
- build Cppcheck with Boost for improved ValueFlow performance
2023-10-17 15:14:36 +02:00
firewave
f687174af1 provide more includes to Cppcheck
- added (temporary) suppression of Cppcheck `shiftTooManyBits` false positives in `libxrdp/xrdp_mppc_enc.c`
- added (temporary) suppression of Cppcheck `uninitMemberVar` true positives in `ulalaca/ulalaca.cpp` until fixes land downstream
- fix Cppcheck `nullPointerRedundantCheck` in `sesman/chansrv/clipboard.c`
- fix Cppcheck `syntaxError` in `fontutils/mkfv1.c` because it doesn't see the `freetype/fterrors.h` header / removed astyle workaround
2023-10-17 15:14:36 +02:00
matt335672
b1fca0100e
Merge pull request #2827 from matt335672/devredir_use_spec
devredir_proc_query_dir_response(): Conform to spec
2023-10-16 13:32:14 +01:00
matt335672
2a287963da devredir_proc_query_dir_response(): Conform to spec
This commit adds more error checking to the above function. The function
now conforms to [MS-FSCC] regarding processing of the NextEntryOffset
field.
2023-10-16 10:28:41 +01:00
matt335672
eb1c3cd4b3
Merge pull request #2810 from matt335672/remove_ss_clipboard_code
Remove client-server shortcut paste code
2023-10-11 10:38:16 +01:00
matt335672
e0ffa11495
Merge pull request #2821 from matt335672/add_waitpid_interrupted_check
Check waitpid is not interrupted by a signal
2023-10-09 21:11:47 +01:00
matt335672
ad5916c5e4 Check waitpid is not interrupted by a signal
Checks that the waitpid() call isn't interrupted by a
signal when the handler for the signal is set to not
interrupt the call
2023-10-09 19:53:16 +01:00
matt335672
93dfc1839e
Merge pull request #2813 from matt335672/remove_signal_call
Remove dependency on signal() function
2023-10-09 14:45:50 +01:00
matt335672
d098214531 Add tests for signal functions in os_calls.c 2023-10-09 14:10:38 +01:00
matt335672
d11617adbe Remove dependency on signal() function
Replaces uses of signal() with sigaction() which should be far
more portable.
2023-10-09 14:05:29 +01:00
matt335672
bce303c3a8
Merge pull request #2815 from matt335672/groups_patch
Improve tsusers/tsadmins group support
2023-10-06 10:48:04 +01:00
matt335672
cf5c2718af Update logging in sesman access control
Improve the built-in access checks for sesman/sesexec:-
- Group existence is checked for at login-time rather than program
  start time
- The name of the group is now included in the message

Also, check for UID == 0 when checking for root, rather than just
checking the name (which might be an alias)
2023-10-05 13:22:49 +01:00
matt335672
5837deae04 access_login_allowed: Remove primary group check
This check is now performed within g_check_user_in_group()
2023-10-05 12:25:40 +01:00
matt335672
cf677da22c Add getgrouplist() support to os_calls
On enterprise systems, using getgrouplist() (if available)
is more efficient than iterating over the members of the group,
and is also more likely to work
2023-10-04 11:02:07 +01:00
matt335672
84a0befd30 Add getgrouplist() detection functionality
Defines the macro HAVE_GETGROUPLIST if getgrouplist() is
available, and defines the type passed to the GID array as
GETGROUPS_T
2023-10-03 10:36:56 +01:00
matt335672
284c17c0b2 Remove client-server shortcut paste code
When significant amounts of data is coming from the client in a
fragmented CLIPRDR_DATA_RESPONSE PDU, this code provides a way to
start copying it to a requesting client before it is all read.

The only advantage of this code is to provide a slight speedup
before a paste is visible on the server.

There are significant problems with this code. Notably, it is
very difficult to parse Unicode text coming through this route. Each
UTF-16 character can occupy up to 4 bytes, and a fragmentation
boundary could occur at any point within a UTF-16 character.
2023-09-29 12:07:19 +01:00
metalefty
89ceaf0c52
Merge pull request #2798 from ziggythehamster/freebsd-vsock
Implement vsock support for FreeBSD
2023-09-28 04:16:48 +09:00
metalefty
73acbe1f79
Merge pull request from GHSA-2hjx-rm4f-r9hw
CVE-2023-42822
2023-09-27 17:37:24 +09:00
matt335672
bc3ea01b3e CVE-2023-42822
- font_items in struct xrdp_font renamed to chars to catch all
  accesses to it. This name is consistent with the type of
  the array elements (struct xrdp_font_char).
- Additional fields added to struct xrdp_font to allow for range
  checking and for a default character to be provided
- Additional checks and logic added to xrdp_font_create()
- New macro XRDP_FONT_GET_CHAR() added to perform checked access
  to chars field in struct xrdp_font
2023-09-26 09:29:56 +01:00
matt335672
98ad496072
Merge pull request #2805 from jsorg71/valgrind_font
fix valgrind warning on font
2023-09-26 09:01:57 +01:00
matt335672
fea7d80723
Merge pull request #2804 from matt335672/update_comments
Update comments in smartcard code
2023-09-26 08:54:17 +01:00
Jay Sorg
433c05eb36 fix valgrind warning on font 2023-09-25 20:57:07 -07:00
matt335672
e138c1a601 Update comments in smartcard code
Most of the Microsoft RDP documentation describes PDUs on-the-wire.
However, [MS-RDPESC] doesn't do this. It uses DCE IDL to describe the
contents of the PDUs sent over the File System Virtual Channel.

Ideally we'd use an IDL compiler to generate the interfaces in
[MS-RDPESC]. We don't have one though, so all PDUs are read and written
with the low-level streaming routines. It's not clear in the existing
code how IDL is mapped down to this level.

This commit updates the smartcard code with comments which will enable
maintainers to better understand the IDL-to-streaming mappings.
2023-09-25 16:13:00 +01:00
Keith Gable
6decef6046 Change vsock to actually check for AF_HYPERV 2023-09-24 12:52:11 -07:00
Keith Gable
9305008ba8 Tolerate XRDP_ENABLE_VSOCK being defined but the platform is neither FreeBSD nor Linux 2023-09-24 12:32:10 -07:00
Keith Gable
5ffca14b2f Change indent style to allman 2023-09-24 12:27:00 -07:00
Keith Gable
572ee7686d On FreeBSD, use AF_HYPERV in place of vsock 2023-09-23 21:28:24 -07:00
Keith Gable
36a1a33b84 Define XRDP_ENABLE_VSOCK when requested in FreeBSD 2023-09-23 21:24:57 -07:00
Jay Sorg
bfdcdb0082 posix shm, can not unmap shmem_ptr until encoder is done with it 2023-09-09 14:18:52 -07:00
matt335672
def567c2e0
Merge pull request #2792 from metalefty/login_mode_log
Record login state as string
2023-09-08 10:22:35 +01:00
Koichiro Iwao
16d45a8f4f Record login state as string
Closes: #2790
2023-09-08 16:58:35 +09:00
matt335672
98f45baff3
Merge pull request #2787 from firewave/unusedVariable
fixed Cppcheck `unusedVariable` warnings
2023-09-05 16:43:19 +01:00
firewave
27d34e784d fixed Cppcheck unusedVariable warnings 2023-09-04 23:47:56 +02:00
matt335672
deb8a317ba
Merge pull request #2780 from matt335672/update_pam_configs
Add GNOME/KDE keyring support for Debian/Arch
2023-09-04 10:16:42 +01:00
matt335672
d8446c263f
Merge pull request #2783 from metalefty/waitforx-build
waitforx: fix build
2023-09-04 10:14:07 +01:00
matt335672
aae4f33602
Merge pull request #2782 from firewave/z3
Cppcheck 2.8 removed the dependency on z3
2023-09-04 10:00:44 +01:00