diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-12-07 23:59:25 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-12-08 00:11:45 -0600 |
commit | 5ee86390be9d767743332fd3bd61af1719f049a0 (patch) | |
tree | bc46b1ee7a93156bd8b11f9a7aa5dc94d55a93a3 | |
parent | 3e85cb0748ca9c923c339034ec0df3b458d411f8 (diff) | |
download | packages-awilfox/system-fixes.tar.gz packages-awilfox/system-fixes.tar.bz2 packages-awilfox/system-fixes.tar.xz packages-awilfox/system-fixes.zip |
system/openssh: Fix feature detection in autoconfawilfox/system-fixes
This allows wtmp support to be detected properly on utmps systems.
-rw-r--r-- | system/openssh/APKBUILD | 18 | ||||
-rw-r--r-- | system/openssh/fix-utmpx.patch | 45 | ||||
-rw-r--r-- | system/openssh/utmp-header-check.patch | 59 |
3 files changed, 116 insertions, 6 deletions
diff --git a/system/openssh/APKBUILD b/system/openssh/APKBUILD index 05c36455b..a393066ef 100644 --- a/system/openssh/APKBUILD +++ b/system/openssh/APKBUILD @@ -4,14 +4,14 @@ pkgname=openssh pkgver=9.4_p1 _myver=${pkgver%_*}${pkgver#*_} -pkgrel=0 +pkgrel=1 pkgdesc="Remote login tool using encrypted SSH protocol" url="https://www.openssh.com/portable.html" arch="all" options="suid !check" license="BSD-1-Clause AND BSD-2-Clause AND BSD-3-Clause" depends="openssh-client openssh-sftp-server openssh-server" -makedepends_build="linux-pam-dev gettext-tiny" +makedepends_build="autoconf automake libtool linux-pam-dev gettext-tiny" makedepends_host="openssl-dev zlib-dev linux-headers linux-pam-dev gettext-tiny-dev utmps-dev" makedepends="$makedepends_build $makedepends_host" @@ -29,6 +29,7 @@ source="https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$pkgname-$_myver.ta fix-utmpx.patch sftp-interactive.patch time64-seccomp.patch + utmp-header-check.patch sshd.initd sshd.confd @@ -52,6 +53,11 @@ source="https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$pkgname-$_myver.ta builddir="$srcdir"/$pkgname-$_myver +prepare() { + default_prepare + autoreconf -vif +} + build() { export LD="$CC" LIBS="-lutmps -lskarnet" ./configure --build=$CBUILD \ @@ -63,9 +69,12 @@ build() { --with-pid-dir=/run \ --with-mantype=man \ --with-ldflags="${LDFLAGS}" \ + --disable-utmp \ + --disable-wtmp \ --enable-lastlog \ + --enable-utmpx \ + --enable-wtmpx \ --disable-strip \ - --enable-wtmp \ --with-privsep-path=/var/empty \ --with-xauth=/usr/bin/xauth \ --with-privsep-user=sshd \ @@ -150,8 +159,9 @@ openrc() { sha512sums="0aaedeced7dbc70419c7245eb0e9db4ef570e0e7739b890ebae04d56da5fe8d147e8e150f3c943f60730976569e3ac6cc8da62ec7e2a78e2ef47d295ca0b1d25 openssh-9.4p1.tar.gz f3d5960572ddf49635d4edbdff45835df1b538a81840db169c36b39862e6fa8b0393ca90626000b758f59567ff6810b2537304098652483b3b31fb438a061de6 disable-forwarding-by-default.patch -70bffa6c061a02dd790dbaa68cd0b488395aa2312039b037e1a707e8cf7465754bf376d943d351914b64044c074af7504e845de865dec45ea00d992c2bbb8925 fix-utmpx.patch +81993408a6d48797e59229c282409506d09baf8c7b97fceafc32d9d9cfc2a3d92b25d685c1021a9e647e62d6335c579b2efed089212a806eaeb20ce9cfd8918e fix-utmpx.patch 34c0673f550e7afcd47eda4fe1da48fb42e5344c95ba8064c9c3c137fda9c43635b0f7b8145d0300f59c79f75a396ebd467afb54cdaa42aa251d624d0752dc84 sftp-interactive.patch ad5b209f7f3fff69c10bae34da143e071e107a2141eee94f393532d6bb04a36bfe6d9b5d2c08b713f67118503c38d11b4aad689df1df7c8a918d52db8326821d time64-seccomp.patch +76dcb3c46a2ce1c92c48058b7fdcb8d3230afefc16b80ab6b816bf21bd250ef67488e648fbe65b5d13ccf07bb748409751f1a54c0df9655a70d355648bf612bb utmp-header-check.patch 964c0f8538ba25bdc9cdbd1467bbdfb2090e38492ff0ef7c64473785713fe26d752ea6a7b0ee7a0b34e08f4d3b4bccf6a69e6c456f0c57d0d0c581aa8a046936 sshd.initd ce0abddbd2004891f88efd8522c4b37a4989290269fab339c0fa9aacc051f7fd3b20813e192e92e0e64315750041cb74012d4321260f4865ff69d7a935b259d4 sshd.confd" diff --git a/system/openssh/fix-utmpx.patch b/system/openssh/fix-utmpx.patch index d04742e2f..fd33b761c 100644 --- a/system/openssh/fix-utmpx.patch +++ b/system/openssh/fix-utmpx.patch @@ -1,5 +1,46 @@ ---- openssh-7.7p1/loginrec.c.old 2018-04-02 00:38:28.000000000 -0500 -+++ openssh-7.7p1/loginrec.c 2018-06-15 22:09:00.091482769 -0500 +diff -rNU3 openssh-9.4p1.old/loginrec.c openssh-9.4p1/loginrec.c +--- openssh-9.4p1.old/loginrec.c 2023-08-10 01:10:22.000000000 +0000 ++++ openssh-9.4p1/loginrec.c 2024-12-08 04:52:39.040018859 +0000 +@@ -741,7 +741,7 @@ + void + construct_utmpx(struct logininfo *li, struct utmpx *utx) + { +-# ifdef HAVE_ADDR_V6_IN_UTMP ++# ifdef HAVE_ADDR_V6_IN_UTMPX + struct sockaddr_in6 *sa6; + # endif + memset(utx, '\0', sizeof(*utx)); +@@ -763,10 +763,6 @@ + set_utmpx_time(li, utx); + utx->ut_pid = li->pid; + +- /* strncpy(): Don't necessarily want null termination */ +- strncpy(utx->ut_user, li->username, +- MIN_SIZEOF(utx->ut_user, li->username)); +- + if (li->type == LTYPE_LOGOUT) + return; + +@@ -775,6 +771,10 @@ + * for logouts. + */ + ++ /* strncpy(): Don't necessarily want null termination */ ++ strncpy(utx->ut_user, li->username, ++ MIN_SIZEOF(utx->ut_user, li->username)); ++ + # ifdef HAVE_HOST_IN_UTMPX + strncpy(utx->ut_host, li->hostname, + MIN_SIZEOF(utx->ut_host, li->hostname)); +@@ -787,7 +787,7 @@ + if (li->hostaddr.sa.sa_family == AF_INET) + utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr; + # endif +-# ifdef HAVE_ADDR_V6_IN_UTMP ++# ifdef HAVE_ADDR_V6_IN_UTMPX + /* this is just a 128-bit IPv6 address */ + if (li->hostaddr.sa.sa_family == AF_INET6) { + sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa); @@ -1663,7 +1663,11 @@ const char *ttyn) { diff --git a/system/openssh/utmp-header-check.patch b/system/openssh/utmp-header-check.patch new file mode 100644 index 000000000..523466684 --- /dev/null +++ b/system/openssh/utmp-header-check.patch @@ -0,0 +1,59 @@ +Ensure that <utmp.h> is only included when present and available. + +--- openssh-9.4p1/configure.ac.old 2023-08-09 20:10:22.000000000 -0500 ++++ openssh-9.4p1/configure.ac 2024-12-07 23:51:42.425820273 -0600 +@@ -5351,7 +5351,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 +@@ -5368,7 +5370,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 +@@ -5406,7 +5410,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 +@@ -5436,7 +5442,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 +@@ -5466,7 +5474,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 |