forked from pool/monitoring-plugins
Accepting request 1093439 from home:kukuk:no-utmp
- systemd-not-utmp.patch: let check_users prefer systemd-logind over utmp (jsc#PED-3144) OBS-URL: https://build.opensuse.org/request/show/1093439 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=108
This commit is contained in:
parent
83ad0b15ce
commit
6aff090ca2
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 15 14:44:14 UTC 2023 - Thorsten Kukuk <kukuk@suse.com>
|
||||
|
||||
- systemd-not-utmp.patch: let check_users prefer systemd-logind
|
||||
over utmp (jsc#PED-3144)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 31 21:57:07 UTC 2023 - David Disseldorp <ddiss@suse.com>
|
||||
|
||||
|
@ -86,6 +86,8 @@ Patch129: monitoring-plugins-2.3.3-check_by_ssh.patch
|
||||
Patch130: monitoring-plugins-2.3.3-check_http-proxy.patch
|
||||
# PATCH-FIX-UPSTREAM - simple fix for compiler error regarding no return value in function get_ip_address
|
||||
Patch131: monitoring-plugins-2.3.3-check_icmp.patch
|
||||
# PATCH-FEATURE-SLE - Use systemd-logind instead of utmp (jsc#PED-3144)
|
||||
Patch132: systemd-not-utmp.patch
|
||||
BuildRequires: bind-utils
|
||||
BuildRequires: dhcp-devel
|
||||
BuildRequires: fping
|
||||
@ -114,6 +116,9 @@ BuildRequires: perl(Net::SNMP)
|
||||
BuildRequires: postfix
|
||||
BuildRequires: postgresql-devel
|
||||
BuildRequires: procps
|
||||
%if 0%{?suse_version} > 1599
|
||||
BuildRequires: systemd-devel
|
||||
%endif
|
||||
BuildRequires: samba-client
|
||||
%if 0%{?suse_version}
|
||||
%if 0%{?suse_version} > 1020
|
||||
@ -1139,6 +1144,7 @@ done
|
||||
%patch129 -p1
|
||||
%patch130 -p1
|
||||
%patch131 -p1
|
||||
%patch132 -p1
|
||||
find -type f -exec chmod 644 {} +
|
||||
|
||||
%build
|
||||
|
78
systemd-not-utmp.patch
Normal file
78
systemd-not-utmp.patch
Normal file
@ -0,0 +1,78 @@
|
||||
--- monitoring-plugins-2.3.3.old/configure.ac 2023-02-01 14:40:55.000000000 +0100
|
||||
+++ monitoring-plugins-2.3.3/configure.ac 2023-06-15 16:21:19.637049416 +0200
|
||||
@@ -328,6 +328,25 @@
|
||||
LIBS="$_SAVEDLIBS"
|
||||
])
|
||||
|
||||
+
|
||||
+AC_ARG_WITH([systemd], [AS_HELP_STRING([--without-systemd], [Skips systemd support])])
|
||||
+
|
||||
+dnl Check for libsystemd
|
||||
+AS_IF([test "x$with_systemd" != "xno"], [
|
||||
+ _SAVEDLIBS="$LIBS"
|
||||
+ AC_CHECK_LIB(systemd,sd_get_sessions,,,-lsystemd)
|
||||
+ if test "$ac_cv_lib_systemd_sd_get_sessions" = "yes"; then
|
||||
+ SYSTEMDLIBS="-lsystemd"
|
||||
+ SYSTEMDINCLUDE=""
|
||||
+ AC_SUBST(SYSTEMDLIBS)
|
||||
+ AC_SUBST(SYSTEMDINCLUDE)
|
||||
+ else
|
||||
+ AC_MSG_WARN([Skipping systemd support])
|
||||
+ fi
|
||||
+ LIBS="$_SAVEDLIBS"
|
||||
+])
|
||||
+
|
||||
+
|
||||
dnl Check for headers used by check_ide_smart
|
||||
case $host in
|
||||
*linux*)
|
||||
diff -wur monitoring-plugins-2.3.3.old/plugins/check_users.c monitoring-plugins-2.3.3/plugins/check_users.c
|
||||
--- monitoring-plugins-2.3.3.old/plugins/check_users.c 2023-02-01 14:40:55.000000000 +0100
|
||||
+++ monitoring-plugins-2.3.3/plugins/check_users.c 2023-06-15 16:16:34.879700400 +0200
|
||||
@@ -48,6 +48,11 @@
|
||||
# include "popen.h"
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE_LIBSYSTEMD
|
||||
+#include <systemd/sd-daemon.h>
|
||||
+#include <systemd/sd-login.h>
|
||||
+#endif
|
||||
+
|
||||
#define possibly_set(a,b) ((a) == 0 ? (b) : 0)
|
||||
|
||||
int process_arguments (int, char **);
|
||||
@@ -115,6 +120,11 @@
|
||||
|
||||
WTSFreeMemory(wtsinfo);
|
||||
#elif HAVE_UTMPX_H
|
||||
+#ifdef HAVE_LIBSYSTEMD
|
||||
+ if (sd_booted () > 0)
|
||||
+ users = sd_get_sessions (NULL);
|
||||
+ else {
|
||||
+#endif
|
||||
/* get currently logged users from utmpx */
|
||||
setutxent ();
|
||||
|
||||
@@ -123,6 +133,9 @@
|
||||
users++;
|
||||
|
||||
endutxent ();
|
||||
+#ifdef HAVE_LIBSYSTEMD
|
||||
+ }
|
||||
+#endif
|
||||
#else
|
||||
/* run the command */
|
||||
child_process = spopen (WHO_COMMAND);
|
||||
Nur in monitoring-plugins-2.3.3/plugins: check_users.c~.
|
||||
diff -wur monitoring-plugins-2.3.3.old/plugins/Makefile.am monitoring-plugins-2.3.3/plugins/Makefile.am
|
||||
--- monitoring-plugins-2.3.3.old/plugins/Makefile.am 2023-02-01 14:40:55.000000000 +0100
|
||||
+++ monitoring-plugins-2.3.3/plugins/Makefile.am 2023-06-15 16:23:36.925699810 +0200
|
||||
@@ -112,7 +112,7 @@
|
||||
check_time_LDADD = $(NETLIBS)
|
||||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
-check_users_LDADD = $(BASEOBJS) $(WTSAPI32LIBS)
|
||||
+check_users_LDADD = $(BASEOBJS) $(WTSAPI32LIBS) $(SYSTEMDLIBS)
|
||||
check_by_ssh_LDADD = $(NETLIBS)
|
||||
check_ide_smart_LDADD = $(BASEOBJS)
|
||||
negate_LDADD = $(BASEOBJS)
|
Loading…
Reference in New Issue
Block a user