Control: tags -1 patch

Hi FreeRADIUS maintainers,

On Thu, Feb 20, 2025 at 02:02:33PM -0500, John Chittum wrote:
> I see that 3.2.7 got merged, however a choice was made to keep `radlast`
> without a `last` command being available.

I attach a patch that might allow radlast to function in trixie by
importing the wtmp file to a temporary wtmpdb database.

Perhaps this could be accompanied by a NEWS entry advising users that
this is a transitionary solution for trixie giving them plenty of time
to sort out a replacement solution.

I am afraid I cannot confirm that this works for FreeRADIUS
specifically but would be happy to help out with any issues.

Andrew
>From 4462edc88ec31b64c82bfc7fe6554403d58fc9df Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Wed, 9 Apr 2025 21:04:53 +0100
Subject: [PATCH] Patch radlast to wrap wtmpdb import step. (Closes: #1094356)

---
 debian/control                             |  1 +
 debian/patches/radlast-wtmpdb-wrapper.diff | 22 ++++++++++++++++++++++
 debian/patches/series                      |  1 +
 3 files changed, 24 insertions(+)
 create mode 100644 debian/patches/radlast-wtmpdb-wrapper.diff

diff --git a/debian/control b/debian/control
index 59fff83..4dba396 100644
--- a/debian/control
+++ b/debian/control
@@ -98,6 +98,7 @@ Conflicts: radiusd-livingston, yardradius
 Depends: freeradius-common,
          freeradius-config,
          libfreeradius3 (= ${binary:Version}),
+         wtmpdb (>= 0.71.0+git20250228.4e4b54e-2~),
          ${dist:Depends},
          ${misc:Depends},
          ${perl:Depends},
diff --git a/debian/patches/radlast-wtmpdb-wrapper.diff b/debian/patches/radlast-wtmpdb-wrapper.diff
new file mode 100644
index 0000000..ad16241
--- /dev/null
+++ b/debian/patches/radlast-wtmpdb-wrapper.diff
@@ -0,0 +1,22 @@
+From: Andrew Bower <and...@bower.uk>
+Date: Wed, 9 Apr 2025 21:02:08 +0100
+Forwarded: no
+Subject: import radwtmp into temporary wtmpdb database for radlast
+
+---
+ src/main/radlast.in | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/main/radlast.in b/src/main/radlast.in
+index 69867bb..8bbac99 100755
+--- a/src/main/radlast.in
++++ b/src/main/radlast.in
+@@ -4,4 +4,7 @@ prefix=@prefix@
+ localstatedir=@localstatedir@
+ logdir=@logdir@
+ 
+-exec last -f $logdir/radwtmp "$@"
++db=$(mktemp)
++trap 'rm -f "$db"' EXIT
++
++wtmpdb import -f "$db" "$logdir/radwtmp" && last -f "$db" "$@"
diff --git a/debian/patches/series b/debian/patches/series
index 816e30a..47d6980 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ debian-local/0001-Rename-radius-to-freeradius.patch
 debian-local/0010-version.c-disable-openssl-version-check.patch
 dont-install-tests.diff
 snakeoil-certs.diff
+radlast-wtmpdb-wrapper.diff
-- 
2.49.0

Reply via email to