Hello community,
here is the log from the commit of package syslog-ng for openSUSE:Factory
checked in at Thu Jun 3 14:46:44 CEST 2010.
--------
--- syslog-ng/syslog-ng.changes 2010-04-13 13:09:34.000000000 +0200
+++ /mounts/work_src_done/STABLE/syslog-ng/syslog-ng.changes 2010-06-02 15:41:11.000000000 +0200
@@ -1,0 +2,11 @@
+Wed Jun 2 15:26:19 CEST 2010 - pczanik@fang.fa.gau.hu
+- some more patches accepted by upstream: bnc#568150
+
+-------------------------------------------------------------------
+Tue May 4 15:58:23 CEST 2010 - pczanik@fang.fa.gau.hu
+- removed /var/tmp/syslog-ng from rpm to prepare for
+ https://features.opensuse.org/303793
+- upstream accepted some patches from the 2.0.9 openSUSE
+ package, applied now, as 3.1.2 is still far away
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
syslog-ng-3.1.1-hostname.patch
syslog-ng-3.1.1-logmsg1.patch
syslog-ng-3.1.1-logmsg2.patch
syslog-ng-3.1.1-sighup.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ syslog-ng.spec ++++++
--- /var/tmp/diff_new_pack.CbOlnn/_old 2010-06-03 14:46:05.000000000 +0200
+++ /var/tmp/diff_new_pack.CbOlnn/_new 2010-06-03 14:46:05.000000000 +0200
@@ -21,7 +21,7 @@
Name: syslog-ng
%define eventlog_version 0.2.7
Version: 3.1.1
-Release: 1
+Release: 2
License: GPLv2
Group: System/Daemons
Summary: The new-generation syslog-daemon
@@ -35,6 +35,10 @@
Source2: syslog-ng.sysconfig
Source3: syslog-ng.conf.default
Patch0: syslog-ng-3.1.1-less-static.dif
+Patch1: syslog-ng-3.1.1-hostname.patch
+Patch2: syslog-ng-3.1.1-logmsg2.patch
+Patch3: syslog-ng-3.1.1-logmsg1.patch
+Patch4: syslog-ng-3.1.1-sighup.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: bison flex gcc-c++ glib2-devel pkgconfig
BuildRequires: klogd libnet python tcpd-devel
@@ -65,6 +69,10 @@
%prep
%setup -q -n syslog-ng-%{version}
%patch0 -p0
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
cp -a $RPM_SOURCE_DIR/syslog-ng.rc-script .
cp -a $RPM_SOURCE_DIR/syslog-ng.conf.default .
%ifarch s390 s390x
@@ -138,7 +146,9 @@
#mv doc/reference/html/index.html doc/reference/syslog-ng.html
mkdir %{buildroot}/usr/sbin/
%{__mv} -v %{buildroot}/sbin/syslog-ng-ctl %{buildroot}/usr/sbin/
-mkdir -p %{buildroot}/var/run/syslog-ng/
+
+#removed due to /var/run becoming tmpfs
+#mkdir -p %{buildroot}/var/run/syslog-ng/
%clean
##
@@ -261,7 +271,7 @@
%dir /etc/syslog-ng
%config(noreplace) /etc/syslog-ng/syslog-ng.conf
%dir /var/lib/syslog-ng
-%dir /var/run/syslog-ng
+%attr(755,root,root) %ghost %dir /var/run/syslog-ng
/var/adm/fillup-templates/sysconfig.syslog-ng
%changelog
++++++ syslog-ng-3.1.1-hostname.patch ++++++
From: Balazs Scheidler
Date: Mon, 3 May 2010 14:57:05 +0000 (+0200)
Subject: don't cache the local hostname accross SIGHUPs
X-Git-Url: http://git.balabit.hu/?p=bazsi%2Fsyslog-ng-3.1.git;a=commitdiff_plain;h=de09...
don't cache the local hostname accross SIGHUPs
Reported by the SUSE maintainer, syslog-ng caches
the local hostname accross SIGHUPs, which causes problems when
dynamic hostname configuration is in use (e.g. DHCP). This patch
relookups the local hostname when a SIGHUP is received.
Also, there was a bug in the per-source use_fqdn() processing which
is fixed by this patch: earlier, if two sources used use_fqdn()
differently the one which received the first message won and the
hostname was set according to its settings, even if the message
was received on the other source.
Conflicts:
src/misc.h
---
diff --git a/src/main.c b/src/main.c
index 3799d74..e03968d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -168,6 +168,7 @@ main_loop_run(GlobalConfig **cfg)
app_post_config_loaded();
msg_notice("Configuration reload request received, reloading configuration",
NULL);
+ reset_cached_hostname();
sig_hup_received = FALSE;
if ((*cfg)->stats_freq > 0)
{
diff --git a/src/misc.c b/src/misc.c
index 4ce899f..14b97b7 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -41,6 +41,9 @@
#include
#include
+static gchar local_hostname_fqdn[256];
+static gchar local_hostname_short[256];
+
GString *
g_string_assign_len(GString *s, const gchar *val, gint len)
{
@@ -50,34 +53,35 @@ g_string_assign_len(GString *s, const gchar *val, gint len)
return s;
}
-char *
-getshorthostname(char *buf, size_t bufsize)
+void
+reset_cached_hostname(void)
{
- char *s;
+ gchar *s;
- gethostname(buf, bufsize - 1);
- buf[bufsize - 1] = '\0';
- s = strchr(buf, '.');
- if (s != NULL)
- *s = '\0';
- return buf;
-}
-
-char *
-getlonghostname(char *buf, size_t bufsize)
-{
- gethostname(buf, bufsize - 1);
- buf[bufsize - 1] = '\0';
- if (strchr(buf, '.') == NULL)
+ gethostname(local_hostname_fqdn, sizeof(local_hostname_fqdn) - 1);
+ local_hostname_fqdn[sizeof(local_hostname_fqdn) - 1] = '\0';
+ if (strchr(local_hostname_fqdn, '.') == NULL)
{
- struct hostent *result = gethostbyname(buf);
+ /* not fully qualified, resolve it using DNS or /etc/hosts */
+ struct hostent *result = gethostbyname(local_hostname_fqdn);
if (result)
{
- strncpy(buf, result->h_name, bufsize - 1);
- buf[bufsize - 1] = 0;
+ strncpy(local_hostname_fqdn, result->h_name, sizeof(local_hostname_fqdn) - 1);
+ local_hostname_fqdn[sizeof(local_hostname_fqdn) - 1] = '\0';
}
}
- return buf;
+ /* NOTE: they are the same size, they'll fit */
+ strcpy(local_hostname_short, local_hostname_fqdn);
+ s = strchr(local_hostname_short, '.');
+ if (s != NULL)
+ *s = '\0';
+}
+
+void
+getlonghostname(gchar *buf, gsize buflen)
+{
+ strncpy(buf, local_hostname_fqdn, buflen);
+ buf[buflen - 1] = 0;
}
gboolean
@@ -156,7 +160,6 @@ resolve_hostname(GSockAddr **addr, gchar *name)
void
resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache, gboolean normalize_hostnames)
{
- static gchar local_hostname[256] = "";
gchar *hname;
gchar *p, buf[256];
@@ -222,17 +225,17 @@ resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean us
}
else
{
- hname = local_hostname;
-
- if (!local_hostname[0])
- {
- if (usefqdn)
- getlonghostname(local_hostname, sizeof(local_hostname));
- else
- getshorthostname(local_hostname, sizeof(local_hostname));
-
- }
-
+ if (!local_hostname_fqdn[0])
+ reset_cached_hostname();
+ if (usefqdn)
+ {
+ /* avoid copy */
+ hname = local_hostname_fqdn;
+ }
+ else
+ {
+ hname = local_hostname_short;
+ }
}
if (normalize_hostnames)
{
diff --git a/src/misc.h b/src/misc.h
index 55824db..2f7cc4b 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -32,14 +32,16 @@
GString *g_string_assign_len(GString *s, const gchar *val, gint len);
-char *getlonghostname(char *buf, size_t buflen);
-char *getshorthostname(char *buf, size_t buflen);
gboolean g_fd_set_nonblock(int fd, gboolean enable);
gboolean g_fd_set_cloexec(int fd, gboolean enable);
gboolean resolve_user(const char *user, uid_t *uid);
gboolean resolve_group(const char *group, gid_t *gid);
gboolean resolve_user_group(char *arg, uid_t *uid, gid_t *gid);
+
+/* name resolution */
+void reset_cached_hostname(void);
+void getlonghostname(gchar *buf, gsize buflen);
void resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache, gboolean normalize_hostnames);
gboolean resolve_hostname(GSockAddr **addr, gchar *name);
++++++ syslog-ng-3.1.1-logmsg1.patch ++++++
From: Balazs Scheidler
Date: Mon, 3 May 2010 14:51:52 +0000 (+0200)
Subject: logmsg: don't expect a hostname for local transports in the log message
X-Git-Url: http://git.balabit.hu/?p=bazsi%2Fsyslog-ng-3.1.git;a=commitdiff_plain;h=d8e0...
logmsg: don't expect a hostname for local transports in the log message
syslog-ng expected the same message format for both local and network
transports. However this seems to cause problems for applications that
embed a space in their $PROGRAM field, e.g.
logger -t "alma korte" message
Since we know that $HOST is always empty for local log transports
(checked for Linux, FreeBSD, AIX, HP-UX and Solaris) we can simply
assume that even if there's a space it is not a hostname, but rather
an incorrectly formatted $PROGRAM.
This will be recognized as:
$PROGRAM = "alma"
$MSGHDR = "alma "
$MSG = "korte: msg"
E.g. if it is formatted with the default template, it becomes the same as it
was received.
Reported-By: Marius Tomaschewski
---
diff --git a/src/logmsg.c b/src/logmsg.c
index 8ed0dbd..fa31a44 100644
--- a/src/logmsg.c
+++ b/src/logmsg.c
@@ -1546,11 +1546,16 @@ log_msg_parse_legacy(LogMessage *self,
}
else
{
- /* It's a regular ol' message. */
- log_msg_parse_hostname(self, &src, &left, &hostname_start, &hostname_len, flags, bad_hostname);
-
- /* Skip whitespace. */
- log_msg_parse_skip_chars(self, &src, &left, " ", -1);
+
+ if ((flags & LP_LOCAL) == 0)
+ {
+ /* Don't parse a hostname if it is local */
+ /* It's a regular ol' message. */
+ log_msg_parse_hostname(self, &src, &left, &hostname_start, &hostname_len, flags, bad_hostname);
+
+ /* Skip whitespace. */
+ log_msg_parse_skip_chars(self, &src, &left, " ", -1);
+ }
/* Try to extract a program name */
log_msg_parse_legacy_program_name(self, &src, &left, flags);
diff --git a/tests/unit/test_msgparse.c b/tests/unit/test_msgparse.c
index a6fb358..e4e33ef 100644
--- a/tests/unit/test_msgparse.c
+++ b/tests/unit/test_msgparse.c
@@ -266,6 +266,16 @@ main(int argc G_GNUC_UNUSED, char *argv[] G_GNUC_UNUSED)
NULL, NULL, NULL, NULL
);
+
+ testcase("<7>2006-10-29T02:00:00.156+01:00 bzorp openvpn[2499]: PTHREAD support initialized", LP_LOCAL, NULL,
+ 7, // pri
+ 1162083600, 156000, 3600, // timestamp (sec/usec/zone)
+ "", // host
+ "bzorp", // program
+ "openvpn[2499]: PTHREAD support initialized", // msg
+ NULL, NULL, NULL, NULL
+ );
+
testcase("<7>2006-10-29T02:00:00.156+01:00 ", 0, NULL,
7, // pri
1162083600, 156000, 3600, // timestamp (sec/usec/zone)
++++++ syslog-ng-3.1.1-logmsg2.patch ++++++
From: Balazs Scheidler
Date: Mon, 3 May 2010 14:43:35 +0000 (+0200)
Subject: logmsg: always store the legacy message header (MSGHDR)
X-Git-Url: http://git.balabit.hu/?p=bazsi%2Fsyslog-ng-3.1.git;a=commitdiff_plain;h=29ce...
logmsg: always store the legacy message header (MSGHDR)
This patch essentially makes the 'store-legacy-msghdr' behaviour
the default and creates a new 'dont-store-legacy-msghdr' flag to return
to the 3.0 compatible behaviour.
This patch introduces some incompatibility, however I feel that since the
'store-legacy-msghdr' flag is the assumed behaviour, it is best to make it
default. The only reason it existed in 3.0 is the expected performance
drop, but the 3.1 NVTable refactorizations solved that issue.
It is also needed for the follow-up patch to work properly.
---
diff --git a/src/logmsg.c b/src/logmsg.c
index a384a21..8ed0dbd 100644
--- a/src/logmsg.c
+++ b/src/logmsg.c
@@ -1062,7 +1062,7 @@ log_msg_parse_legacy_program_name(LogMessage *self, const guchar **data, gint *l
src++;
left--;
}
- if (flags & LP_STORE_LEGACY_MSGHDR)
+ if ((flags & LP_DONT_STORE_LEGACY_MSGHDR) == 0)
{
log_msg_set_value(self, LM_V_LEGACY_MSGHDR, (gchar *) *data, *length - left);
self->flags |= LF_LEGACY_MSGHDR;
diff --git a/src/logmsg.h b/src/logmsg.h
index 6c274b3..40010b2 100644
--- a/src/logmsg.h
+++ b/src/logmsg.h
@@ -47,7 +47,7 @@
#define LP_ASSUME_UTF8 0x0080
#define LP_VALIDATE_UTF8 0x0100
#define LP_NO_MULTI_LINE 0x0200
-#define LP_STORE_LEGACY_MSGHDR 0x0400
+#define LP_DONT_STORE_LEGACY_MSGHDR 0x0400
typedef struct _LogPathOptions LogPathOptions;
diff --git a/src/logreader.c b/src/logreader.c
index 5387e24..b1fcaaf 100644
--- a/src/logreader.c
+++ b/src/logreader.c
@@ -311,8 +311,8 @@ log_reader_fetch_log(LogReader *self, LogProto *proto)
parse_flags |= LP_VALIDATE_UTF8;
if (self->options->options & LRO_NO_MULTI_LINE)
parse_flags |= LP_NO_MULTI_LINE;
- if (self->options->options & LRO_STORE_LEGACY_MSGHDR)
- parse_flags |= LP_STORE_LEGACY_MSGHDR;
+ if (self->options->options & LRO_DONT_STORE_LEGACY_MSGHDR)
+ parse_flags |= LP_DONT_STORE_LEGACY_MSGHDR;
if (self->waiting_for_preemption)
may_read = FALSE;
@@ -825,7 +825,9 @@ log_reader_options_lookup_flag(const gchar *flag)
if (strcmp(flag, "no-multi-line") == 0 || strcmp(flag, "no_multi_line") == 0)
return LRO_NO_MULTI_LINE;
if (strcmp(flag, "store-legacy-msghdr") == 0 || strcmp(flag, "store_legacy_msghdr") == 0)
- return LRO_STORE_LEGACY_MSGHDR;
+ return 0;
+ if (strcmp(flag, "dont-store-legacy-msghdr") == 0 || strcmp(flag, "dont_store_legacy_msghdr") == 0)
+ return LRO_DONT_STORE_LEGACY_MSGHDR;
if (strcmp(flag, "empty-lines") == 0 || strcmp(flag, "empty_lines") == 0)
return LRO_EMPTY_LINES;
msg_error("Unknown parse flag", evt_tag_str("flag", flag), NULL);
diff --git a/src/logreader.h b/src/logreader.h
index 2ef127b..e8208c2 100644
--- a/src/logreader.h
+++ b/src/logreader.h
@@ -43,7 +43,7 @@
#define LRO_SYSLOG_PROTOCOL 0x0004
#define LRO_VALIDATE_UTF8 0x0008
#define LRO_NO_MULTI_LINE 0x0010
-#define LRO_STORE_LEGACY_MSGHDR 0x0020
+#define LRO_DONT_STORE_LEGACY_MSGHDR 0x0020
#define LRO_EMPTY_LINES 0x0040
typedef struct _LogReaderWatch LogReaderWatch;
++++++ syslog-ng-3.1.1-sighup.patch ++++++
From: Balazs Scheidler
Date: Wed, 5 May 2010 08:10:05 +0000 (+0200)
Subject: SIGHUP handling: block SIGHUP while reload is being carried out
X-Git-Url: http://git.balabit.hu/?p=bazsi%2Fsyslog-ng-3.1.git;a=commitdiff_plain;h=cb6f...
SIGHUP handling: block SIGHUP while reload is being carried out
Reported by the SUSE maintainer that it is possible for syslog-ng to receive
multiple SIGHUP signals while the reload operation is being carried out.
This patch changes SIGHUP/SIGCHLD processing to block these signals while
handling the signal is being done.
Reported-By: Marius Tomaschewski
---
diff --git a/src/main.c b/src/main.c
index e03968d..aa3ba69 100644
--- a/src/main.c
+++ b/src/main.c
@@ -65,9 +65,9 @@ static gboolean syntax_only = FALSE;
static gboolean seed_rng = FALSE;
static gboolean display_version = FALSE;
-static gboolean sig_hup_received = FALSE;
-static gboolean sig_term_received = FALSE;
-static gboolean sig_child_received = FALSE;
+static volatile sig_atomic_t sig_hup_received = FALSE;
+static volatile sig_atomic_t sig_term_received = FALSE;
+static volatile sig_atomic_t sig_child_received = FALSE;
static void
sig_hup_handler(int signo)
@@ -138,6 +138,8 @@ main_loop_run(GlobalConfig **cfg)
{
gint iters;
guint stats_timer_id = 0;
+ sigset_t ss;
+
msg_notice("syslog-ng starting up",
evt_tag_str("version", VERSION),
NULL);
@@ -163,13 +165,25 @@ main_loop_run(GlobalConfig **cfg)
g_main_context_iteration(g_main_loop_get_context(main_loop), TRUE);
if (sig_hup_received)
{
+ sigemptyset(&ss);
+ sigaddset(&ss, SIGHUP);
+ sigprocmask(SIG_BLOCK, &ss, NULL);
+ sig_hup_received = FALSE;
+
+ /* this may handle multiple SIGHUP signals, however it doesn't
+ * really matter if we received only a single or multiple SIGHUPs
+ * until we make sure that we handle the last one. Since we
+ * blocked the SIGHUP signal and reset sig_hup_received to FALSE,
+ * we can be sure that if we receive an additional SIGHUP during
+ * signal processing we get the new one when we finished this, and
+ * handle that one as well. */
+
app_pre_config_loaded();
(*cfg) = cfg_reload_config(cfgfilename, (*cfg));
app_post_config_loaded();
msg_notice("Configuration reload request received, reloading configuration",
NULL);
reset_cached_hostname();
- sig_hup_received = FALSE;
if ((*cfg)->stats_freq > 0)
{
if (stats_timer_id != 0)
@@ -177,6 +191,7 @@ main_loop_run(GlobalConfig **cfg)
stats_timer_id = g_timeout_add((*cfg)->stats_freq * 1000, stats_timer, NULL);
}
stats_cleanup_orphans();
+ sigprocmask(SIG_UNBLOCK, &ss, NULL);
}
if (sig_term_received)
{
@@ -189,13 +204,22 @@ main_loop_run(GlobalConfig **cfg)
pid_t pid;
int status;
+ sigemptyset(&ss);
+ sigaddset(&ss, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &ss, NULL);
+ sig_child_received = FALSE;
+
+ /* this may handle multiple SIGCHLD signals, however it doesn't
+ * matter if one or multiple SIGCHLD was received assuming that
+ * all exited child process are waited for */
+
do
{
pid = waitpid(-1, &status, WNOHANG);
child_manager_sigchild(pid, status);
}
while (pid > 0);
- sig_child_received = FALSE;
+ sigprocmask(SIG_UNBLOCK, &ss, NULL);
}
}
control_destroy();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org