Skip to content

Commit

Permalink
Add --enable-utmp to configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
matt335672 committed Feb 21, 2024
1 parent bf53a76 commit 3b6c9bc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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>)]),,)
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions sesman/sesexec/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ AM_CPPFLAGS = \

SESEXEC_EXTRA_LIBS =

if XRDP_UTMP
AM_CPPFLAGS += -DUSE_UTMP
endif

pkglibexec_PROGRAMS = \
xrdp-sesexec

Expand Down
18 changes: 12 additions & 6 deletions sesman/sesexec/sessionrecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,29 @@
#include <config_ac.h>
#endif

#ifdef USE_UTMP

#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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"

Expand All @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 3b6c9bc

Please sign in to comment.