summaryrefslogtreecommitdiff
path: root/system/openssh/utmpx.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/openssh/utmpx.patch')
-rw-r--r--system/openssh/utmpx.patch103
1 files changed, 103 insertions, 0 deletions
diff --git a/system/openssh/utmpx.patch b/system/openssh/utmpx.patch
new file mode 100644
index 000000000..d3f24aa76
--- /dev/null
+++ b/system/openssh/utmpx.patch
@@ -0,0 +1,103 @@
+--- openssh-9.9p2/configure.ac.old 2025-02-18 02:15:08.000000000 -0600
++++ openssh-9.9p2/configure.ac 2025-02-18 20:57:12.172701096 -0600
+@@ -5449,7 +5449,9 @@
+ AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+-#include <utmp.h>
++#ifdef HAVE_UTMP_H
++# include <utmp.h>
++#endif
+ #ifdef HAVE_LASTLOG_H
+ # include <lastlog.h>
+ #endif
+@@ -5466,7 +5468,9 @@
+ AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+-#include <utmp.h>
++#ifdef HAVE_UTMP_H
++# include <utmp.h>
++#endif
+ #ifdef HAVE_LASTLOG_H
+ # include <lastlog.h>
+ #endif
+@@ -5504,7 +5508,9 @@
+ AC_MSG_CHECKING([if your system defines UTMP_FILE])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+-#include <utmp.h>
++#ifdef HAVE_UTMP_H
++# include <utmp.h>
++#endif
+ #ifdef HAVE_PATHS_H
+ # include <paths.h>
+ #endif
+@@ -5534,7 +5540,9 @@
+ AC_MSG_CHECKING([if your system defines WTMP_FILE])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+-#include <utmp.h>
++#ifdef HAVE_UTMP_H
++# include <utmp.h>
++#endif
+ #ifdef HAVE_PATHS_H
+ # include <paths.h>
+ #endif
+@@ -5564,7 +5572,9 @@
+ AC_MSG_CHECKING([if your system defines WTMPX_FILE])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+-#include <utmp.h>
++#ifdef HAVE_UTMP_H
++# include <utmp.h>
++#endif
+ #ifdef HAVE_UTMPX_H
+ #include <utmpx.h>
+ #endif
+--- openssh-9.9p2/loginrec.c.old 2025-02-18 02:15:08.000000000 -0600
++++ openssh-9.9p2/loginrec.c 2025-02-18 21:01:26.034757676 -0600
+@@ -614,7 +614,7 @@
+ ** into account.
+ **/
+
+-#if defined(USE_BTMP) || defined(USE_UTMP) || defined (USE_WTMP) || defined (USE_LOGIN)
++#if defined(USE_UTMP) || defined (USE_WTMP) || defined (USE_LOGIN)
+
+ /* build the utmp structure */
+ void
+@@ -698,7 +698,7 @@
+ }
+ # endif
+ }
+-#endif /* USE_BTMP || USE_UTMP || USE_WTMP || USE_LOGIN */
++#endif /* USE_UTMP || USE_WTMP || USE_LOGIN */
+
+ /**
+ ** utmpx utility functions
+@@ -1644,7 +1644,13 @@
+ const char *ttyn)
+ {
+ int fd;
++#if defined(USE_UTMP)
+ struct utmp ut;
++#elif defined(USE_UTMPX)
++ struct utmpx ut;
++#else
++# error either UTMP or UTMPX must be present to use BTMP
++#endif
+ struct logininfo li;
+ socklen_t fromlen = sizeof(li.hostaddr);
+ time_t t;
+@@ -1681,7 +1687,11 @@
+ (void)getpeername(ssh_packet_get_connection_in(ssh),
+ &li.hostaddr.sa, &fromlen);
+ }
++#if defined(USE_UTMP)
+ construct_utmp(&li, &ut);
++#elif defined(USE_UTMPX)
++ construct_utmpx(&li, &ut);
++#endif
+
+ if (atomicio(vwrite, fd, &ut, sizeof(ut)) != sizeof(ut)) {
+ error("Failed to write to %s: %s", _PATH_BTMP,