Hello community,
here is the log from the commit of package rsyslog for openSUSE:Factory checked in at 2012-05-07 22:51:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rsyslog (Old)
and /work/SRC/openSUSE:Factory/.rsyslog.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rsyslog", Maintainer is "mt@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/rsyslog/rsyslog.changes 2012-04-17 07:49:28.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rsyslog.new/rsyslog.changes 2012-05-07 22:51:13.000000000 +0200
@@ -1,0 +2,33 @@
+Mon May 7 10:31:08 UTC 2012 - mt@suse.com
+
+- Updated to 5.8.11 [V5-stable] 2012-05-03:
+ - bugfix: ommysql did not properly init/exit the mysql runtime
+ library this could lead to segfaults. Triggering condition:
+ multiple action instances using ommysql. Thanks to Tomas
+ Heinrich for reporting this problem and providing an initial
+ patch (which my solution is based on, I need to add more code
+ to clean the mess up).
+ - bugfix: rsyslog did not terminate when delayable inputs were
+ blocked due to unvailable sources. Fixes:
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ Thanks to Marcin M for bringing up this problem and Andre
+ Lorbach for helping to reproduce and fix it.
+ - bugfix: active input in “light delay state” could block
+ rsyslog termination, at least for prolonged period of time
+ - bugfix: imptcp input name could not be set. Config directive
+ was accepted, but had no effect
+ bugfix: assigned ruleset was lost when using disk queues
+ This looked quite hard to diagnose for disk-assisted queues,
+ as the pure memory part worked well, but ruleset info was lost
+ for messages stored inside the disk queue.
+ - bugfix: hostname was not requeried on HUP
+ Thanks to Per Jessen for reporting this bug and Marius
+ Tomaschewski for his help in testing the fix.
+ - bugfix: inside queue.c, some thread cancel states were not
+ correctly reset. While this is a bug, we assume it did have
+ no practical effect because the reset as it was done was set
+ to the state the code actually had at this point. But better
+ fix this…
+- Removed obsolete requery hostname patch
+
+-------------------------------------------------------------------
Old:
----
0001_5-bugfix-requery-hostname-on-HUP.patch
rsyslog-5.8.10.tar.bz2
New:
----
rsyslog-5.8.11.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rsyslog.spec ++++++
--- /var/tmp/diff_new_pack.7OPkNH/_old 2012-05-07 22:51:15.000000000 +0200
+++ /var/tmp/diff_new_pack.7OPkNH/_new 2012-05-07 22:51:15.000000000 +0200
@@ -20,7 +20,7 @@
Summary: The enhanced syslogd for Linux and Unix
License: GPL-3.0+
Group: System/Daemons
-Version: 5.8.10
+Version: 5.8.11
Release: 0
# for setting those bcond_with* configs see
# http://lizards.opensuse.org/2008/09/12/conditional-features-aka-use-flags/
@@ -117,7 +117,6 @@
Source2: rsyslog.conf.in
Source3: rsyslog.early.conf.in
Source4: rsyslog.d.remote.conf.in
-Patch1: 0001_5-bugfix-requery-hostname-on-HUP.patch
%description
Rsyslog is an enhanced multi-threaded syslogd supporting, among others,
@@ -268,7 +267,6 @@
%prep
%setup -q -n %{name}-%{upstream_version}
-%patch1 -p1
%if %{with systemd}
%if 0%{?suse_version} <= 1140
# Bug: https://bugzilla.novell.com/show_bug.cgi?id=656259
++++++ rsyslog-5.8.10.tar.bz2 -> rsyslog-5.8.11.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/ChangeLog new/rsyslog-5.8.11/ChangeLog
--- old/rsyslog-5.8.10/ChangeLog 2012-04-05 14:36:22.000000000 +0200
+++ new/rsyslog-5.8.11/ChangeLog 2012-05-03 13:53:18.000000000 +0200
@@ -1,4 +1,31 @@
---------------------------------------------------------------------------
+Version 5.8.11 [V5-stable] 2012-05-03
+- bugfix: ommysql did not properly init/exit the mysql runtime library
+ this could lead to segfaults. Triggering condition: multiple action
+ instances using ommysql. Thanks to Tomas Heinrich for reporting this
+ problem and providing an initial patch (which my solution is based on,
+ I need to add more code to clean the mess up).
+- bugfix: rsyslog did not terminate when delayable inputs were blocked
+ due to unvailable sources. Fixes:
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ Thanks to Marcin M for bringing up this problem and Andre Lorbach
+ for helping to reproduce and fix it.
+- bugfix: active input in "light delay state" could block rsyslog
+ termination, at least for prolonged period of time
+- bugfix: imptcp input name could not be set
+ config directive was accepted, but had no effect
+- bugfix: assigned ruleset was lost when using disk queues
+ This looked quite hard to diagnose for disk-assisted queues, as the
+ pure memory part worked well, but ruleset info was lost for messages
+ stored inside the disk queue.
+- bugfix: hostname was not requeried on HUP
+ Thanks to Per Jessen for reporting this bug and Marius Tomaschewski for
+ his help in testing the fix.
+- bugfix: inside queue.c, some thread cancel states were not correctly
+ reset. While this is a bug, we assume it did have no practical effect
+ because the reset as it was done was set to the state the code actually
+ had at this point. But better fix this...
+---------------------------------------------------------------------------
Version 5.8.10 [V5-stable] 2012-04-05
- bugfix: segfault on startup if $actionqueuefilename was missing for disk
queue config
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/config.h.in new/rsyslog-5.8.11/config.h.in
--- old/rsyslog-5.8.10/config.h.in 2012-04-05 14:36:59.000000000 +0200
+++ new/rsyslog-5.8.11/config.h.in 2012-05-03 13:53:48.000000000 +0200
@@ -116,6 +116,9 @@
/* Define to 1 if you have the `mkdir' function. */
#undef HAVE_MKDIR
+/* mysql_library_init available */
+#undef HAVE_MYSQL_LIBRARY_INIT
+
/* Define to 1 if you have the header file. */
#undef HAVE_NETDB_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/configure new/rsyslog-5.8.11/configure
--- old/rsyslog-5.8.10/configure 2012-04-05 14:36:58.000000000 +0200
+++ new/rsyslog-5.8.11/configure 2012-05-03 13:53:47.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.66 for rsyslog 5.8.10.
+# Generated by GNU Autoconf 2.66 for rsyslog 5.8.11.
#
# Report bugs to .
#
@@ -562,8 +562,8 @@
# Identity of this package.
PACKAGE_NAME='rsyslog'
PACKAGE_TARNAME='rsyslog'
-PACKAGE_VERSION='5.8.10'
-PACKAGE_STRING='rsyslog 5.8.10'
+PACKAGE_VERSION='5.8.11'
+PACKAGE_STRING='rsyslog 5.8.11'
PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com'
PACKAGE_URL=''
@@ -1475,7 +1475,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures rsyslog 5.8.10 to adapt to many kinds of systems.
+\`configure' configures rsyslog 5.8.11 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1545,7 +1545,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of rsyslog 5.8.10:";;
+ short | recursive ) echo "Configuration of rsyslog 5.8.11:";;
esac
cat <<\_ACEOF
@@ -1720,7 +1720,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-rsyslog configure 5.8.10
+rsyslog configure 5.8.11
generated by GNU Autoconf 2.66
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2299,7 +2299,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by rsyslog $as_me 5.8.10, which was
+It was created by rsyslog $as_me 5.8.11, which was
generated by GNU Autoconf 2.66. Invocation command line was
$ $0 $@
@@ -3114,7 +3114,7 @@
# Define the identity of the package.
PACKAGE='rsyslog'
- VERSION='5.8.10'
+ VERSION='5.8.11'
cat >>confdefs.h <<_ACEOF
@@ -14894,6 +14894,33 @@
See \`config.log' for more details" "$LINENO" 5; }
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have mysql_library_init" >&5
+$as_echo_n "checking if we have mysql_library_init... " >&6; }
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $MYSQL_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $MYSQL_LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include
+ #include
+int
+main ()
+{
+mysql_library_init(0, NULL, NULL)
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_mysql_library_init=yes
+else
+ have_mysql_library_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
fi
if test x$enable_mysql = xyes; then
ENABLE_MYSQL_TRUE=
@@ -14903,6 +14930,11 @@
ENABLE_MYSQL_FALSE=
fi
+if test "$have_mysql_library_init" = "yes"; then
+
+$as_echo "#define HAVE_MYSQL_LIBRARY_INIT 1" >>confdefs.h
+
+fi
@@ -17336,7 +17368,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by rsyslog $as_me 5.8.10, which was
+This file was extended by rsyslog $as_me 5.8.11, which was
generated by GNU Autoconf 2.66. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17402,7 +17434,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-rsyslog config.status 5.8.10
+rsyslog config.status 5.8.11
configured by $0, generated by GNU Autoconf 2.66,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/configure.ac new/rsyslog-5.8.11/configure.ac
--- old/rsyslog-5.8.10/configure.ac 2012-04-05 14:36:39.000000000 +0200
+++ new/rsyslog-5.8.11/configure.ac 2012-05-03 13:53:09.000000000 +0200
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([rsyslog],[5.8.10],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[5.8.11],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -514,8 +514,24 @@
[AC_MSG_FAILURE([MySQL library is missing])],
[`mysql_config --libs`]
)
+ AC_MSG_CHECKING(if we have mysql_library_init)
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $MYSQL_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $MYSQL_LIBS"
+ AC_TRY_LINK(
+ [#include
+ #include ],
+ [mysql_library_init(0, NULL, NULL)],
+ [have_mysql_library_init=yes],
+ [have_mysql_library_init=no])
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
fi
AM_CONDITIONAL(ENABLE_MYSQL, test x$enable_mysql = xyes)
+if test "$have_mysql_library_init" = "yes"; then
+ AC_DEFINE([HAVE_MYSQL_LIBRARY_INIT], [1], [mysql_library_init available])
+fi
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MYSQL_LIBS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/doc/manual.html new/rsyslog-5.8.11/doc/manual.html
--- old/rsyslog-5.8.10/doc/manual.html 2012-04-05 14:36:45.000000000 +0200
+++ new/rsyslog-5.8.11/doc/manual.html 2012-05-03 13:53:25.000000000 +0200
@@ -19,7 +19,7 @@
<p><b>Please visit the <a href="http://www.rsyslog.com/sponsors">rsyslog sponsor's page</a>
to honor the project sponsors or become one yourself!</b> We are very grateful for any help towards the
project goals.</p>
-<p><b>This documentation is for version 5.8.10 (v5-stable branch) of rsyslog.</b>
+<p><b>This documentation is for version 5.8.11 (v5-stable branch) of rsyslog.</b>
Visit the <i><a href="http://www.rsyslog.com/status">rsyslog status page</a></i></b>
to obtain current version information and project status.
</p><p><b>If you like rsyslog, you might
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/doc/omudpspoof.html new/rsyslog-5.8.11/doc/omudpspoof.html
--- old/rsyslog-5.8.10/doc/omudpspoof.html 2012-03-02 15:14:04.000000000 +0100
+++ new/rsyslog-5.8.11/doc/omudpspoof.html 2012-04-27 10:10:28.000000000 +0200
@@ -16,7 +16,7 @@
source ports.
<p><b>Configuration Directives</b>:</p>
<ul>
-<li><b>$ActionOMUDPSpoofSourceNameTemplate</b> <templatename><br>
+<li><b>$ActionOMOMUDPSpoofSourceNameTemplate</b> <templatename><br>
This is the name of the template that contains a
numerical IP address that is to be used as the source system IP address.
While it may often be a constant value, it can be generated as usual via the
@@ -28,7 +28,7 @@
was received from. This is considered the most important use case.
<li><b>$ActionOMUDPSpoofTargetHost</b> <hostname><br>
Host that the messages shall be sent to.
-<li><b>$ActionUDPSpoofTargetPort</b> <port><br>
+<li><b>$ActionOMUDPSpoofTargetPort</b> <port><br>
Remote port that the messages shall be sent to.
<li><b>$ActionOMUDPSpoofDefaultTemplate</b> <templatename><br>
This setting instructs omudpspoof to use a template different from the
@@ -53,7 +53,7 @@
omudpspoof.
</p>
<textarea rows="5" cols="80">$ModLoad omudpspoof
-$ActionUDPSpoofTargetHost server.example.com
+$ActionOMUDPSpoofTargetHost server.example.com
*.* :omudpspoof:
</textarea>
@@ -64,10 +64,10 @@
<textarea rows="8" cols="80">$ModLoad omudpspoof
$template spoofaddr,"192.0.2.1"
$template spooftemplate,"%rawmsg%"
-$ActionUDPSpoofSourceNameTemplate spoofaddr
-$ActionUDPSpoofTargetHost server.example.com
-$ActionUDPSpoofSourcePortStart 514
-$ActionUDPSpoofSourcePortEnd 514
+$ActionOMUDPSpoofSourceNameTemplate spoofaddr
+$ActionOMUDPSpoofTargetHost server.example.com
+$ActionOMUDPSpoofSourcePortStart 514
+$ActionOMUDPSpoofSourcePortEnd 514
*.* :omudpspoof:;spooftemplate
</textarea>
<p>The following sample is similar to the previous, but uses as many defaults as possible.
@@ -77,8 +77,8 @@
</p>
<textarea rows="5" cols="80">$ModLoad omudpspoof
$template spoofaddr,"192.0.2.1"
-$ActionUDPSpoofSourceNameTemplate spoofaddr
-$ActionUDPSpoofTargetHost server.example.com
+$ActionOMUDPSpoofSourceNameTemplate spoofaddr
+$ActionOMUDPSpoofTargetHost server.example.com
*.* :omudpspoof:
</textarea>
<p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>]
@@ -86,7 +86,7 @@
<p><font size="2">This documentation is part of the
<a href="http://www.rsyslog.com/">rsyslog</a>
project.<br>
-Copyright © 2009 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
+Copyright © 2009-2012 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
<a href="http://www.adiscon.com/">Adiscon</a>.
Released under the GNU GPL version 3 or higher.</font></p>
</body></html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/doc/rsyslog_conf_global.html new/rsyslog-5.8.11/doc/rsyslog_conf_global.html
--- old/rsyslog-5.8.10/doc/rsyslog_conf_global.html 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/doc/rsyslog_conf_global.html 2012-04-27 10:04:41.000000000 +0200
@@ -152,15 +152,6 @@
<li><a href="rsconf1_gssforwardservicename.html">$GssForwardServiceName</a></li>
<li><a href="rsconf1_gsslistenservicename.html">$GssListenServiceName</a></li>
<li><a href="rsconf1_gssmode.html">$GssMode</a></li>
-<li>$HUPisRestart [on/<b>off</b>] - if set to on, a HUP is a full daemon restart. This means any queued messages are discarded (depending
-on queue configuration, of course) all modules are unloaded and reloaded. This mode keeps compatible with sysklogd, but is
-not recommended for use with rsyslog. To do a full restart, simply stop and start the daemon. The default (since 4.5.1) is "off".
-If it is set to "off", a HUP will only close open files. This is a much quicker action and usually
-the only one that is needed e.g. for log rotation. <b>Restart-type HUPs (value "on") are depricated</b>
-and will go away in rsyslog v5. So it is a good idea to change anything that needs it, now.
-Usually that should not be a big issue, as the restart-type HUP can easily be replaced by
-something along the lines of "/etc/init.d/rsyslog restart".
-</li>
<li><a href="rsconf1_includeconfig.html">$IncludeConfig</a></li><li>MainMsgQueueCheckpointInterval <number></li>
<li><b>$LocalHostName</b> [name] - this directive permits to overwrite the system
hostname with the one specified in the directive. If the directive is given
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/doc/v5compatibility.html new/rsyslog-5.8.11/doc/v5compatibility.html
--- old/rsyslog-5.8.10/doc/v5compatibility.html 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/doc/v5compatibility.html 2012-04-12 15:12:20.000000000 +0200
@@ -16,6 +16,7 @@
For details, please see the
<a href="v4compatibility.html">rsyslog v4 compatibility notes</a> which elaborate
on the reasons and the (few) things you may need to change.
+<p>Please note that starting with 5.8.11 HUP will also requery the local hostname.
<h2>Queue on-disk format</h2>
<p>The queue information file format has been changed. When upgrading from v4 to
v5, make sure that the queue is emptied and no on-disk structure present. We did
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/plugins/imptcp/imptcp.c new/rsyslog-5.8.11/plugins/imptcp/imptcp.c
--- old/rsyslog-5.8.10/plugins/imptcp/imptcp.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/plugins/imptcp/imptcp.c 2012-04-27 10:10:28.000000000 +0200
@@ -885,14 +885,14 @@
pSrv->bEmitMsgOnClose = cs.bEmitMsgOnClose;
pSrv->port = pNewVal;
pSrv->iAddtlFrameDelim = cs.iAddtlFrameDelim;
- cs.pszInputName = NULL; /* moved over to pSrv, we do not own */
pSrv->lstnIP = cs.lstnIP;
- cs.lstnIP = NULL; /* moved over to pSrv, we do not own */
pSrv->pRuleset = cs.pRuleset;
pSrv->pszInputName = (cs.pszInputName == NULL) ? UCHAR_CONSTANT("imptcp") : cs.pszInputName;
CHKiRet(prop.Construct(&pSrv->pInputName));
CHKiRet(prop.SetString(pSrv->pInputName, pSrv->pszInputName, ustrlen(pSrv->pszInputName)));
CHKiRet(prop.ConstructFinalize(pSrv->pInputName));
+ cs.pszInputName = NULL; /* moved over to pSrv, we do not own */
+ cs.lstnIP = NULL; /* moved over to pSrv, we do not own */
/* add to linked list */
pSrv->pNext = pSrvRoot;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/plugins/imuxsock/imuxsock.c new/rsyslog-5.8.11/plugins/imuxsock/imuxsock.c
--- old/rsyslog-5.8.10/plugins/imuxsock/imuxsock.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/plugins/imuxsock/imuxsock.c 2012-04-27 10:10:25.000000000 +0200
@@ -281,16 +281,16 @@
} else {
listeners[nfd].bParseHost = 0;
}
- CHKiRet(prop.Construct(&(listeners[nfd].hostName)));
if(pLogHostName == NULL) {
- CHKiRet(prop.SetString(listeners[nfd].hostName, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName())));
+ listeners[nfd].hostName = NULL;
} else {
+ CHKiRet(prop.Construct(&(listeners[nfd].hostName)));
CHKiRet(prop.SetString(listeners[nfd].hostName, pLogHostName, ustrlen(pLogHostName)));
+ CHKiRet(prop.ConstructFinalize(listeners[nfd].hostName));
/* reset hostname for next socket */
free(pLogHostName);
pLogHostName = NULL;
}
- CHKiRet(prop.ConstructFinalize(listeners[nfd].hostName));
if(ratelimitInterval > 0) {
if((listeners[nfd].ht = create_hashtable(100, hash_from_key_fn, key_equals_fn, NULL)) == NULL) {
/* in this case, we simply turn of rate-limiting */
@@ -602,7 +602,7 @@
pMsg->msgFlags = pLstn->flags;
}
- MsgSetRcvFrom(pMsg, pLstn->hostName);
+ MsgSetRcvFrom(pMsg, pLstn->hostName == NULL ? glbl.GetLocalHostNameProp() : pLstn->hostName);
CHKiRet(MsgSetRcvFromIP(pMsg, pLocalHostIP));
CHKiRet(submitMsg(pMsg));
@@ -864,7 +864,6 @@
if(pInputName != NULL)
prop.Destruct(&pInputName);
-
ENDafterRun
@@ -958,11 +957,6 @@
CHKiRet(prop.SetString(pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
CHKiRet(prop.ConstructFinalize(pLocalHostIP));
- /* now init listen socket zero, the local log socket */
- CHKiRet(prop.Construct(&(listeners[0].hostName)));
- CHKiRet(prop.SetString(listeners[0].hostName, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName())));
- CHKiRet(prop.ConstructFinalize(listeners[0].hostName));
-
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"omitlocallogging", 0, eCmdHdlrBinary,
NULL, &bOmitLocalLogging, STD_LOADABLE_MODULE_ID));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/plugins/ommysql/ommysql.c new/rsyslog-5.8.11/plugins/ommysql/ommysql.c
--- old/rsyslog-5.8.10/plugins/ommysql/ommysql.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/plugins/ommysql/ommysql.c 2012-05-03 13:52:27.000000000 +0200
@@ -90,7 +90,6 @@
ASSERT(pData != NULL);
if(pData->f_hmysql != NULL) { /* just to be on the safe side... */
- mysql_server_end();
mysql_close(pData->f_hmysql);
pData->f_hmysql = NULL;
}
@@ -319,6 +318,11 @@
BEGINmodExit
CODESTARTmodExit
+# ifdef HAVE_MYSQL_LIBRARY_INIT
+ mysql_library_end();
+# else
+ mysql_server_end();
+# endif
ENDmodExit
@@ -346,6 +350,20 @@
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+
+ /* we need to init the MySQL library. If that fails, we cannot run */
+ if(
+# ifdef HAVE_MYSQL_LIBRARY_INIT
+ mysql_library_init(0, NULL, NULL)
+# else
+ mysql_server_init(0, NULL, NULL)
+# endif
+ ) {
+ errmsg.LogError(0, NO_ERRCODE, "ommysql: mysql_server_init() failed, plugin "
+ "can not run");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
/* register our config handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionommysqlserverport", 0, eCmdHdlrInt, NULL, &iSrvPort, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/runtime/glbl.c new/rsyslog-5.8.11/runtime/glbl.c
--- old/rsyslog-5.8.10/runtime/glbl.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/runtime/glbl.c 2012-04-27 10:04:42.000000000 +0200
@@ -69,10 +69,10 @@
static int option_DisallowWarning = 1; /* complain if message from disallowed sender is received */
static int bDisableDNS = 0; /* don't look up IP addresses of remote messages */
static prop_t *propLocalHostName = NULL;/* our hostname as FQDN - read-only after startup */
-static uchar *LocalHostName = NULL;/* our hostname - read-only after startup */
+static uchar *LocalHostName = NULL;/* our hostname - read-only after startup, except HUP */
static uchar *LocalHostNameOverride = NULL;/* user-overridden hostname - read-only after startup */
-static uchar *LocalFQDNName = NULL;/* our hostname as FQDN - read-only after startup */
-static uchar *LocalDomain; /* our local domain name - read-only after startup */
+static uchar *LocalFQDNName = NULL;/* our hostname as FQDN - read-only after startup, except HUP */
+static uchar *LocalDomain = NULL;/* our local domain name - read-only after startup, except HUP */
static char **StripDomains = NULL;/* these domains may be stripped before writing logs - r/o after s.u., never touched by init */
static char **LocalHosts = NULL;/* these hosts are logged with their hostname - read-only after startup, never touched by init */
static uchar *pszDfltNetstrmDrvr = NULL; /* module name of default netstream driver */
@@ -115,15 +115,12 @@
SIMP_PROP(DropMalPTRMsgs, bDropMalPTRMsgs, int)
SIMP_PROP(Option_DisallowWarning, option_DisallowWarning, int)
SIMP_PROP(DisableDNS, bDisableDNS, int)
-SIMP_PROP(LocalDomain, LocalDomain, uchar*)
SIMP_PROP(StripDomains, StripDomains, char**)
SIMP_PROP(LocalHosts, LocalHosts, char**)
#ifdef USE_UNLIMITED_SELECT
SIMP_PROP(FdSetSize, iFdSetSize, int)
#endif
-SIMP_PROP_SET(LocalFQDNName, LocalFQDNName, uchar*)
-SIMP_PROP_SET(LocalHostName, LocalHostName, uchar*)
SIMP_PROP_SET(DfltNetstrmDrvr, pszDfltNetstrmDrvr, uchar*) /* TODO: use custom function which frees existing value */
SIMP_PROP_SET(DfltNetstrmDrvrCAF, pszDfltNetstrmDrvrCAF, uchar*) /* TODO: use custom function which frees existing value */
SIMP_PROP_SET(DfltNetstrmDrvrKeyFile, pszDfltNetstrmDrvrKeyFile, uchar*) /* TODO: use custom function which frees existing value */
@@ -202,6 +199,19 @@
RETiRet;
}
+/* set our local hostname. Free previous hostname, if it was already set.
+ * Note that we do now do this in a thread
+ * "once in a lifetime" action which can not be undone. -- gerhards, 2009-07-20
+ */
+static rsRetVal
+SetLocalHostName(uchar *newname)
+{
+ free(LocalHostName);
+ LocalHostName = newname;
+ return RS_RET_OK;
+}
+
+
/* return our local hostname. if it is not set, "[localhost]" is returned
*/
static uchar*
@@ -227,6 +237,26 @@
}
+/* set our local domain name. Free previous domain, if it was already set.
+ */
+static rsRetVal
+SetLocalDomain(uchar *newname)
+{
+ free(LocalDomain);
+ LocalDomain = newname;
+ return RS_RET_OK;
+}
+
+
+/* return our local hostname. if it is not set, "[localhost]" is returned
+ */
+static uchar*
+GetLocalDomain(void)
+{
+ return LocalDomain;
+}
+
+
/* generate the local hostname property. This must be done after the hostname info
* has been set as well as PreserveFQDN.
* rgerhards, 2009-06-30
@@ -271,6 +301,14 @@
}
+static rsRetVal
+SetLocalFQDNName(uchar *newname)
+{
+ free(LocalFQDNName);
+ LocalFQDNName = newname;
+ return RS_RET_OK;
+}
+
/* return the current localhost name as FQDN (requires FQDN to be set)
* TODO: we should set the FQDN ourselfs in here!
*/
@@ -373,30 +411,18 @@
*/
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
- if(pszDfltNetstrmDrvr != NULL) {
- free(pszDfltNetstrmDrvr);
- pszDfltNetstrmDrvr = NULL;
- }
- if(pszDfltNetstrmDrvrCAF != NULL) {
- free(pszDfltNetstrmDrvrCAF);
- pszDfltNetstrmDrvrCAF = NULL;
- }
- if(pszDfltNetstrmDrvrKeyFile != NULL) {
- free(pszDfltNetstrmDrvrKeyFile);
- pszDfltNetstrmDrvrKeyFile = NULL;
- }
- if(pszDfltNetstrmDrvrCertFile != NULL) {
- free(pszDfltNetstrmDrvrCertFile);
- pszDfltNetstrmDrvrCertFile = NULL;
- }
- if(LocalHostNameOverride != NULL) {
- free(LocalHostNameOverride);
- LocalHostNameOverride = NULL;
- }
- if(pszWorkDir != NULL) {
- free(pszWorkDir);
- pszWorkDir = NULL;
- }
+ free(pszDfltNetstrmDrvr);
+ pszDfltNetstrmDrvr = NULL;
+ free(pszDfltNetstrmDrvrCAF);
+ pszDfltNetstrmDrvrCAF = NULL;
+ free(pszDfltNetstrmDrvrKeyFile);
+ pszDfltNetstrmDrvrKeyFile = NULL;
+ free(pszDfltNetstrmDrvrCertFile);
+ pszDfltNetstrmDrvrCertFile = NULL;
+ free(LocalHostNameOverride);
+ LocalHostNameOverride = NULL;
+ free(pszWorkDir);
+ pszWorkDir = NULL;
bDropMalPTRMsgs = 0;
bOptimizeUniProc = 1;
bPreserveFQDN = 0;
@@ -437,21 +463,15 @@
* rgerhards, 2008-04-17
*/
BEGINObjClassExit(glbl, OBJ_IS_CORE_MODULE) /* class, version */
- if(pszDfltNetstrmDrvr != NULL)
- free(pszDfltNetstrmDrvr);
- if(pszDfltNetstrmDrvrCAF != NULL)
- free(pszDfltNetstrmDrvrCAF);
- if(pszDfltNetstrmDrvrKeyFile != NULL)
- free(pszDfltNetstrmDrvrKeyFile);
- if(pszDfltNetstrmDrvrCertFile != NULL)
- free(pszDfltNetstrmDrvrCertFile);
- if(pszWorkDir != NULL)
- free(pszWorkDir);
- if(LocalHostName != NULL)
- free(LocalHostName);
+ free(pszDfltNetstrmDrvr);
+ free(pszDfltNetstrmDrvrCAF);
+ free(pszDfltNetstrmDrvrKeyFile);
+ free(pszDfltNetstrmDrvrCertFile);
+ free(pszWorkDir);
+ free(LocalDomain);
+ free(LocalHostName);
free(LocalHostNameOverride);
- if(LocalFQDNName != NULL)
- free(LocalFQDNName);
+ free(LocalFQDNName);
objRelease(prop, CORE_COMPONENT);
DESTROY_ATOMIC_HELPER_MUT(mutTerminateInputs);
ENDObjClassExit(glbl)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/runtime/msg.c new/rsyslog-5.8.11/runtime/msg.c
--- old/rsyslog-5.8.10/runtime/msg.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/runtime/msg.c 2012-04-27 10:10:28.000000000 +0200
@@ -1057,6 +1057,12 @@
objSerializePTR(pStrm, pCSAPPNAME, CSTR);
objSerializePTR(pStrm, pCSPROCID, CSTR);
objSerializePTR(pStrm, pCSMSGID, CSTR);
+
+ if(pThis->pRuleset != NULL) {
+ rulesetGetName(pThis->pRuleset);
+ CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRuleset"), PROPTYPE_PSZ,
+ rulesetGetName(pThis->pRuleset)));
+ }
/* offset must be serialized after pszRawMsg, because we need that to obtain the correct
* MSG size.
@@ -1663,6 +1669,16 @@
}
+/* rgerhards 2012-04-18: set associated ruleset (by ruleset name)
+ * If ruleset cannot be found, no update is done.
+ */
+static void
+MsgSetRulesetByName(msg_t *pMsg, cstr_t *rulesetName)
+{
+ rulesetGetRuleset(&(pMsg->pRuleset), rsCStrGetSzStrNoNULL(rulesetName));
+}
+
+
/* set TAG in msg object
* (rewritten 2009-06-18 rgerhards)
*/
@@ -1671,8 +1687,6 @@
uchar *pBuf;
assert(pMsg != NULL);
-dbgprintf("MsgSetTAG in: len %d, pszBuf: %s\n", lenBuf, pszBuf);
-
freeTAG(pMsg);
pMsg->iLenTAG = lenBuf;
@@ -1692,7 +1706,6 @@
memcpy(pBuf, pszBuf, pMsg->iLenTAG);
pBuf[pMsg->iLenTAG] = '\0'; /* this also works with truncation! */
-dbgprintf("MsgSetTAG exit: pMsg->iLenTAG %d, pMsg->TAG.szBuf: %s\n", pMsg->iLenTAG, pMsg->TAG.szBuf);
}
@@ -3200,8 +3213,13 @@
memcpy(&pThis->tRcvdAt, &pProp->val.vSyslogTime, sizeof(struct syslogTime));
} else if(isProp("tTIMESTAMP")) {
memcpy(&pThis->tTIMESTAMP, &pProp->val.vSyslogTime, sizeof(struct syslogTime));
+ } else if(isProp("pszRuleset")) {
+ MsgSetRulesetByName(pThis, pProp->val.pStr);
} else if(isProp("pszMSG")) {
dbgprintf("no longer supported property pszMSG silently ignored\n");
+ } else {
+ dbgprintf("unknown supported property '%s' silently ignored\n",
+ rsCStrGetSzStrNoNULL(pProp->pcsName));
}
finalize_it:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/runtime/queue.c new/rsyslog-5.8.11/runtime/queue.c
--- old/rsyslog-5.8.10/runtime/queue.c 2012-04-05 14:15:41.000000000 +0200
+++ new/rsyslog-5.8.11/runtime/queue.c 2012-05-03 13:52:27.000000000 +0200
@@ -1715,7 +1715,7 @@
}
/* but now cancellation is no longer permitted */
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
+ pthread_setcancelstate(iCancelStateSave, NULL);
finalize_it:
DBGPRINTF("regular consumer finished, iret=%d, szlog %d sz phys %d\n", iRet,
@@ -1768,7 +1768,7 @@
}
/* but now cancellation is no longer permitted */
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
+ pthread_setcancelstate(iCancelStateSave, NULL);
/* now we are done, but need to re-aquire the mutex */
d_pthread_mutex_lock(pThis->mut);
@@ -1847,7 +1847,6 @@
int wrk;
uchar *qName;
size_t lenBuf;
- int iQueueSizeSave;
ASSERT(pThis != NULL);
@@ -2245,8 +2244,13 @@
doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, void *pUsr)
{
DEFiRet;
+ int err;
struct timespec t;
+ if(glbl.GetGlobalInputTermState()) {
+ ABORT_FINALIZE(RS_RET_FORCE_TERM);
+ }
+
STATSCOUNTER_INC(pThis->ctrEnqueued, pThis->mutCtrEnqueued);
/* first check if we need to discard this message (which will cause CHKiRet() to exit)
*/
@@ -2273,15 +2277,48 @@
* It's a side effect, but a good one ;) -- rgerhards, 2008-03-14
*/
if(flowCtlType == eFLOWCTL_FULL_DELAY) {
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: FullDelay mark reached for full delayable message "
+ "- blocking.\n");
while(pThis->iQueueSize >= pThis->iFullDlyMrk) {
- DBGOPRINT((obj_t*) pThis, "enqueueMsg: FullDelay mark reached for full delayable message - blocking.\n");
- pthread_cond_wait(&pThis->belowFullDlyWtrMrk, pThis->mut); /* TODO error check? But what do then? */
+ /* We have a problem during shutdown if we block eternally. In that
+ * case, the the input thread cannot be terminated. So we wake up
+ * from time to time to check for termination.
+ * TODO/v6(at earliest): check if we could signal the condition during
+ * shutdown. However, this requires new queue registries and thus is
+ * far to much change for a stable version (and I am still not sure it
+ * is worth the effort, given how seldom this situation occurs and how
+ * few resources the wakeups need). -- rgerhards, 2012-05-03
+ * In any case, this was the old code (if we do the TODO):
+ * pthread_cond_wait(&pThis->belowFullDlyWtrMrk, pThis->mut);
+ */
+ timeoutComp(&t, 1000);
+ err = pthread_cond_timedwait(&pThis->belowLightDlyWtrMrk, pThis->mut, &t);
+ if(err != 0 && err != ETIMEDOUT) {
+ /* Something is really wrong now. Report to debug log and abort the
+ * wait. That keeps us running, even though we may lose messages.
+ */
+ DBGOPRINT((obj_t*) pThis, "potential program bug: pthread_cond_timedwait()"
+ "/fulldelay returned %d\n", err);
+ break;
+
+ }
+ DBGPRINTF("wti worker in full delay timed out, checking termination...\n");
+ if(glbl.GetGlobalInputTermState()) {
+ ABORT_FINALIZE(RS_RET_FORCE_TERM);
+ }
}
} else if(flowCtlType == eFLOWCTL_LIGHT_DELAY) {
if(pThis->iQueueSize >= pThis->iLightDlyMrk) {
- DBGOPRINT((obj_t*) pThis, "enqueueMsg: LightDelay mark reached for light delayable message - blocking a bit.\n");
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: LightDelay mark reached for light "
+ "delayable message - blocking a bit.\n");
timeoutComp(&t, 1000); /* 1000 millisconds = 1 second TODO: make configurable */
- pthread_cond_timedwait(&pThis->belowLightDlyWtrMrk, pThis->mut, &t); /* TODO error check? But what do then? */
+ err = pthread_cond_timedwait(&pThis->belowLightDlyWtrMrk, pThis->mut, &t);
+ if(err != 0 && err != ETIMEDOUT) {
+ /* Something is really wrong now. Report to debug log */
+ DBGOPRINT((obj_t*) pThis, "potential program bug: pthread_cond_timedwait()"
+ "/lightdelay returned %d\n", err);
+
+ }
}
}
@@ -2294,6 +2331,9 @@
|| (pThis->qType == QUEUETYPE_DISK && pThis->sizeOnDiskMax != 0
&& pThis->tVars.disk.sizeOnDisk > pThis->sizeOnDiskMax)) {
DBGOPRINT((obj_t*) pThis, "enqueueMsg: queue FULL - waiting to drain.\n");
+ if(glbl.GetGlobalInputTermState()) {
+ ABORT_FINALIZE(RS_RET_FORCE_TERM);
+ }
timeoutComp(&t, pThis->toEnq);
STATSCOUNTER_INC(pThis->ctrFull, pThis->mutCtrFull);
// TODO : handle enqOnly => discard!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/runtime/ruleset.c new/rsyslog-5.8.11/runtime/ruleset.c
--- old/rsyslog-5.8.10/runtime/ruleset.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/runtime/ruleset.c 2012-04-27 10:10:28.000000000 +0200
@@ -315,8 +315,8 @@
/* Find the ruleset with the given name and return a pointer to its object.
*/
-static rsRetVal
-GetRuleset(ruleset_t **ppRuleset, uchar *pszName)
+rsRetVal
+rulesetGetRuleset(ruleset_t **ppRuleset, uchar *pszName)
{
DEFiRet;
assert(ppRuleset != NULL);
@@ -338,7 +338,7 @@
DEFiRet;
assert(pszName != NULL);
- CHKiRet(GetRuleset(&pRuleset, pszName));
+ CHKiRet(rulesetGetRuleset(&pRuleset, pszName));
pDfltRuleset = pRuleset;
dbgprintf("default rule set changed to %p: '%s'\n", pRuleset, pszName);
@@ -356,7 +356,7 @@
DEFiRet;
assert(pszName != NULL);
- CHKiRet(GetRuleset(&pRuleset, pszName));
+ CHKiRet(rulesetGetRuleset(&pRuleset, pszName));
pCurrRuleset = pRuleset;
dbgprintf("current rule set changed to %p: '%s'\n", pRuleset, pszName);
@@ -591,7 +591,7 @@
pIf->SetName = setName;
pIf->DebugPrintAll = debugPrintAll;
pIf->GetCurrent = GetCurrent;
- pIf->GetRuleset = GetRuleset;
+ pIf->GetRuleset = rulesetGetRuleset;
pIf->SetDefaultRuleset = SetDefaultRuleset;
pIf->SetCurrRuleset = SetCurrRuleset;
pIf->GetRulesetQueue = GetRulesetQueue;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/runtime/ruleset.h new/rsyslog-5.8.11/runtime/ruleset.h
--- old/rsyslog-5.8.10/runtime/ruleset.h 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/runtime/ruleset.h 2012-04-27 10:10:28.000000000 +0200
@@ -54,6 +54,7 @@
qqueue_t* (*GetRulesetQueue)(ruleset_t*);
/* v3, 2009-11-04 */
parserList_t* (*GetParserList)(msg_t *);
+ /* v4 */
ENDinterface(ruleset)
#define rulesetCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */
@@ -61,4 +62,18 @@
/* prototypes */
PROTOTYPEObj(ruleset);
+
+/* Get name associated to ruleset. This function cannot fail (except,
+ * of course, if previously something went really wrong). Returned
+ * pointer is read-only.
+ * rgerhards, 2012-04-18
+ */
+static inline uchar*
+rulesetGetName(ruleset_t *pRuleset)
+{
+ return pRuleset->pszName;
+}
+
+
+rsRetVal rulesetGetRuleset(ruleset_t **ppRuleset, uchar *pszName);
#endif /* #ifndef INCLUDED_RULESET_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsyslog-5.8.10/tools/syslogd.c new/rsyslog-5.8.11/tools/syslogd.c
--- old/rsyslog-5.8.10/tools/syslogd.c 2012-04-05 14:10:45.000000000 +0200
+++ new/rsyslog-5.8.11/tools/syslogd.c 2012-05-03 13:52:27.000000000 +0200
@@ -21,7 +21,7 @@
* For further information, please see http://www.rsyslog.com
*
* rsyslog - An Enhanced syslogd Replacement.
- * Copyright 2003-2009 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2003-2012 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@@ -154,6 +154,7 @@
/* forward definitions */
static rsRetVal GlobalClassExit(void);
+static rsRetVal queryLocalHostname(void);
#ifndef _PATH_LOGCONF
@@ -1488,6 +1489,7 @@
pMod = module.GetNxtType(NULL, eMOD_IN);
while(pMod != NULL) {
if(pMod->mod.im.bCanRun) {
+ DBGPRINTF("trying to start input module '%s'\n", pMod->pszName);
/* activate here */
bNeedsCancel = (pMod->isCompatibleWithFeature(sFEATURENonCancelInputTermination) == RS_RET_OK) ?
0 : 1;
@@ -1897,6 +1899,11 @@
* is *NOT* the sighup handler. The signal is recorded by the handler, that record
* detected inside the mainloop and then this function is called to do the
* real work. -- rgerhards, 2008-10-22
+ * Note: there is a VERY slim chance of a data race when the hostname is reset.
+ * We prefer to take this risk rather than sync all accesses, because to the best
+ * of my analysis it can not really hurt (the actual property is reference-counted)
+ * but the sync would require some extra CPU for *each* message processed.
+ * rgerhards, 2012-04-11
*/
static inline void
doHUP(void)
@@ -1912,6 +1919,7 @@
logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, 0);
}
+ queryLocalHostname(); /* re-read our name */
ruleset.IterateAllActions(doHUPActions, NULL);
}
@@ -2329,6 +2337,93 @@
}
+/* query our host and domain names - we need to do this early as we may emit
+ * rgerhards, 2012-04-11
+ */
+static rsRetVal
+queryLocalHostname(void)
+{
+ uchar *LocalHostName;
+ uchar *LocalDomain;
+ uchar *LocalFQDNName;
+ uchar *p;
+ struct hostent *hent;
+ DEFiRet;
+
+ net.getLocalHostname(&LocalFQDNName);
+ CHKmalloc(LocalHostName = (uchar*) strdup((char*)LocalFQDNName));
+ glbl.SetLocalFQDNName(LocalFQDNName); /* set the FQDN before we modify it */
+ if((p = (uchar*)strchr((char*)LocalHostName, '.'))) {
+ *p++ = '\0';
+ LocalDomain = p;
+ } else {
+ LocalDomain = (uchar*)"";
+
+ /* It's not clearly defined whether gethostname()
+ * should return the simple hostname or the fqdn. A
+ * good piece of software should be aware of both and
+ * we want to distribute good software. Joey
+ *
+ * Good software also always checks its return values...
+ * If syslogd starts up before DNS is up & /etc/hosts
+ * doesn't have LocalHostName listed, gethostbyname will
+ * return NULL.
+ */
+ /* TODO: gethostbyname() is not thread-safe, but replacing it is
+ * not urgent as we do not run on multiple threads here. rgerhards, 2007-09-25
+ */
+ hent = gethostbyname((char*)LocalHostName);
+ if(hent) {
+ int i = 0;
+
+ if(hent->h_aliases) {
+ size_t hnlen;
+
+ hnlen = strlen((char *) LocalHostName);
+
+ for (i = 0; hent->h_aliases[i]; i++) {
+ if (!strncmp(hent->h_aliases[i], (char *) LocalHostName, hnlen)
+ && hent->h_aliases[i][hnlen] == '.') {
+ /* found a matching hostname */
+ break;
+ }
+ }
+ }
+
+ free(LocalHostName);
+ if(hent->h_aliases && hent->h_aliases[i]) {
+ CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_aliases[i]));
+ } else {
+ CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name));
+ }
+
+ if((p = (uchar*)strchr((char*)LocalHostName, '.')))
+ {
+ *p++ = '\0';
+ LocalDomain = p;
+ }
+ }
+ }
+
+ /* LocalDomain is "" or part of LocalHostName, allocate a new string */
+ CHKmalloc(LocalDomain = (uchar*)strdup(LocalDomain));
+
+ /* Convert to lower case to recognize the correct domain laterly */
+ for(p = LocalDomain ; *p ; p++)
+ *p = (char)tolower((int)*p);
+
+ /* we now have our hostname and can set it inside the global vars.
+ * TODO: think if all of this would better be a runtime function
+ * rgerhards, 2008-04-17
+ */
+ glbl.SetLocalHostName(LocalHostName);
+ glbl.SetLocalDomain(LocalDomain);
+ glbl.GenerateLocalHostNameProperty(); /* must be redone after conf processing, FQDN setting may have changed */
+finalize_it:
+ RETiRet;
+}
+
+
/* some support for command line option parsing. Any non-trivial options must be
* buffered until the complete command line has been parsed. This is necessary to
* prevent dependencies between the options. That, in turn, means we need to have
@@ -2530,9 +2625,7 @@
{
DEFiRet;
- register uchar *p;
int ch;
- struct hostent *hent;
extern int optind;
extern char *optarg;
int bEOptionWasGiven = 0;
@@ -2541,9 +2634,6 @@
int bChDirRoot = 1; /* change the current working directory to "/"? */
char *arg; /* for command line option processing */
uchar legacyConfLine[80];
- uchar *LocalHostName;
- uchar *LocalDomain;
- uchar *LocalFQDNName;
char cwdbuf[128]; /* buffer to obtain/display current working directory */
/* first, parse the command line options. We do not carry out any actual work, just
@@ -2651,7 +2741,7 @@
/* we need to create the inputName property (only once during our lifetime) */
CHKiRet(prop.Construct(&pInternalInputName));
- CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslogd"), sizeof("rsyslgod") - 1));
+ CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslogd"), sizeof("rsyslogd") - 1));
CHKiRet(prop.ConstructFinalize(pInternalInputName));
CHKiRet(prop.Construct(&pLocalHostIP));
@@ -2661,72 +2751,7 @@
/* get our host and domain names - we need to do this early as we may emit
* error log messages, which need the correct hostname. -- rgerhards, 2008-04-04
*/
- net.getLocalHostname(&LocalFQDNName);
- CHKmalloc(LocalHostName = (uchar*) strdup((char*)LocalFQDNName));
- glbl.SetLocalFQDNName(LocalFQDNName); /* set the FQDN before we modify it */
- if((p = (uchar*)strchr((char*)LocalHostName, '.'))) {
- *p++ = '\0';
- LocalDomain = p;
- } else {
- LocalDomain = (uchar*)"";
-
- /* It's not clearly defined whether gethostname()
- * should return the simple hostname or the fqdn. A
- * good piece of software should be aware of both and
- * we want to distribute good software. Joey
- *
- * Good software also always checks its return values...
- * If syslogd starts up before DNS is up & /etc/hosts
- * doesn't have LocalHostName listed, gethostbyname will
- * return NULL.
- */
- /* TODO: gethostbyname() is not thread-safe, but replacing it is
- * not urgent as we do not run on multiple threads here. rgerhards, 2007-09-25
- */
- hent = gethostbyname((char*)LocalHostName);
- if(hent) {
- int i = 0;
-
- if(hent->h_aliases) {
- size_t hnlen;
-
- hnlen = strlen((char *) LocalHostName);
-
- for (i = 0; hent->h_aliases[i]; i++) {
- if (!strncmp(hent->h_aliases[i], (char *) LocalHostName, hnlen)
- && hent->h_aliases[i][hnlen] == '.') {
- /* found a matching hostname */
- break;
- }
- }
- }
-
- free(LocalHostName);
- if(hent->h_aliases && hent->h_aliases[i]) {
- CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_aliases[i]));
- } else {
- CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name));
- }
-
- if((p = (uchar*)strchr((char*)LocalHostName, '.')))
- {
- *p++ = '\0';
- LocalDomain = p;
- }
- }
- }
-
- /* Convert to lower case to recognize the correct domain laterly */
- for(p = LocalDomain ; *p ; p++)
- *p = (char)tolower((int)*p);
-
- /* we now have our hostname and can set it inside the global vars.
- * TODO: think if all of this would better be a runtime function
- * rgerhards, 2008-04-17
- */
- glbl.SetLocalHostName(LocalHostName);
- glbl.SetLocalDomain(LocalDomain);
- glbl.GenerateLocalHostNameProperty(); /* must be redone after conf processing, FQDN setting may have changed */
+ queryLocalHostname();
/* initialize the objects */
if((iRet = modInitIminternal()) != RS_RET_OK) {
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org