From 9731a90bce83501b9e7423d476acafbafb090cdaa4e0397de8276dca12afb9bf Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Sun, 5 Dec 2010 22:00:28 +0000 Subject: [PATCH 1/6] Updating link to change in openSUSE:Factory/rsyslog revision 19.0 OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=1a0a92075880d5ae62176044d7b4ab35 --- rsyslog.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rsyslog.spec b/rsyslog.spec index f72911d..4fd1c31 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -1,5 +1,5 @@ # -# spec file for package rsyslog (Version 5.6.1) +# spec file for package rsyslog (Version 5.6.2) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -21,8 +21,8 @@ Name: rsyslog Summary: The enhanced syslogd for Linux and Unix Version: 5.6.2 +Release: 1 %define upstream_version 5.6.2 -Release: 0 # add %define build_with_relp 1 to enable relp on < 11.3, e.g. # via %define build_with_relp 1 in _link file. %define with_relp 0%{?suse_version} >= 1130 || 0%{?build_with_relp:1} From 84fe257603734b536323af640512be155b3fca1c7089d4078d683688c63ef881 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Thu, 20 Jan 2011 14:11:45 +0000 Subject: [PATCH 2/6] - Improved systemd socket activation support to allow multiple unix sockets and activation in forking mode (bnc#656197). OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=34 --- rsyslog-systemd-integration.bnc656104.diff | 495 +++++++++++++++++---- rsyslog.changes | 6 + 2 files changed, 415 insertions(+), 86 deletions(-) diff --git a/rsyslog-systemd-integration.bnc656104.diff b/rsyslog-systemd-integration.bnc656104.diff index 9f3a69e..53d50f2 100644 --- a/rsyslog-systemd-integration.bnc656104.diff +++ b/rsyslog-systemd-integration.bnc656104.diff @@ -1,57 +1,39 @@ -commit c5132c84fc1a678b5d93fcc430871c141110b82c -Merge: c4026ec f9a4091 -Author: Marius Tomaschewski -Date: Fri Dec 3 18:07:40 2010 +0100 +From 8b7ca000dec71f6dcb73a8ab738093c17bd293c1 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 7 Sep 2010 13:06:04 +0200 +Subject: [PATCH 1/4] acquire /dev/log socket optionally from systemd - Merge branch 'v5.6.1-systemd1' into v5.6.2-systemd1 +[skipped whitespace-only changes -- mt@suse.de] +--- + ChangeLog | 2 + + plugins/imuxsock/Makefile.am | 2 +- + plugins/imuxsock/imuxsock.c | 44 ++++++++++++++++++++++++++++++++++++++++- + runtime/Makefile.am | 5 ++++ + tools/syslogd.c | 3 ++ + 5 files changed, 53 insertions(+), 3 deletions(-) -commit f9a409137bdcd04ebf4851a23f573c436a14e5b2 -Author: Rainer Gerhards -Date: Wed Sep 8 12:46:03 2010 +0200 - - moved systemd interface to rsyslog convenience lib - - Mostly a refresh of sd-daemon.[ch] from its source plus some make file changes. - We now have systemd interfaces inside rsyslog, so that all plugins interested can - call the interfaces. Seems not to be totally necessary right now, but will help - in the long term. - -commit be3d81ee54088180a657ac37899d1def8ef4b36c -Author: Rainer Gerhards -Date: Tue Sep 7 14:19:05 2010 +0200 - - added forgotten files - -commit 8b7ca000dec71f6dcb73a8ab738093c17bd293c1 -Author: Lennart Poettering -Date: Tue Sep 7 13:06:04 2010 +0200 - - acquire /dev/log socket optionally from systemd - - [skipped whitespace-only changes -- mt@suse.de] diff --git a/ChangeLog b/ChangeLog -index ca13d48..1ea95b2 100644 +index 506650d..4d4c17c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +- acquire /dev/log socket optionally from systemd + thanks to Lennart Poettering for this patch --------------------------------------------------------------------------- - Version 5.6.2 [V5-STABLE] (rgerhards), 2010-11-30 - - bugfix: compile failed on systems without epoll_create1() + Version 5.6.1 [V5-STABLE] (rgerhards), 2010-11-24 + - bugfix(important): problem in TLS handling could cause rsyslog to loop diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am -index a2fe0ba..28f9f9e 100644 +index a2fe0ba..f39faad 100644 --- a/plugins/imuxsock/Makefile.am +++ b/plugins/imuxsock/Makefile.am @@ -1,6 +1,6 @@ pkglib_LTLIBRARIES = imuxsock.la - imuxsock_la_SOURCES = imuxsock.c --imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) -+imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) +-imuxsock_la_SOURCES = imuxsock.c ++imuxsock_la_SOURCES = imuxsock.c ../../runtime/sd-daemon.c ../../runtime/sd-daemon.h + imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) imuxsock_la_LDFLAGS = -module -avoid-version --imuxsock_la_LIBADD = -+imuxsock_la_LIBADD = $(RSRT_LIBS) + imuxsock_la_LIBADD = diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index 046f12f..89bb50b 100644 --- a/plugins/imuxsock/imuxsock.c @@ -122,10 +104,10 @@ index 046f12f..89bb50b 100644 unlink((char*) funixn[i]); /* free no longer needed string */ diff --git a/runtime/Makefile.am b/runtime/Makefile.am -index b700eae..27c56a2 100644 +index f7db3e3..ef11949 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am -@@ -82,6 +82,8 @@ librsyslog_la_SOURCES = \ +@@ -81,6 +81,8 @@ librsyslog_la_SOURCES = \ prop.h \ cfsysline.c \ cfsysline.h \ @@ -134,32 +116,56 @@ index b700eae..27c56a2 100644 \ \ ../action.h \ -@@ -100,9 +102,9 @@ librsyslog_la_SOURCES = \ - # runtime or will no longer be needed. -- rgerhards, 2008-06-13 - - if WITH_MODDIRS --librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) -+librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) - else --librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) -+librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) - endif - #librsyslog_la_LDFLAGS = -module -avoid-version - librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS) -@@ -178,3 +180,6 @@ lmnsd_gtls_la_LDFLAGS = -module -avoid-version +@@ -177,3 +179,6 @@ lmnsd_gtls_la_LDFLAGS = -module -avoid-version lmnsd_gtls_la_LIBADD = $(GNUTLS_LIBS) endif +update-systemd: + curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c + curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h > sd-daemon.h +diff --git a/tools/syslogd.c b/tools/syslogd.c +index 2e4ea5d..245ebe3 100644 +--- a/tools/syslogd.c ++++ b/tools/syslogd.c +@@ -135,6 +135,7 @@ + #include "net.h" + #include "vm.h" + #include "prop.h" ++#include "sd-daemon.h" + + /* definitions for objects we access */ + DEFobjCurrIf(obj) +@@ -2431,6 +2432,8 @@ doGlblProcessInit(void) + num_fds = getdtablesize(); + close(0); + /* we keep stdout and stderr open in case we have to emit something */ ++ ++ if (sd_listen_fds(0) <= 0) + for (i = 3; i < num_fds; i++) + (void) close(i); + untty(); +-- +1.7.1 + +From be3d81ee54088180a657ac37899d1def8ef4b36c Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Tue, 7 Sep 2010 14:19:05 +0200 +Subject: [PATCH 2/4] added forgotten files + +--- + runtime/sd-daemon.c | 448 +++++++++++++++++++++++++++++++++++++++++++++++++++ + runtime/sd-daemon.h | 257 +++++++++++++++++++++++++++++ + 2 files changed, 705 insertions(+), 0 deletions(-) + create mode 100644 runtime/sd-daemon.c + create mode 100644 runtime/sd-daemon.h + diff --git a/runtime/sd-daemon.c b/runtime/sd-daemon.c new file mode 100644 -index 0000000..9c23b91 +index 0000000..5df70e3 --- /dev/null +++ b/runtime/sd-daemon.c -@@ -0,0 +1,435 @@ -+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +@@ -0,0 +1,448 @@ ++/*-*- Mode: C; c-basic-offset: 8 -*-*/ + +/*** + Copyright 2010 Lennart Poettering @@ -486,13 +492,18 @@ index 0000000..9c23b91 +} + +int sd_notify(int unset_environment, const char *state) { -+#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) ++#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + int fd = -1, r; + struct msghdr msghdr; + struct iovec iovec; + union sockaddr_union sockaddr; ++ struct ucred *ucred; ++ union { ++ struct cmsghdr cmsghdr; ++ uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; ++ } control; + const char *e; + + if (!state) { @@ -525,15 +536,23 @@ index 0000000..9c23b91 + iovec.iov_base = (char*) state; + iovec.iov_len = strlen(state); + ++ memset(&control, 0, sizeof(control)); ++ control.cmsghdr.cmsg_level = SOL_SOCKET; ++ control.cmsghdr.cmsg_type = SCM_CREDENTIALS; ++ control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred)); ++ ++ ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr); ++ ucred->pid = getpid(); ++ ucred->uid = getuid(); ++ ucred->gid = getgid(); ++ + memset(&msghdr, 0, sizeof(msghdr)); + msghdr.msg_name = &sockaddr; -+ msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); -+ -+ if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) -+ msghdr.msg_namelen = sizeof(struct sockaddr_un); -+ ++ msghdr.msg_namelen = sizeof(struct sockaddr_un); + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; ++ msghdr.msg_control = &control; ++ msghdr.msg_controllen = control.cmsghdr.cmsg_len; + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { + r = -errno; @@ -585,10 +604,10 @@ index 0000000..9c23b91 + /* We simply test whether the systemd cgroup hierarchy is + * mounted */ + -+ if (lstat("/sys/fs/cgroup", &a) < 0) ++ if (lstat("/cgroup", &a) < 0) + return 0; + -+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0) ++ if (lstat("/cgroup/systemd", &b) < 0) + return 0; + + return a.st_dev != b.st_dev; @@ -596,11 +615,11 @@ index 0000000..9c23b91 +} diff --git a/runtime/sd-daemon.h b/runtime/sd-daemon.h new file mode 100644 -index 0000000..45aac8b +index 0000000..fd6221f --- /dev/null +++ b/runtime/sd-daemon.h -@@ -0,0 +1,261 @@ -+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +@@ -0,0 +1,257 @@ ++/*-*- Mode: C; c-basic-offset: 8 -*-*/ + +#ifndef foosddaemonhfoo +#define foosddaemonhfoo @@ -669,13 +688,9 @@ index 0000000..45aac8b + See sd-daemon(7) for more information. +*/ + -+#if (__GNUC__ >= 4) ++#if __GNUC__ >= 4 +#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) -+# if defined(SD_EXPORT_SYMBOLS) -+# define _sd_hidden_ -+# else -+# define _sd_hidden_ __attribute__ ((visibility("hidden"))) -+# endif ++#define _sd_hidden_ __attribute__ ((visibility("hidden"))) +#else +#define _sd_printf_attr_(a,b) +#define _sd_hidden_ @@ -777,7 +792,7 @@ index 0000000..45aac8b + +/* + Informs systemd about changed daemon state. This takes a number of -+ newline separated environment-style variable assignments in a ++ newline seperated environment-style variable assignments in a + string. The following variables are known: + + READY=1 Tells systemd that daemon startup is finished (only @@ -861,24 +876,332 @@ index 0000000..45aac8b +#endif + +#endif +-- +1.7.1 + +From f9a409137bdcd04ebf4851a23f573c436a14e5b2 Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Wed, 8 Sep 2010 12:46:03 +0200 +Subject: [PATCH 3/4] moved systemd interface to rsyslog convenience lib + +Mostly a refresh of sd-daemon.[ch] from its source plus some make file changes. +We now have systemd interfaces inside rsyslog, so that all plugins interested can +call the interfaces. Seems not to be totally necessary right now, but will help +in the long term. +--- + plugins/imuxsock/Makefile.am | 6 +++--- + runtime/Makefile.am | 4 ++-- + runtime/sd-daemon.c | 31 +++++++++---------------------- + runtime/sd-daemon.h | 12 ++++++++---- + 4 files changed, 22 insertions(+), 31 deletions(-) + +diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am +index f39faad..28f9f9e 100644 +--- a/plugins/imuxsock/Makefile.am ++++ b/plugins/imuxsock/Makefile.am +@@ -1,6 +1,6 @@ + pkglib_LTLIBRARIES = imuxsock.la + +-imuxsock_la_SOURCES = imuxsock.c ../../runtime/sd-daemon.c ../../runtime/sd-daemon.h +-imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) ++imuxsock_la_SOURCES = imuxsock.c ++imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) + imuxsock_la_LDFLAGS = -module -avoid-version +-imuxsock_la_LIBADD = ++imuxsock_la_LIBADD = $(RSRT_LIBS) +diff --git a/runtime/Makefile.am b/runtime/Makefile.am +index ef11949..5b2598b 100644 +--- a/runtime/Makefile.am ++++ b/runtime/Makefile.am +@@ -101,9 +101,9 @@ librsyslog_la_SOURCES = \ + # runtime or will no longer be needed. -- rgerhards, 2008-06-13 + + if WITH_MODDIRS +-librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) ++librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) + else +-librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) ++librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) + endif + #librsyslog_la_LDFLAGS = -module -avoid-version + librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS) +diff --git a/runtime/sd-daemon.c b/runtime/sd-daemon.c +index 5df70e3..9c23b91 100644 +--- a/runtime/sd-daemon.c ++++ b/runtime/sd-daemon.c +@@ -1,4 +1,4 @@ +-/*-*- Mode: C; c-basic-offset: 8 -*-*/ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + + /*** + Copyright 2010 Lennart Poettering +@@ -325,18 +325,13 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t + } + + int sd_notify(int unset_environment, const char *state) { +-#if defined(DISABLE_SYSTEMD) || !defined(__linux__) ++#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) + return 0; + #else + int fd = -1, r; + struct msghdr msghdr; + struct iovec iovec; + union sockaddr_union sockaddr; +- struct ucred *ucred; +- union { +- struct cmsghdr cmsghdr; +- uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; +- } control; + const char *e; + + if (!state) { +@@ -369,23 +364,15 @@ int sd_notify(int unset_environment, const char *state) { + iovec.iov_base = (char*) state; + iovec.iov_len = strlen(state); + +- memset(&control, 0, sizeof(control)); +- control.cmsghdr.cmsg_level = SOL_SOCKET; +- control.cmsghdr.cmsg_type = SCM_CREDENTIALS; +- control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred)); +- +- ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr); +- ucred->pid = getpid(); +- ucred->uid = getuid(); +- ucred->gid = getgid(); +- + memset(&msghdr, 0, sizeof(msghdr)); + msghdr.msg_name = &sockaddr; +- msghdr.msg_namelen = sizeof(struct sockaddr_un); ++ msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); ++ ++ if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) ++ msghdr.msg_namelen = sizeof(struct sockaddr_un); ++ + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; +- msghdr.msg_control = &control; +- msghdr.msg_controllen = control.cmsghdr.cmsg_len; + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { + r = -errno; +@@ -437,10 +424,10 @@ int sd_booted(void) { + /* We simply test whether the systemd cgroup hierarchy is + * mounted */ + +- if (lstat("/cgroup", &a) < 0) ++ if (lstat("/sys/fs/cgroup", &a) < 0) + return 0; + +- if (lstat("/cgroup/systemd", &b) < 0) ++ if (lstat("/sys/fs/cgroup/systemd", &b) < 0) + return 0; + + return a.st_dev != b.st_dev; +diff --git a/runtime/sd-daemon.h b/runtime/sd-daemon.h +index fd6221f..45aac8b 100644 +--- a/runtime/sd-daemon.h ++++ b/runtime/sd-daemon.h +@@ -1,4 +1,4 @@ +-/*-*- Mode: C; c-basic-offset: 8 -*-*/ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + + #ifndef foosddaemonhfoo + #define foosddaemonhfoo +@@ -67,9 +67,13 @@ extern "C" { + See sd-daemon(7) for more information. + */ + +-#if __GNUC__ >= 4 ++#if (__GNUC__ >= 4) + #define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) +-#define _sd_hidden_ __attribute__ ((visibility("hidden"))) ++# if defined(SD_EXPORT_SYMBOLS) ++# define _sd_hidden_ ++# else ++# define _sd_hidden_ __attribute__ ((visibility("hidden"))) ++# endif + #else + #define _sd_printf_attr_(a,b) + #define _sd_hidden_ +@@ -171,7 +175,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t + + /* + Informs systemd about changed daemon state. This takes a number of +- newline seperated environment-style variable assignments in a ++ newline separated environment-style variable assignments in a + string. The following variables are known: + + READY=1 Tells systemd that daemon startup is finished (only +-- +1.7.1 + +From 020e414396b9ed4d005b6b0f6fb6567fe954230c Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 20 Jan 2011 15:08:08 +0100 +Subject: [PATCH 4/4] Improved systemd socket activation support + +Support for multiple unix sockets and activation in forking mode +--- + plugins/imuxsock/imuxsock.c | 72 ++++++++++++++++++------------------------ + tools/syslogd.c | 36 ++++++++++++++++++++- + 2 files changed, 65 insertions(+), 43 deletions(-) + +diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c +index 89bb50b..fc6b1e7 100644 +--- a/plugins/imuxsock/imuxsock.c ++++ b/plugins/imuxsock/imuxsock.c +@@ -87,6 +87,7 @@ static prop_t *funixHName[MAXFUNIX] = { NULL, }; /* host-name override - if set, + static int funixFlowCtl[MAXFUNIX] = { eFLOWCTL_NO_DELAY, }; /* flow control settings for this socket */ + static int funix[MAXFUNIX] = { -1, }; /* read-only after startup */ + static int nfunix = 1; /* number of Unix sockets open / read-only after startup */ ++static int sd_fds = 0; /* number of systemd activated sockers */ + + /* config settings */ + static int bOmitLocalLogging = 0; +@@ -191,39 +192,19 @@ static int create_unix_socket(const char *path, int bCreatePath) + if (path[0] == '\0') + return -1; + +- if (strcmp(path, _PATH_LOG) == 0) { +- int r; +- +- /* Check whether an FD was passed in from systemd. If +- * so, it's the /dev/log socket, so use it. */ +- +- r = sd_listen_fds(0); +- if (r < 0) { +- errmsg.LogError(-r, NO_ERRCODE, "Failed to acquire systemd socket"); +- return -1; +- } +- +- if (r > 1) { +- errmsg.LogError(EINVAL, NO_ERRCODE, "Wrong number of systemd sockets passed"); +- return -1; +- } +- +- if (r == 1) { +- fd = SD_LISTEN_FDS_START; +- r = sd_is_socket_unix(fd, SOCK_DGRAM, -1, _PATH_LOG, 0); +- if (r < 0) { +- errmsg.LogError(-r, NO_ERRCODE, "Failed to verify systemd socket type"); +- return -1; +- } +- +- if (!r) { +- errmsg.LogError(EINVAL, NO_ERRCODE, "Passed systemd socket of wrong type"); +- return -1; +- } +- +- return fd; +- } +- } ++ if (sd_fds > 0) { ++ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + sd_fds; fd++) { ++ if( sd_is_socket_unix(fd, SOCK_DGRAM, -1, path, 0) == 1) { ++ /* ok, it matches -- just use as is */ ++ return fd; ++ } ++ /* ++ * otherwise it either didn't matched *this* socket and ++ * we just continue to check the next one or there were ++ * an error and we will recreate it bellow. ++ */ ++ } ++ } + + unlink(path); + +@@ -406,6 +387,11 @@ CODESTARTwillRun + if(pLogSockName != NULL) + funixn[0] = pLogSockName; + ++ sd_fds = sd_listen_fds(0); ++ if (sd_fds < 0) { ++ errmsg.LogError(-sd_fds, NO_ERRCODE, "Failed to acquire systemd sockets"); ++ } ++ + /* initialize and return if will run or not */ + for (i = startIndexUxLocalSockets ; i < nfunix ; i++) { + if ((funix[i] = create_unix_socket((char*) funixn[i], funixCreateSockPath[i])) != -1) +@@ -430,15 +416,19 @@ CODESTARTafterRun + if (funix[i] != -1) + close(funix[i]); + +- /* Clean-up files. If systemd passed us a socket it is +- * systemd's job to clean it up.*/ +- if (sd_listen_fds(0) > 0) +- i = 1; +- else +- i = startIndexUxLocalSockets; +- for(; i < nfunix; i++) +- if (funixn[i] && funix[i] != -1) ++ /* Clean-up files. If systemd passed us a socket it is ++ * systemd's job to clean it up.*/ ++ for(i = startIndexUxLocalSockets; i < nfunix; i++) { ++ if (funixn[i] && funix[i] != -1) { ++ if (sd_fds > 0 && ++ funix[i] >= SD_LISTEN_FDS_START && ++ funix[i] < SD_LISTEN_FDS_START + sd_fds) ++ continue; ++ + unlink((char*) funixn[i]); ++ } ++ } ++ + /* free no longer needed string */ + free(pLogSockName); + free(pLogHostName); diff --git a/tools/syslogd.c b/tools/syslogd.c -index 2e4ea5d..245ebe3 100644 +index 245ebe3..701036d 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c -@@ -135,6 +135,7 @@ - #include "net.h" - #include "vm.h" - #include "prop.h" -+#include "sd-daemon.h" - - /* definitions for objects we access */ - DEFobjCurrIf(obj) -@@ -2431,6 +2432,8 @@ doGlblProcessInit(void) +@@ -2429,12 +2429,44 @@ doGlblProcessInit(void) + */ + exit(1); /* "good" exit - after forking, not diasabling anything */ + } ++ num_fds = getdtablesize(); close(0); /* we keep stdout and stderr open in case we have to emit something */ ++ i = 3; + -+ if (sd_listen_fds(0) <= 0) - for (i = 3; i < num_fds; i++) ++ /* if (sd_booted()) */ { ++ const char *e; ++ char buf[24] = { '\0' }; ++ char *p = NULL; ++ unsigned long l; ++ int sd_fds; ++ ++ /* fork & systemd socket activation: ++ * fetch listen pid and update to ours, ++ * when it is set to pid of our parent. ++ */ ++ if ( (e = getenv("LISTEN_PID"))) { ++ errno = 0; ++ l = strtoul(e, &p, 10); ++ if (errno == 0 && l > 0 && (!p || !*p)) { ++ if (getppid() == (pid_t)l) { ++ snprintf(buf, sizeof(buf), "%d", ++ getpid()); ++ setenv("LISTEN_PID", buf, 1); ++ } ++ } ++ } + +- if (sd_listen_fds(0) <= 0) +- for (i = 3; i < num_fds; i++) ++ /* ++ * close only all further fds, except ++ * of the fds provided by systemd. ++ */ ++ sd_fds = sd_listen_fds(0); ++ if (sd_fds > 0) ++ i = SD_LISTEN_FDS_START + sd_fds; ++ } ++ for ( ; i < num_fds; i++) (void) close(i); untty(); + } +-- +1.7.1 + diff --git a/rsyslog.changes b/rsyslog.changes index 15d39d1..7f1c79e 100644 --- a/rsyslog.changes +++ b/rsyslog.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 20 14:10:59 UTC 2011 - mt@suse.de + +- Improved systemd socket activation support to allow multiple + unix sockets and activation in forking mode (bnc#656197). + ------------------------------------------------------------------- Fri Dec 3 16:49:41 UTC 2010 - mt@suse.de From d0435add8a014dd49ea12e16e6e2201d5ceebc1497746a49666ba3952f3ea2ab Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Thu, 20 Jan 2011 14:13:37 +0000 Subject: [PATCH 3/6] Use git diff instead of format-patch... OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=35 --- rsyslog-systemd-integration.bnc656104.diff | 561 ++++++--------------- 1 file changed, 145 insertions(+), 416 deletions(-) diff --git a/rsyslog-systemd-integration.bnc656104.diff b/rsyslog-systemd-integration.bnc656104.diff index 53d50f2..248a9b3 100644 --- a/rsyslog-systemd-integration.bnc656104.diff +++ b/rsyslog-systemd-integration.bnc656104.diff @@ -1,41 +1,67 @@ -From 8b7ca000dec71f6dcb73a8ab738093c17bd293c1 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Tue, 7 Sep 2010 13:06:04 +0200 -Subject: [PATCH 1/4] acquire /dev/log socket optionally from systemd +commit 020e414396b9ed4d005b6b0f6fb6567fe954230c +Author: Marius Tomaschewski +Date: Thu Jan 20 15:08:08 2011 +0100 -[skipped whitespace-only changes -- mt@suse.de] ---- - ChangeLog | 2 + - plugins/imuxsock/Makefile.am | 2 +- - plugins/imuxsock/imuxsock.c | 44 ++++++++++++++++++++++++++++++++++++++++- - runtime/Makefile.am | 5 ++++ - tools/syslogd.c | 3 ++ - 5 files changed, 53 insertions(+), 3 deletions(-) + Improved systemd socket activation support + + Support for multiple unix sockets and activation in forking mode +commit c5132c84fc1a678b5d93fcc430871c141110b82c +Merge: c4026ec f9a4091 +Author: Marius Tomaschewski +Date: Fri Dec 3 18:07:40 2010 +0100 + + Merge branch 'v5.6.1-systemd1' into v5.6.2-systemd1 + +commit f9a409137bdcd04ebf4851a23f573c436a14e5b2 +Author: Rainer Gerhards +Date: Wed Sep 8 12:46:03 2010 +0200 + + moved systemd interface to rsyslog convenience lib + + Mostly a refresh of sd-daemon.[ch] from its source plus some make file changes. + We now have systemd interfaces inside rsyslog, so that all plugins interested can + call the interfaces. Seems not to be totally necessary right now, but will help + in the long term. + +commit be3d81ee54088180a657ac37899d1def8ef4b36c +Author: Rainer Gerhards +Date: Tue Sep 7 14:19:05 2010 +0200 + + added forgotten files + +commit 8b7ca000dec71f6dcb73a8ab738093c17bd293c1 +Author: Lennart Poettering +Date: Tue Sep 7 13:06:04 2010 +0200 + + acquire /dev/log socket optionally from systemd + + [skipped whitespace-only changes -- mt@suse.de] diff --git a/ChangeLog b/ChangeLog -index 506650d..4d4c17c 100644 +index ca13d48..1ea95b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +- acquire /dev/log socket optionally from systemd + thanks to Lennart Poettering for this patch --------------------------------------------------------------------------- - Version 5.6.1 [V5-STABLE] (rgerhards), 2010-11-24 - - bugfix(important): problem in TLS handling could cause rsyslog to loop + Version 5.6.2 [V5-STABLE] (rgerhards), 2010-11-30 + - bugfix: compile failed on systems without epoll_create1() diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am -index a2fe0ba..f39faad 100644 +index a2fe0ba..28f9f9e 100644 --- a/plugins/imuxsock/Makefile.am +++ b/plugins/imuxsock/Makefile.am @@ -1,6 +1,6 @@ pkglib_LTLIBRARIES = imuxsock.la --imuxsock_la_SOURCES = imuxsock.c -+imuxsock_la_SOURCES = imuxsock.c ../../runtime/sd-daemon.c ../../runtime/sd-daemon.h - imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) + imuxsock_la_SOURCES = imuxsock.c +-imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) ++imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) imuxsock_la_LDFLAGS = -module -avoid-version - imuxsock_la_LIBADD = +-imuxsock_la_LIBADD = ++imuxsock_la_LIBADD = $(RSRT_LIBS) diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c -index 046f12f..89bb50b 100644 +index 046f12f..fc6b1e7 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -47,6 +47,7 @@ @@ -46,68 +72,75 @@ index 046f12f..89bb50b 100644 MODULE_TYPE_INPUT -@@ -190,6 +191,40 @@ static int create_unix_socket(const char *path, int bCreatePath) +@@ -86,6 +87,7 @@ static prop_t *funixHName[MAXFUNIX] = { NULL, }; /* host-name override - if set, + static int funixFlowCtl[MAXFUNIX] = { eFLOWCTL_NO_DELAY, }; /* flow control settings for this socket */ + static int funix[MAXFUNIX] = { -1, }; /* read-only after startup */ + static int nfunix = 1; /* number of Unix sockets open / read-only after startup */ ++static int sd_fds = 0; /* number of systemd activated sockers */ + + /* config settings */ + static int bOmitLocalLogging = 0; +@@ -190,6 +192,20 @@ static int create_unix_socket(const char *path, int bCreatePath) if (path[0] == '\0') return -1; -+ if (strcmp(path, _PATH_LOG) == 0) { -+ int r; -+ -+ /* Check whether an FD was passed in from systemd. If -+ * so, it's the /dev/log socket, so use it. */ -+ -+ r = sd_listen_fds(0); -+ if (r < 0) { -+ errmsg.LogError(-r, NO_ERRCODE, "Failed to acquire systemd socket"); -+ return -1; -+ } -+ -+ if (r > 1) { -+ errmsg.LogError(EINVAL, NO_ERRCODE, "Wrong number of systemd sockets passed"); -+ return -1; -+ } -+ -+ if (r == 1) { -+ fd = SD_LISTEN_FDS_START; -+ r = sd_is_socket_unix(fd, SOCK_DGRAM, -1, _PATH_LOG, 0); -+ if (r < 0) { -+ errmsg.LogError(-r, NO_ERRCODE, "Failed to verify systemd socket type"); -+ return -1; -+ } -+ -+ if (!r) { -+ errmsg.LogError(EINVAL, NO_ERRCODE, "Passed systemd socket of wrong type"); -+ return -1; -+ } -+ -+ return fd; -+ } -+ } ++ if (sd_fds > 0) { ++ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + sd_fds; fd++) { ++ if( sd_is_socket_unix(fd, SOCK_DGRAM, -1, path, 0) == 1) { ++ /* ok, it matches -- just use as is */ ++ return fd; ++ } ++ /* ++ * otherwise it either didn't matched *this* socket and ++ * we just continue to check the next one or there were ++ * an error and we will recreate it bellow. ++ */ ++ } ++ } + unlink(path); memset(&sunx, 0, sizeof(sunx)); -@@ -395,8 +430,13 @@ CODESTARTafterRun +@@ -371,6 +387,11 @@ CODESTARTwillRun + if(pLogSockName != NULL) + funixn[0] = pLogSockName; + ++ sd_fds = sd_listen_fds(0); ++ if (sd_fds < 0) { ++ errmsg.LogError(-sd_fds, NO_ERRCODE, "Failed to acquire systemd sockets"); ++ } ++ + /* initialize and return if will run or not */ + for (i = startIndexUxLocalSockets ; i < nfunix ; i++) { + if ((funix[i] = create_unix_socket((char*) funixn[i], funixCreateSockPath[i])) != -1) +@@ -395,10 +416,19 @@ CODESTARTafterRun if (funix[i] != -1) close(funix[i]); - /* Clean-up files. */ - for(i = startIndexUxLocalSockets; i < nfunix; i++) -+ /* Clean-up files. If systemd passed us a socket it is -+ * systemd's job to clean it up.*/ -+ if (sd_listen_fds(0) > 0) -+ i = 1; -+ else -+ i = startIndexUxLocalSockets; -+ for(; i < nfunix; i++) - if (funixn[i] && funix[i] != -1) +- if (funixn[i] && funix[i] != -1) ++ /* Clean-up files. If systemd passed us a socket it is ++ * systemd's job to clean it up.*/ ++ for(i = startIndexUxLocalSockets; i < nfunix; i++) { ++ if (funixn[i] && funix[i] != -1) { ++ if (sd_fds > 0 && ++ funix[i] >= SD_LISTEN_FDS_START && ++ funix[i] < SD_LISTEN_FDS_START + sd_fds) ++ continue; ++ unlink((char*) funixn[i]); ++ } ++ } ++ /* free no longer needed string */ + free(pLogSockName); + free(pLogHostName); diff --git a/runtime/Makefile.am b/runtime/Makefile.am -index f7db3e3..ef11949 100644 +index b700eae..27c56a2 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am -@@ -81,6 +81,8 @@ librsyslog_la_SOURCES = \ +@@ -82,6 +82,8 @@ librsyslog_la_SOURCES = \ prop.h \ cfsysline.c \ cfsysline.h \ @@ -116,56 +149,32 @@ index f7db3e3..ef11949 100644 \ \ ../action.h \ -@@ -177,3 +179,6 @@ lmnsd_gtls_la_LDFLAGS = -module -avoid-version +@@ -100,9 +102,9 @@ librsyslog_la_SOURCES = \ + # runtime or will no longer be needed. -- rgerhards, 2008-06-13 + + if WITH_MODDIRS +-librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) ++librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) + else +-librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) ++librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) + endif + #librsyslog_la_LDFLAGS = -module -avoid-version + librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS) +@@ -178,3 +180,6 @@ lmnsd_gtls_la_LDFLAGS = -module -avoid-version lmnsd_gtls_la_LIBADD = $(GNUTLS_LIBS) endif +update-systemd: + curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c + curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h > sd-daemon.h -diff --git a/tools/syslogd.c b/tools/syslogd.c -index 2e4ea5d..245ebe3 100644 ---- a/tools/syslogd.c -+++ b/tools/syslogd.c -@@ -135,6 +135,7 @@ - #include "net.h" - #include "vm.h" - #include "prop.h" -+#include "sd-daemon.h" - - /* definitions for objects we access */ - DEFobjCurrIf(obj) -@@ -2431,6 +2432,8 @@ doGlblProcessInit(void) - num_fds = getdtablesize(); - close(0); - /* we keep stdout and stderr open in case we have to emit something */ -+ -+ if (sd_listen_fds(0) <= 0) - for (i = 3; i < num_fds; i++) - (void) close(i); - untty(); --- -1.7.1 - -From be3d81ee54088180a657ac37899d1def8ef4b36c Mon Sep 17 00:00:00 2001 -From: Rainer Gerhards -Date: Tue, 7 Sep 2010 14:19:05 +0200 -Subject: [PATCH 2/4] added forgotten files - ---- - runtime/sd-daemon.c | 448 +++++++++++++++++++++++++++++++++++++++++++++++++++ - runtime/sd-daemon.h | 257 +++++++++++++++++++++++++++++ - 2 files changed, 705 insertions(+), 0 deletions(-) - create mode 100644 runtime/sd-daemon.c - create mode 100644 runtime/sd-daemon.h - diff --git a/runtime/sd-daemon.c b/runtime/sd-daemon.c new file mode 100644 -index 0000000..5df70e3 +index 0000000..9c23b91 --- /dev/null +++ b/runtime/sd-daemon.c -@@ -0,0 +1,448 @@ -+/*-*- Mode: C; c-basic-offset: 8 -*-*/ +@@ -0,0 +1,435 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + Copyright 2010 Lennart Poettering @@ -492,18 +501,13 @@ index 0000000..5df70e3 +} + +int sd_notify(int unset_environment, const char *state) { -+#if defined(DISABLE_SYSTEMD) || !defined(__linux__) ++#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) + return 0; +#else + int fd = -1, r; + struct msghdr msghdr; + struct iovec iovec; + union sockaddr_union sockaddr; -+ struct ucred *ucred; -+ union { -+ struct cmsghdr cmsghdr; -+ uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; -+ } control; + const char *e; + + if (!state) { @@ -536,23 +540,15 @@ index 0000000..5df70e3 + iovec.iov_base = (char*) state; + iovec.iov_len = strlen(state); + -+ memset(&control, 0, sizeof(control)); -+ control.cmsghdr.cmsg_level = SOL_SOCKET; -+ control.cmsghdr.cmsg_type = SCM_CREDENTIALS; -+ control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred)); -+ -+ ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr); -+ ucred->pid = getpid(); -+ ucred->uid = getuid(); -+ ucred->gid = getgid(); -+ + memset(&msghdr, 0, sizeof(msghdr)); + msghdr.msg_name = &sockaddr; -+ msghdr.msg_namelen = sizeof(struct sockaddr_un); ++ msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); ++ ++ if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) ++ msghdr.msg_namelen = sizeof(struct sockaddr_un); ++ + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; -+ msghdr.msg_control = &control; -+ msghdr.msg_controllen = control.cmsghdr.cmsg_len; + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { + r = -errno; @@ -604,10 +600,10 @@ index 0000000..5df70e3 + /* We simply test whether the systemd cgroup hierarchy is + * mounted */ + -+ if (lstat("/cgroup", &a) < 0) ++ if (lstat("/sys/fs/cgroup", &a) < 0) + return 0; + -+ if (lstat("/cgroup/systemd", &b) < 0) ++ if (lstat("/sys/fs/cgroup/systemd", &b) < 0) + return 0; + + return a.st_dev != b.st_dev; @@ -615,11 +611,11 @@ index 0000000..5df70e3 +} diff --git a/runtime/sd-daemon.h b/runtime/sd-daemon.h new file mode 100644 -index 0000000..fd6221f +index 0000000..45aac8b --- /dev/null +++ b/runtime/sd-daemon.h -@@ -0,0 +1,257 @@ -+/*-*- Mode: C; c-basic-offset: 8 -*-*/ +@@ -0,0 +1,261 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#ifndef foosddaemonhfoo +#define foosddaemonhfoo @@ -688,9 +684,13 @@ index 0000000..fd6221f + See sd-daemon(7) for more information. +*/ + -+#if __GNUC__ >= 4 ++#if (__GNUC__ >= 4) +#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) -+#define _sd_hidden_ __attribute__ ((visibility("hidden"))) ++# if defined(SD_EXPORT_SYMBOLS) ++# define _sd_hidden_ ++# else ++# define _sd_hidden_ __attribute__ ((visibility("hidden"))) ++# endif +#else +#define _sd_printf_attr_(a,b) +#define _sd_hidden_ @@ -792,7 +792,7 @@ index 0000000..fd6221f + +/* + Informs systemd about changed daemon state. This takes a number of -+ newline seperated environment-style variable assignments in a ++ newline separated environment-style variable assignments in a + string. The following variables are known: + + READY=1 Tells systemd that daemon startup is finished (only @@ -876,286 +876,19 @@ index 0000000..fd6221f +#endif + +#endif --- -1.7.1 - -From f9a409137bdcd04ebf4851a23f573c436a14e5b2 Mon Sep 17 00:00:00 2001 -From: Rainer Gerhards -Date: Wed, 8 Sep 2010 12:46:03 +0200 -Subject: [PATCH 3/4] moved systemd interface to rsyslog convenience lib - -Mostly a refresh of sd-daemon.[ch] from its source plus some make file changes. -We now have systemd interfaces inside rsyslog, so that all plugins interested can -call the interfaces. Seems not to be totally necessary right now, but will help -in the long term. ---- - plugins/imuxsock/Makefile.am | 6 +++--- - runtime/Makefile.am | 4 ++-- - runtime/sd-daemon.c | 31 +++++++++---------------------- - runtime/sd-daemon.h | 12 ++++++++---- - 4 files changed, 22 insertions(+), 31 deletions(-) - -diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am -index f39faad..28f9f9e 100644 ---- a/plugins/imuxsock/Makefile.am -+++ b/plugins/imuxsock/Makefile.am -@@ -1,6 +1,6 @@ - pkglib_LTLIBRARIES = imuxsock.la - --imuxsock_la_SOURCES = imuxsock.c ../../runtime/sd-daemon.c ../../runtime/sd-daemon.h --imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) -+imuxsock_la_SOURCES = imuxsock.c -+imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) - imuxsock_la_LDFLAGS = -module -avoid-version --imuxsock_la_LIBADD = -+imuxsock_la_LIBADD = $(RSRT_LIBS) -diff --git a/runtime/Makefile.am b/runtime/Makefile.am -index ef11949..5b2598b 100644 ---- a/runtime/Makefile.am -+++ b/runtime/Makefile.am -@@ -101,9 +101,9 @@ librsyslog_la_SOURCES = \ - # runtime or will no longer be needed. -- rgerhards, 2008-06-13 - - if WITH_MODDIRS --librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) -+librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS) - else --librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) -+librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS) - endif - #librsyslog_la_LDFLAGS = -module -avoid-version - librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS) -diff --git a/runtime/sd-daemon.c b/runtime/sd-daemon.c -index 5df70e3..9c23b91 100644 ---- a/runtime/sd-daemon.c -+++ b/runtime/sd-daemon.c -@@ -1,4 +1,4 @@ --/*-*- Mode: C; c-basic-offset: 8 -*-*/ -+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - - /*** - Copyright 2010 Lennart Poettering -@@ -325,18 +325,13 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t - } - - int sd_notify(int unset_environment, const char *state) { --#if defined(DISABLE_SYSTEMD) || !defined(__linux__) -+#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) - return 0; - #else - int fd = -1, r; - struct msghdr msghdr; - struct iovec iovec; - union sockaddr_union sockaddr; -- struct ucred *ucred; -- union { -- struct cmsghdr cmsghdr; -- uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; -- } control; - const char *e; - - if (!state) { -@@ -369,23 +364,15 @@ int sd_notify(int unset_environment, const char *state) { - iovec.iov_base = (char*) state; - iovec.iov_len = strlen(state); - -- memset(&control, 0, sizeof(control)); -- control.cmsghdr.cmsg_level = SOL_SOCKET; -- control.cmsghdr.cmsg_type = SCM_CREDENTIALS; -- control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred)); -- -- ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr); -- ucred->pid = getpid(); -- ucred->uid = getuid(); -- ucred->gid = getgid(); -- - memset(&msghdr, 0, sizeof(msghdr)); - msghdr.msg_name = &sockaddr; -- msghdr.msg_namelen = sizeof(struct sockaddr_un); -+ msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); -+ -+ if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) -+ msghdr.msg_namelen = sizeof(struct sockaddr_un); -+ - msghdr.msg_iov = &iovec; - msghdr.msg_iovlen = 1; -- msghdr.msg_control = &control; -- msghdr.msg_controllen = control.cmsghdr.cmsg_len; - - if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { - r = -errno; -@@ -437,10 +424,10 @@ int sd_booted(void) { - /* We simply test whether the systemd cgroup hierarchy is - * mounted */ - -- if (lstat("/cgroup", &a) < 0) -+ if (lstat("/sys/fs/cgroup", &a) < 0) - return 0; - -- if (lstat("/cgroup/systemd", &b) < 0) -+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0) - return 0; - - return a.st_dev != b.st_dev; -diff --git a/runtime/sd-daemon.h b/runtime/sd-daemon.h -index fd6221f..45aac8b 100644 ---- a/runtime/sd-daemon.h -+++ b/runtime/sd-daemon.h -@@ -1,4 +1,4 @@ --/*-*- Mode: C; c-basic-offset: 8 -*-*/ -+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - - #ifndef foosddaemonhfoo - #define foosddaemonhfoo -@@ -67,9 +67,13 @@ extern "C" { - See sd-daemon(7) for more information. - */ - --#if __GNUC__ >= 4 -+#if (__GNUC__ >= 4) - #define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) --#define _sd_hidden_ __attribute__ ((visibility("hidden"))) -+# if defined(SD_EXPORT_SYMBOLS) -+# define _sd_hidden_ -+# else -+# define _sd_hidden_ __attribute__ ((visibility("hidden"))) -+# endif - #else - #define _sd_printf_attr_(a,b) - #define _sd_hidden_ -@@ -171,7 +175,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t - - /* - Informs systemd about changed daemon state. This takes a number of -- newline seperated environment-style variable assignments in a -+ newline separated environment-style variable assignments in a - string. The following variables are known: - - READY=1 Tells systemd that daemon startup is finished (only --- -1.7.1 - -From 020e414396b9ed4d005b6b0f6fb6567fe954230c Mon Sep 17 00:00:00 2001 -From: Marius Tomaschewski -Date: Thu, 20 Jan 2011 15:08:08 +0100 -Subject: [PATCH 4/4] Improved systemd socket activation support - -Support for multiple unix sockets and activation in forking mode ---- - plugins/imuxsock/imuxsock.c | 72 ++++++++++++++++++------------------------ - tools/syslogd.c | 36 ++++++++++++++++++++- - 2 files changed, 65 insertions(+), 43 deletions(-) - -diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c -index 89bb50b..fc6b1e7 100644 ---- a/plugins/imuxsock/imuxsock.c -+++ b/plugins/imuxsock/imuxsock.c -@@ -87,6 +87,7 @@ static prop_t *funixHName[MAXFUNIX] = { NULL, }; /* host-name override - if set, - static int funixFlowCtl[MAXFUNIX] = { eFLOWCTL_NO_DELAY, }; /* flow control settings for this socket */ - static int funix[MAXFUNIX] = { -1, }; /* read-only after startup */ - static int nfunix = 1; /* number of Unix sockets open / read-only after startup */ -+static int sd_fds = 0; /* number of systemd activated sockers */ - - /* config settings */ - static int bOmitLocalLogging = 0; -@@ -191,39 +192,19 @@ static int create_unix_socket(const char *path, int bCreatePath) - if (path[0] == '\0') - return -1; - -- if (strcmp(path, _PATH_LOG) == 0) { -- int r; -- -- /* Check whether an FD was passed in from systemd. If -- * so, it's the /dev/log socket, so use it. */ -- -- r = sd_listen_fds(0); -- if (r < 0) { -- errmsg.LogError(-r, NO_ERRCODE, "Failed to acquire systemd socket"); -- return -1; -- } -- -- if (r > 1) { -- errmsg.LogError(EINVAL, NO_ERRCODE, "Wrong number of systemd sockets passed"); -- return -1; -- } -- -- if (r == 1) { -- fd = SD_LISTEN_FDS_START; -- r = sd_is_socket_unix(fd, SOCK_DGRAM, -1, _PATH_LOG, 0); -- if (r < 0) { -- errmsg.LogError(-r, NO_ERRCODE, "Failed to verify systemd socket type"); -- return -1; -- } -- -- if (!r) { -- errmsg.LogError(EINVAL, NO_ERRCODE, "Passed systemd socket of wrong type"); -- return -1; -- } -- -- return fd; -- } -- } -+ if (sd_fds > 0) { -+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + sd_fds; fd++) { -+ if( sd_is_socket_unix(fd, SOCK_DGRAM, -1, path, 0) == 1) { -+ /* ok, it matches -- just use as is */ -+ return fd; -+ } -+ /* -+ * otherwise it either didn't matched *this* socket and -+ * we just continue to check the next one or there were -+ * an error and we will recreate it bellow. -+ */ -+ } -+ } - - unlink(path); - -@@ -406,6 +387,11 @@ CODESTARTwillRun - if(pLogSockName != NULL) - funixn[0] = pLogSockName; - -+ sd_fds = sd_listen_fds(0); -+ if (sd_fds < 0) { -+ errmsg.LogError(-sd_fds, NO_ERRCODE, "Failed to acquire systemd sockets"); -+ } -+ - /* initialize and return if will run or not */ - for (i = startIndexUxLocalSockets ; i < nfunix ; i++) { - if ((funix[i] = create_unix_socket((char*) funixn[i], funixCreateSockPath[i])) != -1) -@@ -430,15 +416,19 @@ CODESTARTafterRun - if (funix[i] != -1) - close(funix[i]); - -- /* Clean-up files. If systemd passed us a socket it is -- * systemd's job to clean it up.*/ -- if (sd_listen_fds(0) > 0) -- i = 1; -- else -- i = startIndexUxLocalSockets; -- for(; i < nfunix; i++) -- if (funixn[i] && funix[i] != -1) -+ /* Clean-up files. If systemd passed us a socket it is -+ * systemd's job to clean it up.*/ -+ for(i = startIndexUxLocalSockets; i < nfunix; i++) { -+ if (funixn[i] && funix[i] != -1) { -+ if (sd_fds > 0 && -+ funix[i] >= SD_LISTEN_FDS_START && -+ funix[i] < SD_LISTEN_FDS_START + sd_fds) -+ continue; -+ - unlink((char*) funixn[i]); -+ } -+ } -+ - /* free no longer needed string */ - free(pLogSockName); - free(pLogHostName); diff --git a/tools/syslogd.c b/tools/syslogd.c -index 245ebe3..701036d 100644 +index 2e4ea5d..701036d 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c -@@ -2429,12 +2429,44 @@ doGlblProcessInit(void) +@@ -135,6 +135,7 @@ + #include "net.h" + #include "vm.h" + #include "prop.h" ++#include "sd-daemon.h" + + /* definitions for objects we access */ + DEFobjCurrIf(obj) +@@ -2428,10 +2429,44 @@ doGlblProcessInit(void) */ exit(1); /* "good" exit - after forking, not diasabling anything */ } @@ -1163,6 +896,7 @@ index 245ebe3..701036d 100644 num_fds = getdtablesize(); close(0); /* we keep stdout and stderr open in case we have to emit something */ +- for (i = 3; i < num_fds; i++) + i = 3; + + /* if (sd_booted()) */ { @@ -1187,9 +921,7 @@ index 245ebe3..701036d 100644 + } + } + } - -- if (sd_listen_fds(0) <= 0) -- for (i = 3; i < num_fds; i++) ++ + /* + * close only all further fds, except + * of the fds provided by systemd. @@ -1202,6 +934,3 @@ index 245ebe3..701036d 100644 (void) close(i); untty(); } --- -1.7.1 - From 994b3291fa1f6d60a4099452546785ae6b82cdd4841e3f21b0b2cc384d9b2f5d Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Wed, 2 Feb 2011 16:11:38 +0000 Subject: [PATCH 4/6] - update to 5.6.3 (v5-stable) with following bugfixes (digest): * action processor released mememory too early, resulting in potential issue in retry cases (very unlikely). * batch processing flagged invalid message as "bad" under some circumstances * unitialized variable could cause issues under extreme conditions plus some minor nits. * batches which had actions in error were not properly retried in all cases * imfile did duplicate messages under some circumstances - enabled plain tcp input, unix socket output, last message parser and the libdbi module as separate package. OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=36 --- rsyslog-5.6.2.tar.bz2 | 3 - rsyslog-5.6.3.tar.bz2 | 3 + rsyslog-systemd-integration.bnc656104.diff | 15 ++-- rsyslog.changes | 16 +++++ rsyslog.spec | 83 ++++++++++++++++------ 5 files changed, 84 insertions(+), 36 deletions(-) delete mode 100644 rsyslog-5.6.2.tar.bz2 create mode 100644 rsyslog-5.6.3.tar.bz2 diff --git a/rsyslog-5.6.2.tar.bz2 b/rsyslog-5.6.2.tar.bz2 deleted file mode 100644 index 1fda951..0000000 --- a/rsyslog-5.6.2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:df96d0a1e31c79367b7c3ab29806515b2d5ea8acd2c184615897ea821506b118 -size 1846314 diff --git a/rsyslog-5.6.3.tar.bz2 b/rsyslog-5.6.3.tar.bz2 new file mode 100644 index 0000000..fb7dc2b --- /dev/null +++ b/rsyslog-5.6.3.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:160d000a5200b4ef6451330d2f30509ef2c974f1850b834221ad8704c21c71d3 +size 1846846 diff --git a/rsyslog-systemd-integration.bnc656104.diff b/rsyslog-systemd-integration.bnc656104.diff index 248a9b3..5bff472 100644 --- a/rsyslog-systemd-integration.bnc656104.diff +++ b/rsyslog-systemd-integration.bnc656104.diff @@ -6,13 +6,6 @@ Date: Thu Jan 20 15:08:08 2011 +0100 Support for multiple unix sockets and activation in forking mode -commit c5132c84fc1a678b5d93fcc430871c141110b82c -Merge: c4026ec f9a4091 -Author: Marius Tomaschewski -Date: Fri Dec 3 18:07:40 2010 +0100 - - Merge branch 'v5.6.1-systemd1' into v5.6.2-systemd1 - commit f9a409137bdcd04ebf4851a23f573c436a14e5b2 Author: Rainer Gerhards Date: Wed Sep 8 12:46:03 2010 +0200 @@ -38,15 +31,15 @@ Date: Tue Sep 7 13:06:04 2010 +0200 [skipped whitespace-only changes -- mt@suse.de] diff --git a/ChangeLog b/ChangeLog -index ca13d48..1ea95b2 100644 +index 72e2946..8b7c7b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +- acquire /dev/log socket optionally from systemd + thanks to Lennart Poettering for this patch --------------------------------------------------------------------------- - Version 5.6.2 [V5-STABLE] (rgerhards), 2010-11-30 - - bugfix: compile failed on systems without epoll_create1() + Version 5.6.3 [V5-STABLE] (rgerhards), 2011-01-26 + - bugfix: action processor released mememory too early, resulting in diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am index a2fe0ba..28f9f9e 100644 --- a/plugins/imuxsock/Makefile.am @@ -877,7 +870,7 @@ index 0000000..45aac8b + +#endif diff --git a/tools/syslogd.c b/tools/syslogd.c -index 2e4ea5d..701036d 100644 +index ffcaa27..37c3848 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -135,6 +135,7 @@ diff --git a/rsyslog.changes b/rsyslog.changes index 7f1c79e..355a2f3 100644 --- a/rsyslog.changes +++ b/rsyslog.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Wed Feb 2 16:11:12 UTC 2011 - mt@suse.de + +- update to 5.6.3 (v5-stable) with following bugfixes (digest): + * action processor released mememory too early, resulting in + potential issue in retry cases (very unlikely). + * batch processing flagged invalid message as "bad" under some + circumstances + * unitialized variable could cause issues under extreme + conditions plus some minor nits. + * batches which had actions in error were not properly retried + in all cases + * imfile did duplicate messages under some circumstances +- enabled plain tcp input, unix socket output, last message + parser and the libdbi module as separate package. + ------------------------------------------------------------------- Thu Jan 20 14:10:59 UTC 2011 - mt@suse.de diff --git a/rsyslog.spec b/rsyslog.spec index 4fd1c31..e705f43 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -1,5 +1,5 @@ # -# spec file for package rsyslog (Version 5.6.2) +# spec file for package rsyslog (Version 5.6.3) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -20,11 +20,12 @@ Name: rsyslog Summary: The enhanced syslogd for Linux and Unix -Version: 5.6.2 +Version: 5.6.3 Release: 1 -%define upstream_version 5.6.2 -# add %define build_with_relp 1 to enable relp on < 11.3, e.g. -# via %define build_with_relp 1 in _link file. +%define upstream_version 5.6.3 +%define with_dbi 1 +# let's look where it fails... +# 0%{?suse_version} >= 1140 || 0%{?build_with_relp:1} %define with_relp 0%{?suse_version} >= 1130 || 0%{?build_with_relp:1} %define _sbindir /sbin %define rsyslogdocdir %{_docdir}/%{name} @@ -42,23 +43,25 @@ BuildRequires: klogd BuildRequires: dos2unix openssl-devel pcre-devel pkgconfig zlib-devel BuildRequires: krb5-devel mysql-devel net-snmp-devel postgresql-devel BuildRequires: libgnutls-devel -%if %{?with_relp} +%if 0%{?with_dbi} +BuildRequires: libdbi-devel +%endif +%if 0%{?with_relp} # RELP support BuildRequires: librelp-devel %endif # UDP spoof support %if 0%{?suse_version} > 1130 BuildRequires: libnet-devel -# -#BuildRequires: systemd -# -# unresolvable: nothing provides fsck-with-dev-lock needed by systemd -# +# The systemd package provides +# /usr/share/doc/packages/systemd/sd-daemon.[ch] +# files instead of a lib ... +BuildRequires: systemd %else BuildRequires: libnet %endif BuildRoot: %{_tmppath}/%{name}-%{version}-build -#Source0: http://download.rsyslog.com/rsyslog/%{name}-%{upstream_version}.tar.gz +#Source0: http://download.rsyslog.com/rsyslog/rsyslog-.tar.gz Source0: %{name}-%{upstream_version}.tar.bz2 Source1: rsyslog.sysconfig Source2: rsyslog.conf.in @@ -138,6 +141,21 @@ package. This module provides the support for logging into PostgreSQL databases. +%if 0%{?with_dbi} +%package module-dbi +License: GPLv3+ +Group: System/Daemons +Requires: %{name} = %{version} +Summary: Database support via DBI + +%description module-dbi +Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog +package. + +This package provides a module with the support for logging into DBI +supported databases. +%endif + %package module-snmp License: GPLv3+ Group: System/Daemons @@ -164,7 +182,7 @@ package. This module provides the ability for TLS encrypted TCP logging (based on current syslog-transport-tls internet drafts). -%if %{?with_relp} +%if 0%{?with_relp} %package module-relp License: GPLv3+ @@ -196,6 +214,10 @@ This module provides a UDP forwarder that allows changing the sender address. %setup -q -n %{name}-%{upstream_version} %patch1 -p1 dos2unix doc/*.html +%if %suse_version > 1130 +# install the files systemd provides rather than what we provide. +cp -a /usr/share/doc/packages/systemd/sd-daemon.[ch] runtime/ +%endif %build export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall" @@ -220,18 +242,24 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall" --enable-gssapi-krb5 \ --enable-mysql \ --enable-pgsql \ +%if 0%{?with_dbi} + --enable-libdbi \ +%endif +%if 0%{?with_relp} + --enable-relp \ +%endif --enable-snmp \ --enable-mail \ --enable-imfile \ + --enable-imptcp \ --enable-imtemplate \ --enable-omprog \ + --enable-omuxsock \ --enable-omtemplate \ - --enable-diagtools \ -%if %{?with_relp} - --enable-relp \ -%endif --enable-omudpspoof \ --enable-omstdout \ + --enable-pmlastmsg \ + --enable-diagtools \ --disable-static make %{?_smp_mflags:%{_smp_mflags}} V=1 @@ -241,12 +269,15 @@ make install DESTDIR="%{buildroot}" V=1 # rm -f %{buildroot}%{rsyslog_module_dir_nodeps}/*.la # -# move all modules linking libraries in /usr to /usr/%_lib +# move all modules linking libraries in /usr to /usr/lib[64] # the user has to specify them with full path then... install -d -m0755 %{buildroot}%{rsyslog_module_dir_withdeps} for mod in omgssapi.so imgssapi.so lmgssutil.so ommysql.so \ ompgsql.so omsnmp.so lmnsd_gtls.so \ -%if %{?with_relp} +%if 0%{?with_dbi} + omlibdbi.so \ +%endif +%if 0%{?with_relp} imrelp.so omrelp.so \ %endif ; do @@ -412,6 +443,7 @@ fi %{rsyslog_module_dir_nodeps}/lmnet.so %{rsyslog_module_dir_nodeps}/lmnetstrms.so %{rsyslog_module_dir_nodeps}/lmnsd_ptcp.so +%{rsyslog_module_dir_nodeps}/imptcp.so %{rsyslog_module_dir_nodeps}/lmregexp.so %{rsyslog_module_dir_nodeps}/lmstrmsrv.so %{rsyslog_module_dir_nodeps}/lmtcpclt.so @@ -420,9 +452,11 @@ fi %{rsyslog_module_dir_nodeps}/ommail.so %{rsyslog_module_dir_nodeps}/omprog.so %{rsyslog_module_dir_nodeps}/omruleset.so +%{rsyslog_module_dir_nodeps}/omstdout.so %{rsyslog_module_dir_nodeps}/omtemplate.so %{rsyslog_module_dir_nodeps}/omtesting.so -%{rsyslog_module_dir_nodeps}/omstdout.so +%{rsyslog_module_dir_nodeps}/omuxsock.so +%{rsyslog_module_dir_nodeps}/pmlastmsg.so %dir %{rsyslog_module_dir_withdeps} %{_mandir}/man5/rsyslog.conf.5* %{_mandir}/man8/rsyslogd.8* @@ -463,6 +497,12 @@ fi %doc %{rsyslogdocdir}/pgsql-createDB.sql %{rsyslog_module_dir_withdeps}/ompgsql.so +%if 0%{?with_dbi} +%files module-dbi +%defattr(-,root,root) +%{rsyslog_module_dir_withdeps}/omlibdbi.so +%endif + %files module-snmp %defattr(-,root,root) %{rsyslog_module_dir_withdeps}/omsnmp.so @@ -471,8 +511,7 @@ fi %defattr(-,root,root) %{rsyslog_module_dir_withdeps}/lmnsd_gtls.so -%if %{?with_relp} - +%if 0%{?with_relp} %files module-relp %defattr(-,root,root) %{rsyslog_module_dir_withdeps}/imrelp.so From ec9f8a106064e6778ef6f75a8ab3603840088be4b1dab7a90c6603eb39948176 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Wed, 2 Feb 2011 16:37:32 +0000 Subject: [PATCH 5/6] updated with_dbi build conditions OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=37 --- rsyslog.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rsyslog.spec b/rsyslog.spec index e705f43..c13c1b4 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -23,9 +23,7 @@ Summary: The enhanced syslogd for Linux and Unix Version: 5.6.3 Release: 1 %define upstream_version 5.6.3 -%define with_dbi 1 -# let's look where it fails... -# 0%{?suse_version} >= 1140 || 0%{?build_with_relp:1} +%define with_dbi 0%{?suse_version} >= 1140 || 0%{?build_with_relp:1} %define with_relp 0%{?suse_version} >= 1130 || 0%{?build_with_relp:1} %define _sbindir /sbin %define rsyslogdocdir %{_docdir}/%{name} From 236ac167553341851539fe220d1a40bbda73eb4c513fae7f7e545fd57181e708 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Wed, 2 Feb 2011 16:48:18 +0000 Subject: [PATCH 6/6] - disabled systemd patch for openSUSE <= 11.3 OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=38 --- rsyslog.changes | 3 ++- rsyslog.spec | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rsyslog.changes b/rsyslog.changes index 355a2f3..3edb08a 100644 --- a/rsyslog.changes +++ b/rsyslog.changes @@ -1,5 +1,5 @@ ------------------------------------------------------------------- -Wed Feb 2 16:11:12 UTC 2011 - mt@suse.de +Wed Feb 2 16:47:24 UTC 2011 - mt@suse.de - update to 5.6.3 (v5-stable) with following bugfixes (digest): * action processor released mememory too early, resulting in @@ -13,6 +13,7 @@ Wed Feb 2 16:11:12 UTC 2011 - mt@suse.de * imfile did duplicate messages under some circumstances - enabled plain tcp input, unix socket output, last message parser and the libdbi module as separate package. +- disabled systemd patch for openSUSE <= 11.3 ------------------------------------------------------------------- Thu Jan 20 14:10:59 UTC 2011 - mt@suse.de diff --git a/rsyslog.spec b/rsyslog.spec index c13c1b4..3e47c17 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -49,7 +49,7 @@ BuildRequires: libdbi-devel BuildRequires: librelp-devel %endif # UDP spoof support -%if 0%{?suse_version} > 1130 +%if 0%{?suse_version} >= 1140 BuildRequires: libnet-devel # The systemd package provides # /usr/share/doc/packages/systemd/sd-daemon.[ch] @@ -65,7 +65,9 @@ Source1: rsyslog.sysconfig Source2: rsyslog.conf.in Source3: rsyslog.early.conf.in Source4: rsyslog.d.remote.conf.in +%if 0%{?suse_version} >= 1140 Patch1: rsyslog-systemd-integration.bnc656104.diff +%endif %description Rsyslog is an enhanced multi-threaded syslogd supporting, among others, @@ -210,12 +212,12 @@ This module provides a UDP forwarder that allows changing the sender address. %prep %setup -q -n %{name}-%{upstream_version} +%if 0%{?suse_version} >= 1140 %patch1 -p1 -dos2unix doc/*.html -%if %suse_version > 1130 # install the files systemd provides rather than what we provide. cp -a /usr/share/doc/packages/systemd/sd-daemon.[ch] runtime/ %endif +dos2unix doc/*.html %build export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall"