[PATCH:xdm] Only pass -u & -w args to sessreg if --with-{u, w}tmp-file specified
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Nov 4 19:13:49 PST 2014
If not specified, let sessreg use its builtin defaults instead of
replicating the logic here (and possibly getting it wrong), especially
since in sessreg-1.0.8 and earlier, using the -u & -w flags forces
the use of the utmp/wtmp code and not the newer utmpx/wtmpx code.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
config/Makefile.am | 14 +++++++++++++-
config/Xreset.cpp | 2 +-
config/Xstartup.cpp | 2 +-
configure.ac | 28 ++++++++++------------------
4 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/config/Makefile.am b/config/Makefile.am
index 30e22ea..e1484f1 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -49,8 +49,20 @@ XPMDEFINES = -DXPM -DBITMAPDIR=$(XDM_PIXMAPDIR) -DXDM_PIXMAP=$(XDM_PIXMAP) \
MKTEMP_DEFINES = -DMKTEMP_COMMAND=$(MKTEMP_COMMAND)
#endif
+if SET_UTMP_FILE
+UTMP_CPP_FLAGS = -DUTMP_FILE="$(UTMP_FILE)" -DUTMP_FLAG="-u $(UTMP_FILE)"
+else
+UTMP_CPP_FLAGS = -DUTMP_FILE="" -DUTMP_FLAG=""
+endif
+
+if SET_WTMP_FILE
+WTMP_CPP_FLAGS = -DWTMP_FILE="$(WTMP_FILE)" -DWTMP_FLAG="-w $(WTMP_FILE)"
+else
+WTMP_CPP_FLAGS = -DWTMP_FILE="" -DWTMP_FLAG=""
+endif
+
CPP_FILES_FLAGS = -DBINDIR="$(bindir)" -DDEFAULTVT="$(DEFAULTVT)" \
- -DUTMP_FILE="$(UTMP_FILE)" -DWTMP_FILE="$(WTMP_FILE)" \
+ $(UTMP_CPP_FLAGS) $(WTMP_CPP_FLAGS) \
-DXDMDIR="$(XDMLIBDIR)" -DXDMLOGDIR="$(XDMLOGDIR)" \
-DXDMXAUTHDIR="$(XDMXAUTHDIR)" \
-DXDMPIDDIR="$(XDMPIDDIR)" -DXDMCONFIGDIR="$(XDMCONFIGDIR)" \
diff --git a/config/Xreset.cpp b/config/Xreset.cpp
index 321cd89..5327402 100644
--- a/config/Xreset.cpp
+++ b/config/Xreset.cpp
@@ -1,5 +1,5 @@
XCOMM!/bin/sh
XCOMM Deregister a login. (Derived from TakeConsole as follows:)
XCOMM
-BINDIR/sessreg -d -w WTMP_FILE -u UTMP_FILE \
+BINDIR/sessreg -d WTMP_FLAG UTMP_FLAG \
-x XDMCONFIGDIR/Xservers -l $DISPLAY -h "" $USER
diff --git a/config/Xstartup.cpp b/config/Xstartup.cpp
index 001cef2..9329460 100644
--- a/config/Xstartup.cpp
+++ b/config/Xstartup.cpp
@@ -1,5 +1,5 @@
XCOMM!/bin/sh
XCOMM Register a login (derived from GiveConsole as follows:)
XCOMM
-exec BINDIR/sessreg -a -w WTMP_FILE -u UTMP_FILE \
+exec BINDIR/sessreg -a WTMP_FLAG UTMP_FLAG \
-x XDMCONFIGDIR/Xservers -l $DISPLAY -h "" $USER
diff --git a/configure.ac b/configure.ac
index 38b2a28..8f42f16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,8 +279,6 @@ AC_ARG_WITH(config-type,
[SERVERSTYPE="$withval"], [SERVERSTYPE="ws"])
AC_SUBST(SERVERSTYPE)
-# Ideally we'd just pull out UTMP_FILE & WTMP_FILE from <utmp.h>
-# but that's not easy to do in autoconf
AC_ARG_WITH(utmp_file,
AS_HELP_STRING([--with-utmp-file=<pathname>],
[specify file to pass to sessreg -u for current logins]),
@@ -288,16 +286,13 @@ AC_ARG_WITH(utmp_file,
if test "x$UTMP_FILE" = "xyes" ; then
AC_MSG_ERROR([path was not specified to --with-utmp-file])
fi
+AC_MSG_CHECKING([for path to file listing current logins for sessreg])
if test "x$UTMP_FILE" = "x" ; then
- for UTMP_FILE in /var/adm/utmpx /var/run/utmp /var/log/utmp /var/adm/utmp /usr/adm/utmp /etc/utmp ; do
- AC_CHECK_FILE([$UTMP_FILE], [break], [UTMP_FILE=""])
- done
- if test "x$UTMP_FILE" = "x" ; then
- UTMP_FILE="/var/run/utmp"
- fi
+ AC_MSG_RESULT([none])
+else
+ AC_MSG_RESULT([$UTMP_FILE])
fi
-AC_MSG_CHECKING([for path to file listing current logins for sessreg])
-AC_MSG_RESULT([$UTMP_FILE])
+AM_CONDITIONAL(SET_UTMP_FILE, test x$UTMP_FILE != x)
AC_SUBST(UTMP_FILE)
AC_ARG_WITH(wtmp_file,
@@ -307,16 +302,13 @@ AC_ARG_WITH(wtmp_file,
if test "x$WTMP_FILE" = "xyes" ; then
AC_MSG_ERROR([path was not specified to --with-wtmp-file])
fi
+AC_MSG_CHECKING([for path to file listing login history for sessreg])
if test "x$WTMP_FILE" = "x" ; then
- for WTMP_FILE in /var/adm/wtmpx /var/log/wtmp /var/adm/wtmp /usr/adm/wtmp /etc/wtmp ; do
- AC_CHECK_FILE([$WTMP_FILE], [break], [WTMP_FILE=""])
- done
- if test "x$WTMP_FILE" = "x" ; then
- WTMP_FILE="/var/log/wtmp"
- fi
+ AC_MSG_RESULT([none])
+else
+ AC_MSG_RESULT([$WTMP_FILE])
fi
-AC_MSG_CHECKING([for path to file listing login history for sessreg])
-AC_MSG_RESULT([$WTMP_FILE])
+AM_CONDITIONAL(SET_WTMP_FILE, test x$WTMP_FILE != x)
AC_SUBST(WTMP_FILE)
case $host_os in
--
1.7.9.2
More information about the xorg-devel
mailing list