diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7844013..d118eebc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,10 +110,11 @@ jobs: # define the standard environment variable used in the rest of the steps. CONF_FLAGS_amd64_min: "--disable-ipv6 --disable-jpeg --disable-fuse --disable-mp3lame --disable-fdkaac --disable-opus --disable-rfxcodec --disable-painter - --disable-pixman" + --disable-pixman --disable-utmp" CONF_FLAGS_amd64_max: "--enable-ipv6 --enable-jpeg --enable-fuse --enable-mp3lame --enable-fdkaac --enable-opus --enable-rfxcodec --enable-painter - --enable-pixman --with-imlib2 --with-freetype2 --enable-tests" + --enable-pixman --enable-utmp + --with-imlib2 --with-freetype2 --enable-tests" CONF_FLAGS_i386_max: "--enable-ipv6 --enable-jpeg --enable-mp3lame --enable-opus --enable-rfxcodec --enable-painter --disable-pixman --with-imlib2 --with-freetype2 diff --git a/configure.ac b/configure.ac index db8a5708..819557cf 100644 --- a/configure.ac +++ b/configure.ac @@ -183,6 +183,11 @@ AC_ARG_ENABLE(rdpsndaudin, AS_HELP_STRING([--enable-rdpsndaudin], [], [enable_rdpsndaudin=no]) AM_CONDITIONAL(XRDP_RDPSNDAUDIN, [test x$enable_rdpsndaudin = xyes]) +AC_ARG_ENABLE(utmp, AS_HELP_STRING([--enable-utmp], + [Update utmp (default: no)]), + [], [enable_utmp=no]) +AM_CONDITIONAL(XRDP_UTMP, [test x$enable_utmp = xyes]) + AC_ARG_WITH(imlib2, AS_HELP_STRING([--with-imlib2=ARG], [imlib2 library to use for non-BMP backgrounds (ARG=yes/no/)]),,) AC_ARG_WITH(freetype2, AS_HELP_STRING([--with-freetype2=ARG], [freetype2 library to use for rendering fonts (ARG=yes/no/)]),,) @@ -515,7 +520,10 @@ AC_CHECK_HEADER([X11/extensions/Xrandr.h], [], [AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])], [#include ]) -AC_CHECK_HEADERS(utmp.h utmpx.h) +if test "x$enable_utmp" = "xyes" +then + AC_CHECK_HEADERS(utmp.h utmpx.h) +fi CFLAGS="$save_CFLAGS" @@ -634,6 +642,7 @@ echo " ipv6only $enable_ipv6only" echo " vsock $enable_vsock" echo " auth mechanism $auth_mech" echo " rdpsndaudin $enable_rdpsndaudin" +echo " utmp support $enable_utmp" echo echo " with imlib2 $use_imlib2" echo " with freetype2 $use_freetype2" diff --git a/sesman/sesexec/Makefile.am b/sesman/sesexec/Makefile.am index c270c4c0..7adb9591 100644 --- a/sesman/sesexec/Makefile.am +++ b/sesman/sesexec/Makefile.am @@ -9,6 +9,10 @@ AM_CPPFLAGS = \ SESEXEC_EXTRA_LIBS = +if XRDP_UTMP + AM_CPPFLAGS += -DUSE_UTMP +endif + pkglibexec_PROGRAMS = \ xrdp-sesexec diff --git a/sesman/sesexec/sessionrecord.c b/sesman/sesexec/sessionrecord.c index f50bf790..cbbd6eb4 100644 --- a/sesman/sesexec/sessionrecord.c +++ b/sesman/sesexec/sessionrecord.c @@ -31,6 +31,8 @@ #include #endif +#ifdef USE_UTMP + #include #include #include @@ -38,19 +40,20 @@ #include #include -#include "log.h" -#include "os_calls.h" -#include "string_calls.h" -#include "sessionrecord.h" - #ifdef HAVE_UTMPX_H #include typedef struct utmpx _utmp; #else -#include +#include typedef struct utmp _utmp; #endif +#endif // USE_UTMP + +#include "log.h" +#include "os_calls.h" +#include "string_calls.h" +#include "sessionrecord.h" #define XRDP_LINE_FORMAT "xrdp:%d" @@ -62,6 +65,7 @@ typedef struct utmp _utmp; void add_xtmp_entry(int pid, const char *display_id, const char *user, const char *rhostname, const short state) { +#if USE_UTMP _utmp ut; struct timeval tv; @@ -83,6 +87,8 @@ add_xtmp_entry(int pid, const char *display_id, const char *user, const char *rh pututxline(&ut); /* closes utmp */ endutxent(); + +#endif // USE_UTMP } void