Accepting request 1119202 from home:kukuk:no-utmp

- 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)

OBS-URL: https://build.opensuse.org/request/show/1119202
OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-snmp?expand=0&rev=63
This commit is contained in:
Marcus Meissner 2023-10-25 08:07:41 +00:00 committed by Git OBS Bridge
parent 582cf62134
commit 46eccaf3cf
3 changed files with 58 additions and 1 deletions

View File

@ -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 <sys/sysctl.h>
#endif
+#ifndef NETSNMP_NO_SYSTEMD
+#include <systemd/sd-daemon.h>
+#include <systemd/sd-login.h>
+#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.

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 20 09:01:42 UTC 2023 - Thorsten Kukuk <kukuk@suse.com>
- 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 <abergmann@suse.com>

View File

@ -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