diff --git a/net-snmp-5.9.4-systemd-no-utmp.patch b/net-snmp-5.9.4-systemd-no-utmp.patch new file mode 100644 index 0000000..e02828b --- /dev/null +++ b/net-snmp-5.9.4-systemd-no-utmp.patch @@ -0,0 +1,49 @@ +diff -uwr net-snmp-5.9.3.old/agent/Makefile.in net-snmp-5.9.3/agent/Makefile.in +--- net-snmp-5.9.3.old/agent/Makefile.in 2022-07-13 23:14:14.000000000 +0200 ++++ net-snmp-5.9.3/agent/Makefile.in 2023-06-16 11:31:16.049538400 +0200 +@@ -116,7 +116,7 @@ + MIBLIB = libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION) + + LAGENTLIBS = @LAGENTLIBS@ +-LMIBLIBS = @LMIBLIBS@ ++LMIBLIBS = @LMIBLIBS@ -lsystemd + VAL_LIBS = @VAL_LIBS@ + PERLLDOPTS_FOR_APPS = @PERLLDOPTS_FOR_APPS@ + PERLLDOPTS_FOR_LIBS = @PERLLDOPTS_FOR_LIBS@ +diff -uwr net-snmp-5.9.3.old/agent/mibgroup/host/hr_system.c net-snmp-5.9.3/agent/mibgroup/host/hr_system.c +--- net-snmp-5.9.3.old/agent/mibgroup/host/hr_system.c 2022-07-13 23:14:14.000000000 +0200 ++++ net-snmp-5.9.3/agent/mibgroup/host/hr_system.c 2023-06-16 10:38:58.916026706 +0200 +@@ -79,6 +79,11 @@ + #include + #endif + ++#ifndef NETSNMP_NO_SYSTEMD ++#include ++#include ++#endif ++ + netsnmp_feature_require(date_n_time); + + #if !defined(UTMP_FILE) && defined(_PATH_UTMP) +@@ -686,6 +691,11 @@ + struct utmp *utmp_p; + #endif + ++#ifndef NETSNMP_NO_SYSTEMD ++ if (sd_booted () > 0) ++ total = sd_get_sessions (NULL); ++ else { ++#endif + setutent(); + while ((utmp_p = getutent()) != NULL) { + #ifndef UTMP_HAS_NO_TYPE +@@ -704,6 +714,9 @@ + ++total; + } + endutent(); ++#ifndef NETSNMP_NO_SYSTEMD ++ } ++#endif + #else /* WIN32 */ + /* + * TODO - Error checking. diff --git a/net-snmp.changes b/net-snmp.changes index 3e243a9..9a9fabf 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 20 09:01:42 UTC 2023 - Thorsten Kukuk + +- net-snmp-5.9.4-systemd-no-utmp.patch: prefer systemd-logind over + utmp to count number of logged in users, utmp is not reliable for + this and has a Y2038 problem (jsc#PED-3144) + ------------------------------------------------------------------- Tue Oct 17 13:56:01 UTC 2023 - Alexander Bergmann diff --git a/net-snmp.spec b/net-snmp.spec index c5b0093..ecfa554 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -64,6 +64,7 @@ Patch13: net-snmp-5.9.4-fix-create-v3-user-outfile.patch Patch14: net-snmp-5.9.4-subagent-set-response.patch Patch15: net-snmp-5.9.4-fixed-python2-bindings.patch Patch16: net-snmp-5.9.4-add-netgroups-functionality.patch +Patch17: net-snmp-5.9.4-systemd-no-utmp.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: autoconf @@ -74,13 +75,13 @@ BuildRequires: openssl-devel BuildRequires: procps BuildRequires: python-rpm-macros BuildRequires: rpm-devel +BuildRequires: systemd-devel BuildRequires: systemd-rpm-macros BuildRequires: tcpd-devel Requires: logrotate Requires: perl-SNMP = %{version} Requires: perl-TermReadKey Requires(post): %fillup_prereq -%{?systemd_requires} %if 0%{?netsnmp_with_sensors} BuildRequires: libsensors4-devel %endif