- move systemd notification before the chroot() call

OBS-URL: https://build.opensuse.org/package/show/network:utilities/openslp?expand=0&rev=59
This commit is contained in:
Michael Schröder 2018-04-11 12:43:01 +00:00 committed by Git OBS Bridge
parent 4ec7405114
commit 94bba6a0e9
2 changed files with 32 additions and 23 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Apr 11 14:39:03 CEST 2018 - mls@suse.de
- move systemd notification before the chroot() call, otherwise
the notify function cannot reach systend's unix domain socket
[bnc#1089097]
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Mar 1 16:59:01 CET 2018 - mls@suse.de Thu Mar 1 16:59:01 CET 2018 - mls@suse.de

View File

@ -1,24 +1,5 @@
--- slpd/slpd_main.c.orig --- ./configure.ac.orig 2013-06-08 04:58:54.000000000 +0000
+++ slpd/slpd_main.c +++ ./configure.ac 2018-04-11 12:36:14.299642065 +0000
@@ -59,6 +59,8 @@
#include "slp_net.h"
#include "slp_network.h"
+#include <systemd/sd-daemon.h>
+
int G_SIGALRM;
int G_SIGTERM;
int G_SIGHUP;
@@ -748,6 +750,7 @@ int main(int argc, char * argv[])
alarm(2);
/* Main loop */
+ sd_notify(0, "READY=1");
SLPDLog("Startup complete entering main run loop ...\n\n");
G_SIGALRM = 0;
G_SIGTERM = 0;
--- configure.ac.orig
+++ configure.ac
@@ -35,6 +35,10 @@ AC_CHECK_LIB([nsl], [gethostbyname]) @@ -35,6 +35,10 @@ AC_CHECK_LIB([nsl], [gethostbyname])
AC_CHECK_LIB([m], [log10]) AC_CHECK_LIB([m], [log10])
AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([pthread], [pthread_create])
@ -30,8 +11,8 @@
# #
# Checks for header files # Checks for header files
# #
--- slpd/Makefile.am.orig --- ./slpd/Makefile.am.orig 2018-04-11 12:35:51.810698096 +0000
+++ slpd/Makefile.am +++ ./slpd/Makefile.am 2018-04-11 12:36:14.300642062 +0000
@@ -95,5 +95,5 @@ noinst_HEADERS = \ @@ -95,5 +95,5 @@ noinst_HEADERS = \
slpd_initda.h slpd_initda.h
@ -39,3 +20,24 @@
-slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la -slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la
+slpd_LDADD = $(SYSTEMD_LIBS) ../common/libcommonslpd.la ../libslpattr/libslpattr.la +slpd_LDADD = $(SYSTEMD_LIBS) ../common/libcommonslpd.la ../libslpattr/libslpattr.la
--- ./slpd/slpd_main.c.orig 2018-04-11 12:35:51.814698086 +0000
+++ ./slpd/slpd_main.c 2018-04-11 12:38:04.513363806 +0000
@@ -59,6 +59,8 @@
#include "slp_net.h"
#include "slp_network.h"
+#include <systemd/sd-daemon.h>
+
int G_SIGALRM;
int G_SIGTERM;
int G_SIGHUP;
@@ -704,6 +706,9 @@ int main(int argc, char * argv[])
/* init watcher */
SLPDDatabaseWatcher();
+ /* tell systemd what we are ready */
+ sd_notify(0, "READY=1");
+
/* drop privileges to reduce security risk */
if (DropPrivileges())
SLPDFatal("Could not drop privileges\n");