From 2a7cad63e8b8677d3da9042d151ad38326348c06 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 30 Aug 2023 15:12:59 +0000 Subject: system/util-linux: fix default paths for utmps utmp is a mess everywhere, properly cleaning it up would be a herculean task. Instead, here, we just change the hardcoded assumptions into other hardcoded assumptions that work for us. --- system/util-linux/0000-utmps-paths.patch | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 system/util-linux/0000-utmps-paths.patch (limited to 'system/util-linux/0000-utmps-paths.patch') diff --git a/system/util-linux/0000-utmps-paths.patch b/system/util-linux/0000-utmps-paths.patch new file mode 100644 index 000000000..861e38ff3 --- /dev/null +++ b/system/util-linux/0000-utmps-paths.patch @@ -0,0 +1,59 @@ +diff -rNU3 util-linux-2.38.1.old/include/pathnames.h util-linux-2.38.1/include/pathnames.h +--- util-linux-2.38.1.old/include/pathnames.h 2022-08-04 08:21:36.041638477 +0000 ++++ util-linux-2.38.1/include/pathnames.h 2023-08-30 15:08:07.990025756 +0000 +@@ -67,9 +67,10 @@ + # define _PATH_TMP "/tmp/" + #endif + +-#ifndef _PATH_BTMP +-# define _PATH_BTMP "/var/log/btmp" +-#endif ++#undef _PATH_WTMP ++#define _PATH_WTMP "/var/log/wtmpd/wtmp" ++#undef _PATH_BTMP ++#define _PATH_BTMP "/var/log/wtmpd/btmp" + + #define _PATH_ISSUE_FILENAME "issue" + #define _PATH_ISSUE_DIRNAME _PATH_ISSUE_FILENAME ".d" +diff -rNU3 util-linux-2.38.1.old/login-utils/login.c util-linux-2.38.1/login-utils/login.c +--- util-linux-2.38.1.old/login-utils/login.c 2022-05-11 08:13:10.903531622 +0000 ++++ util-linux-2.38.1/login-utils/login.c 2023-08-30 14:57:20.930021550 +0000 +@@ -71,6 +71,9 @@ + # include + #endif + ++#include ++#include ++ + #include "c.h" + #include "pathnames.h" + #include "strutils.h" +@@ -623,7 +626,8 @@ + sizeof(ut.ut_addr_v6)); + } + +- updwtmpx(_PATH_BTMP, &ut); ++ // updwtmpx(_PATH_BTMP, &ut); ++ utmps_updwtmpx_g("/run/utmps/.btmpd-socket", &ut, 0); + } + + #ifdef HAVE_LIBAUDIT +@@ -731,7 +735,7 @@ + struct utmpx *utp = NULL; + struct timeval tv = { 0 }; + +- utmpxname(_PATH_UTMP); ++ // utmpxname(_PATH_UTMP); + setutxent(); + + /* Find pid in utmp. +@@ -794,7 +798,8 @@ + pututxline(&ut); + endutxent(); + +- updwtmpx(_PATH_WTMP, &ut); ++ // updwtmpx(_PATH_WTMP, &ut); ++ utmps_updwtmpx_g("/run/utmps/.wtmpd-socket", &ut, 0); + } + + static void log_syslog(struct login_context *cxt) -- cgit v1.2.3-60-g2f50