Commit Graph

4668 Commits

Author SHA1 Message Date
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
Koichiro Iwao 7e305f9e24 GFX: Relegate some logs to LOG_LEVEL_DEBUG 2024-02-21 14:28:37 +09:00
matt335672 49f60fc64f Remove AC_GNU_SOURCE
AC_GNU_SOURCE is replaced with AC_USE_SYSTEM_EXTENSIONS (available
from autoconf 2.6.0)
2024-02-20 17:37:11 +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
BLINDAUER Emmanuel 2af2e032c3 Add the loginuid pam module, as we are starting a session.
So /proc/<uid>/loginuid will be filled by the uid of the user.
This will fix entries in 'last' with "gone - no logout" instead of
'still logged in'
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 d3a751cff8 Add GNU_SOURCE to configure.ac: it allow usage f more GNU functions,
like updwtmpx
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
metalefty 2849dce105
Merge pull request #2942 from matt335672/fix_monitor_hotplug
Fixes some problems with monitor hotplug
2024-02-20 23:37:23 +09:00
matt335672 09715f4cf4 GFX: Prevent MM screen being written to the client
In GFX mode, if we're using xorgxrdp, frame updates are send directly
from the client, bypassing the screen buffer in xrdp_mm.

This commit only allows the xrdp_mm screen buffer to be invalidated
if the painter has drawn into it since the module was loaded. This
prevents the unused (and invalid) frame buffer being pushed to the client
in GFX mode with xorgxrdp.
2024-02-19 16:26:04 +00:00
matt335672 c21521f80d Clear memory allocated to resized bitmaps
This prevents valgrind errors when resizing the screen to
a larger size on GFX systems.
2024-02-17 17:41:51 +00:00
matt335672 3ca3bd197f Prevent EGFX drawing while channel is down
Clear egfx_up as soon as the channel starts to close so that
xrdp_mm_draw_dirty() doesn't send data to a closed channel.
2024-02-15 16:48:13 +00:00
matt335672 f3fe06a0c7 EGFX: Ignore incoming messages after close sent 2024-02-15 16:48:13 +00:00
matt335672 bc70a86de6 Rework xrdp to support new module resize interface
This commit compiles.
2024-02-15 16:48:13 +00:00
matt335672 dd37720188 Change to the XUP module for the new resizing interface
Input message 300 to xorgxrdp which communicated a screen size
has been replaced with message 302 which sends a list of monitors
to xorgxrdp. This simplifies the initialisation and resize logic
somewhat, but a compatible version of xorgxrdp must be used
2024-02-15 16:48:13 +00:00
matt335672 e27c634970 Update VNC module resize functionality
Significant updates for the VNC module:-
1) Support for the new API calls allowing both server and client
   multi-monitor resizes.
2) The s member variable of the vnc_screen_layout structure is no longer
   dynamically allocated.
3) The module server_width and server_height member variables are
   removed as these are just duplicating server_layout.total_width and
   server_layout.total_height.
4) When the server screens are resized, there is no need to restart the
   entire resize state machine as we already know at this point that
   the server supports resizing.
2024-02-15 16:48:13 +00:00
matt335672 bedaf990ac Update neutrinordp module
Neutrinordp module now compiles with updated monitor resize
interface
2024-02-15 16:48:13 +00:00
matt335672 ae836fb543 Update module interfaces with new calls for resizing
This commit DOES NOT compile.

This change alters these module interface calls:-
1) mod_server_monitor_resize() (Call from xrdp to module). Updated.
2) server_reset() (Call from module to xrdp). Replaced.

The mod_server_monitor_resize() call is updated :-
1) to allow a monitor list to be passed in for a multimon resize
2) with an 'in_progress' return value which tells the caller whether or
   not to expect a callback.

The server_reset() call served two purposes up until now:-
1) To allow a module to resize a single monitor session. There
   is no way to request a multi-monitor resize from the module
2) (with bpp == 0) To signal to the mm resize state machine that
   a server screen resize hsa finished.

This is split into two calls:-
1) client_monitor_resize() to allow a mdule to request a
   multimon resize.
2) server_monitor_resize_done(). This is called by a module
   when a resize is completed.
2024-02-15 16:48:13 +00:00
matt335672 27ad405cd8 Add a client_resize_mode field
This stores what kind of resizing (if any) can be achieved with
a Deactivation-Reactivation sequence.
2024-02-15 16:48:13 +00:00
matt335672 74598d1cc3 Fix sending of monitor layout PDU
From [MS-RCPBCGR] 3.3.5.12.1:-

> ...The contents of this PDU SHOULD NOT be compressed.
>
> This PDU MUST NOT be sent to a client that has not indicated support for
> it by setting the RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU flag (0x0040)
> in the earlyCapabilityFlags field of the Client Core Data (section
> 2.2.1.3.2).

Also, 2.2.12.1 specifies the source channel must be zero.

In testing, a compressed monitor layout PDU causes mstsc.exe
to exit with a protocol error.
2024-02-15 16:47:15 +00:00
matt335672 689269dcde Fixes some problems with monitor hotplug
This fixes some monitor hotplug issues with non-GFX codepaths.

1) The server_version_message() was working on an out-of-date
   copy of the client_info. As a result, the X server and the
   window manager did not agree on the number of windows
2) As a result of 1), a memory leak was found in the VNC module.
2024-02-15 16:47:15 +00:00
metalefty 422cfb7a9c
Merge pull request #2946 from metalefty/codec
Just log Image RemoteFX codec
2024-02-15 20:31:54 +09:00
Koichiro Iwao 9ad0d6abb6 Just log Image RemoteFX codec 2024-02-15 13:21:17 +09:00
matt335672 b9fd19e6b5 Remove hard-coded version from scripts/run_astyle.sh
This script now works the same way as cppcheck. The version to
be used is specified once in the github CI action
2024-02-12 10:31:49 +00:00
Koichiro Iwao 4c2a7e893b Changge development version to 0.10.80 2024-02-08 22:07:27 +09:00
metalefty 494376438c
Merge pull request #2941 from metalefty/format
Apply astyle 3.4 code formatter
2024-02-08 22:02:30 +09:00
Koichiro Iwao 2307608cfb Apply astyle 3.4 code formatter 2024-02-08 21:53:58 +09:00
metalefty 45fd497645
Merge pull request #2891 from neutrinolabs/gfx_mainline_merge_work
Gfx mainline merge work
2024-02-08 21:50:16 +09:00
metalefty 4f8301f38a
Merge pull request #2940 from metalefty/astyle
Update astyle to 3.4.12
2024-02-08 21:39:19 +09:00
Koichiro Iwao b8f0094603 Simplify cloning astyle source 2024-02-08 21:17:03 +09:00
metalefty 76242bbf63
GFX: Relegate some logs to LOG_DEVEL (#2939) 2024-02-08 21:09:09 +09:00
Koichiro Iwao 47d4ab1339 Apply astyle 3.4 code formatter 2024-02-08 15:52:54 +09:00
Koichiro Iwao ffd25af182 astyle: replace depreacted astyle options
with compatible ones with astyle 3.4. Now configuration is compatible
both astyle 3.1 and 3.4.
2024-02-08 15:34:17 +09:00
Koichiro Iwao b39c12f351 Update astyle to 3.4.12
as astyle 3.1 is no longer available in the latest FreeBSD.

Also, astyle upstream repository has been moved to GitLab. Switched git
to obtain astyle source.

https://gitlab.com/saalen/astyle
2024-02-08 15:34:17 +09:00
Nexarian 8027a42497 More NPE fix 2024-02-02 21:19:49 -05:00