Add --enable-utmp to configure.ac

This commit is contained in:
matt335672 2023-06-29 16:45:50 +01:00
parent bf53a76ea1
commit 3b6c9bcba3
4 changed files with 29 additions and 9 deletions

View File

@ -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

View File

@ -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/<abs-path>)]),,)
AC_ARG_WITH(freetype2, AS_HELP_STRING([--with-freetype2=ARG], [freetype2 library to use for rendering fonts (ARG=yes/no/<abs-path>)]),,)
@ -515,7 +520,10 @@ AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
[AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])],
[#include <X11/Xlib.h>])
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"

View File

@ -9,6 +9,10 @@ AM_CPPFLAGS = \
SESEXEC_EXTRA_LIBS =
if XRDP_UTMP
AM_CPPFLAGS += -DUSE_UTMP
endif
pkglibexec_PROGRAMS = \
xrdp-sesexec

View File

@ -31,6 +31,8 @@
#include <config_ac.h>
#endif
#ifdef USE_UTMP
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -38,19 +40,20 @@
#include <sys/time.h>
#include <unistd.h>
#include "log.h"
#include "os_calls.h"
#include "string_calls.h"
#include "sessionrecord.h"
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
typedef struct utmpx _utmp;
#else
#include <utmpx.h>
#include <utmp.h>
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