[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Please unblock rsyslog 3.18.5-1



Hi release team,

please consider unblocking rsyslog 3.18.5-1.

The changelog is as follows.

rsyslog (3.18.5-1) unstable; urgency=low

  * New upstream bugfix release.
    - Fix potential segfault in imfile on rsyslogd HUP (reload) and
      termination (stop). Closes: #503940
    - Disable input throttling for imuxsock as this can lead to denial of
      service. Closes: #505991
  * debian/rsyslog-{mysql,pgsql}.config
    - Do not ignore errors in config maintainer scripts.
  * debian/rsyslog.postinst
    - Rotate old .0 log files when migrating from sysklogd. Closes: #491672
  * debian/rules
    - Exclude sample conf file from being compressed as it is referenced in
      the html documentation with the non-compressed file name.
    - Depend on $(QUILT_STAMPFN) instead of patch; patch is a phony target and
      thus always out of date.
    - Move $(QUILT_STAMPFN) dependency to config.status to avoid potential
      issues with parallel make.
  * debian/rsyslog-doc.links
    - Add a symlink index.html pointing at manual.html. Closes: #494634
  * debian/rsyslog.default
    - Fix a few spelling errors.
  * Disable the logrotate file when removing the package to avoid log
    rotation failures. Closes: #500569
    Thanks to Kobayashi Noritada for the patch
  * debian/rsyslog.postrm
    - Rename /etc/logrotate.d/rsyslog to /etc/logrotate.d/rsyslog.disabled
      when removing the package.
    - Remove /etc/logrotate.d/rsyslog.disabled when purging and replacing
      the package.
  * debian/rsyslog.preinst
    - Rename /etc/logrotate.d/rsyslog.disabled to /etc/logrotate.d/rsyslog
      when reinstalling.

 -- Michael Biebl <biebl@debian.org>  Thu, 20 Nov 2008 14:09:10 +0100


Although it is a new (bugfix only) upstream release, the actual code changes are
very small, as you can see from the attached debdiff. About 3/4 are
documentation updates.

The upstream changes contain about a dozen bug fixes, two of them have already
been reported against the BTS (#503940, #505991). Both are important bug fixes.
As the actual code changes are very small, I decided against backporting the
fixes (for one, it would require additinal work and there is always the chance
of screwing up a backport fix)

The packaging related changes are also important. Especially the fixes for
#491672 and #500569.

Given that rsyslog is now our default syslog for new installations, I expect
that people will also start migrating to rsyslog for old installations, so the
fix for #491672 will ensure a smooth upgrade.


Thanks a lot for your consideration,

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
 ChangeLog                                          |   77 ++++++++++++++++++++
 README                                             |    2 +-
 action.c                                           |    6 ++-
 cfsysline.c                                        |   10 ++--
 configure                                          |   20 +++---
 configure.ac                                       |    2 +-
 datetime.c                                         |   17 ++++-
 datetime.h                                         |   10 ++-
 debian/changelog                                   |   36 +++++++++
 debian/rsyslog-doc.links                           |    1 +
 debian/rsyslog-mysql.config                        |    2 +
 debian/rsyslog-pgsql.config                        |    2 +
 debian/rsyslog.default                             |    4 +-
 debian/rsyslog.postinst                            |   42 +++++++++++
 debian/rsyslog.postrm                              |   15 ++++
 debian/rsyslog.preinst                             |   11 +++
 debian/rules                                       |    6 +-
 doc/Makefile.am                                    |    2 +
 doc/Makefile.in                                    |    2 +
 doc/build_from_repo.html                           |   54 ++++++++++++++
 doc/imfile.html                                    |    8 +--
 doc/index.html                                     |   32 ++++++++
 doc/install.html                                   |   19 ++++-
 doc/manual.html                                    |    3 +-
 ...onf1_actionexeconlywhenpreviousissuspended.html |    8 +-
 doc/rsyslog_conf.html                              |    9 +--
 doc/rsyslog_ng_comparison.html                     |    8 +-
 doc/troubleshoot.html                              |    5 +-
 net.c                                              |   27 ++++++-
 omfile.c                                           |    2 +
 plugins/imfile/imfile.c                            |   18 ++++-
 plugins/imudp/imudp.c                              |    8 ++-
 plugins/imuxsock/imuxsock.c                        |    2 +-
 plugins/ommysql/ommysql.c                          |   24 ++++++-
 queue.c                                            |    2 +-
 rsyslog.conf.5                                     |   50 +++++++++++++-
 rsyslog.h                                          |    2 +-
 syslogd.c                                          |   19 +++--
 threads.c                                          |   12 ++-
 39 files changed, 502 insertions(+), 77 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7def1fb..77d7be7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,71 @@
 ---------------------------------------------------------------------------
+Version 3.18.5 (rgerhards), 2008-10-09
+- bugfix: imudp input module could cause segfault on HUP
+  It did not properly de-init a variable acting as a linked list head.
+  That resulted in trying to access freed memory blocks after the HUP.
+- bugfix:  rsyslogd could hang on HUP
+  because getnameinfo() is not cancel-safe, but was not guarded against
+  being cancelled. pthread_cancel() is routinely being called during
+  HUP processing.
+- bugfix[minor]: if queue size reached light_delay mark, enqueuing
+  could potentially be blocked for a longer period of time, which
+  was not the behaviour desired.
+- doc bugfix: $ActionExecOnlyWhenPreviousIsSuspended was still misspelled
+  as $...OnlyIfPrev... in some parts of the documentation. Thanks to 
+  Lorenzo M. Catucci for reporting this bug.
+- added doc on malformed messages, cause and how to work-around, to the
+  doc set
+- added doc on how to build from source repository
+---------------------------------------------------------------------------
+Version 3.18.4 (rgerhards), 2008-09-18
+- bugfix: order-of magnitude issue with base-10 size definitions
+  in config file parser. Could lead to invalid sizes, constraints
+  etc for e.g. queue files and any other object whose size was specified
+  in base-10 entities. Did not apply to binary entities. Thanks to
+  RB for finding this bug and providing a patch.
+- bugfix: action was not called when system time was set backwards
+  (until the previous time was reached again). There are still some
+  side-effects when time is rolled back (A time rollback is really a bad
+  thing to do, ideally the OS should issue pseudo time (like NetWare did)
+  when the user tries to roll back time). Thanks to varmojfekoj for this
+  patch.
+- doc bugfix: rsyslog.conf man page improved and minor nit fixed
+  thanks to Lukas Kuklinek for the patch.
+- bugfix: error code -2025 was used for two different errors. queue full
+  is now -2074 and -2025 is unique again. (did cause no real problem
+  except for troubleshooting)
+- bugfix: default discard severity was incorrectly set to 4, which lead
+  to discard-on-queue-full to be enabled by default. That could cause
+  message loss where non was expected.  The default has now been changed
+  to the correct value of 8, which disables the functionality. This
+  problem applied both to the main message queue and the action queues.
+  Thanks to Raoul Bhatia for pointing out this problem.
+- bugfix: option value for legacy -a option could not be specified,
+  resulting in strange operations. Thanks to Marius Tomaschewski
+  for the patch.
+- bugfix: colon after date should be ignored, but was not. This has
+  now been corrected. Required change to the internal ParseTIMESTAMP3164()
+  interface.
+---------------------------------------------------------------------------
+Version 3.18.3 (rgerhards), 2008-08-18
+- bugfix: imfile could cause a segfault upon rsyslogd HUP and termination
+  Thanks to lperr for an excellent bug report that helped detect this
+  problem.
+- enhanced ommysql to support custom port to connect to server
+  Port can be set via new $ActionOmmysqlServerPort config directive
+  Note: this was a very minor change and thus deemed appropriate to be
+  done in the stable release.
+- bugfix: misspelled config directive, previously was
+  $MainMsgQueueWorkeTimeoutrThreadShutdown, is now
+  $MainMsgQueueWorkerTimeoutThreadShutdown. Note that the misspelled
+  directive is not preserved - if the misspelled directive was used
+  (which I consider highly unlikely), the config file must be changed.
+  Thanks to lperr for reporting the bug.
+- disabled flow control for imuxsock, as it could cause system hangs
+  under some circumstances. The devel (3.21.3 and above) will
+  re-enable it and provide enhanced configurability to overcome the
+  problems if they occur.
+---------------------------------------------------------------------------
 Version 3.18.2 (rgerhards), 2008-08-08
 - merged in IPv6 forwarding address bugfix from v2-stable
 ---------------------------------------------------------------------------
@@ -602,6 +669,16 @@ Version 3.10.0 (rgerhards), 2008-01-07
 - much cleaner code due to new objects and removal of single-threading
   mode
 ---------------------------------------------------------------------------
+Version 2.0.6 V2-STABLE (rgerhards), 2008-??-??
+- bugfix: memory leaks in rsyslogd, primarily in singlethread mode
+  Thanks to Frederico Nunez for providing the fix
+- bugfix: copy&paste error lead to dangling if - this caused a very minor
+  issue with re-formatting a RFC3164 date when the message was invalidly
+  formatted and had a colon immediately after the date. This was in the
+  code for some years (even v1 had it) and I think it never had any
+  effect at all in practice. Though, it should be fixed - but definitely
+  nothing to worry about.
+---------------------------------------------------------------------------
 Version 2.0.6 V2-STABLE (rgerhards), 2008-08-07
 - bugfix: IPv6 addresses could not be specified in forwarding actions
   New syntax @[addr]:port introduced to enable that. Root problem was IPv6
diff --git a/README b/README
index e8cc42f..e929c83 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-This file has been superseeded by the fils in the doc folder.
+This file has been superseeded by the files in the doc folder.
 Please see doc/manual.html for futher details. If you are
 looking for install information doc/install.html is for you!
 If you do not have the doc set, see
diff --git a/action.c b/action.c
index 39c37b5..5de16b2 100644
--- a/action.c
+++ b/action.c
@@ -105,7 +105,7 @@ actionResetQueueParams(void)
 	iActionQHighWtrMark = 800;			/* high water mark for disk-assisted queues */
 	iActionQLowWtrMark = 200;			/* low water mark for disk-assisted queues */
 	iActionQDiscardMark = 9800;			/* begin to discard messages */
-	iActionQDiscardSeverity = 4;			/* discard warning and above */
+	iActionQDiscardSeverity = 8;			/* discard warning and above */
 	iActionQueueNumWorkers = 1;			/* number of worker threads for the mm queue above */
 	iActionQueMaxFileSize = 1024*1024;
 	iActionQPersistUpdCnt = 0;			/* persist queue info every n updates */
@@ -544,6 +544,10 @@ actionWriteToAction(action_t *pAction)
 	dbgprintf("Called action, logging to %s", module.GetStateName(pAction->pMod));
 
 	time(&now); /* we need this for message repeation processing AND $ActionExecOnlyOnceEveryInterval */
+	if(pAction->tLastExec > now) {
+		/* if we are traveling back in time, reset tLastExec */
+		pAction->tLastExec = (time_t) 0;
+	}
 	/* now check if we need to drop the message because otherwise the action would be too
 	 * frequently called. -- rgerhards, 2008-04-08
 	 */
diff --git a/cfsysline.c b/cfsysline.c
index d3203cc..cf8e087 100644
--- a/cfsysline.c
+++ b/cfsysline.c
@@ -213,11 +213,11 @@ static rsRetVal doGetSize(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *
 		case 'e': i *= (int64) 1024 * 1024 * 1024 * 1024 * 1024 * 1024; ++(*pp); break; /* exa */
 		/* and now the "new" 1000-based definitions */
 		case 'K': i *= 1000; ++(*pp); break;
-		case 'M': i *= 10000; ++(*pp); break;
-		case 'G': i *= 100000; ++(*pp); break;
-		case 'T': i *= 1000000; ++(*pp); break; /* tera */
-		case 'P': i *= 10000000; ++(*pp); break; /* peta */
-		case 'E': i *= 100000000; ++(*pp); break; /* exa */
+	        case 'M': i *= 1000000; ++(*pp); break;
+                case 'G': i *= 1000000000; ++(*pp); break;
+                case 'T': i *= 1000000000000; ++(*pp); break; /* tera */
+                case 'P': i *= 1000000000000000; ++(*pp); break; /* peta */
+                case 'E': i *= 1000000000000000000; ++(*pp); break; /* exa */
 	}
 
 	/* done */
diff --git a/configure b/configure
index 3c0ea43..f178adb 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for rsyslog 3.18.2.
+# Generated by GNU Autoconf 2.61 for rsyslog 3.18.5.
 #
 # Report bugs to <rsyslog@lists.adiscon.com>.
 #
@@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='rsyslog'
 PACKAGE_TARNAME='rsyslog'
-PACKAGE_VERSION='3.18.2'
-PACKAGE_STRING='rsyslog 3.18.2'
+PACKAGE_VERSION='3.18.5'
+PACKAGE_STRING='rsyslog 3.18.5'
 PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com'
 
 ac_unique_file="syslogd.c"
@@ -1447,7 +1447,7 @@ if test "$ac_init_help" = "long"; then
   # 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 3.18.2 to adapt to many kinds of systems.
+\`configure' configures rsyslog 3.18.5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1517,7 +1517,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of rsyslog 3.18.2:";;
+     short | recursive ) echo "Configuration of rsyslog 3.18.5:";;
    esac
   cat <<\_ACEOF
 
@@ -1644,7 +1644,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-rsyslog configure 3.18.2
+rsyslog configure 3.18.5
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1658,7 +1658,7 @@ cat >config.log <<_ACEOF
 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 3.18.2, which was
+It was created by rsyslog $as_me 3.18.5, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2348,7 +2348,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='rsyslog'
- VERSION='3.18.2'
+ VERSION='3.18.5'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -26650,7 +26650,7 @@ exec 6>&1
 # 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 3.18.2, which was
+This file was extended by rsyslog $as_me 3.18.5, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -26703,7 +26703,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-rsyslog config.status 3.18.2
+rsyslog config.status 3.18.5
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
index 4c7aac3..892a2ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT([rsyslog],[3.18.2],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[3.18.5],[rsyslog@lists.adiscon.com])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([syslogd.c])
 AC_CONFIG_HEADERS([config.h])
diff --git a/datetime.c b/datetime.c
index a4817a6..a178d14 100644
--- a/datetime.c
+++ b/datetime.c
@@ -265,10 +265,14 @@ ParseTIMESTAMP3339(struct syslogTime *pTime, char** ppszTS)
  * Returns TRUE on parse OK, FALSE on parse error.
  */
 static int
-ParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS)
+ParseTIMESTAMP3164(struct syslogTime *pTime, char** ppszTS)
 {
-	assert(pTime != NULL);
+	char *pszTS;
+
+	assert(ppszTS != NULL);
+	pszTS = *ppszTS;
 	assert(pszTS != NULL);
+	assert(pTime != NULL);
 
 	getCurrTime(pTime);	/* obtain the current year and UTC offsets! */
 
@@ -435,13 +439,20 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS)
 	pTime->second = srSLMGParseInt32(&pszTS);
 	if(pTime->second < 0 || pTime->second > 60)
 		return FALSE;
-	if(*pszTS++ != ':')
+
+	/* we provide support for an exter ":" after the date. While this is an
+	 * invalid format, it occurs frequently enough (e.g. with Cisco devices)
+	 * to permit it as a valid case. -- rgerhards, 2008-09-12
+	 */
+	if(*pszTS++ == ':')
+		++pszTS;
 
 	/* OK, we actually have a 3164 timestamp, so let's indicate this
 	 * and fill the rest of the properties. */
 	pTime->timeType = 1;
  	pTime->secfracPrecision = 0;
 	pTime->secfrac = 0;
+	*ppszTS = pszTS; /* provide updated parse position back to caller */
 	return TRUE;
 }
 
diff --git a/datetime.h b/datetime.h
index a35dfe8..9e11558 100644
--- a/datetime.h
+++ b/datetime.h
@@ -37,13 +37,19 @@ BEGINinterface(datetime) /* name must also be changed in ENDinterface macro! */
 	void (*getCurrTime)(struct syslogTime *t);
 	//static int srSLMGParseInt32(char** ppsz);
 	int (*ParseTIMESTAMP3339)(struct syslogTime *pTime, char** ppszTS);
-	int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char* pszTS);
+	int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char** pszTS);
 	int (*formatTimestampToMySQL)(struct syslogTime *ts, char* pDst, size_t iLenDst);
 	int (*formatTimestampToPgSQL)(struct syslogTime *ts, char *pDst, size_t iLenDst);
 	int (*formatTimestamp3339)(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
 	int (*formatTimestamp3164)(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
 ENDinterface(datetime)
-#define datetimeCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
+#define datetimeCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */
+/* interface changes:
+ * 1 - initial version
+ * 2 - not compatible to 1 - bugfix required ParseTIMESTAMP3164 to accept char ** as
+ *     last parameter. Did not try to remain compatible as this is not something any
+ *     third-party module should call. -- rgerhards, 2008.-09-12
+ */
 
 /* prototypes */
 PROTOTYPEObj(datetime);
diff --git a/debian/changelog b/debian/changelog
index 154a9fb..b9556e2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,39 @@
+rsyslog (3.18.5-1) unstable; urgency=low
+
+  * New upstream bugfix release.
+    - Fix potential segfault in imfile on rsyslogd HUP (reload) and
+      termination (stop). Closes: #503940
+    - Disable input throttling for imuxsock as this can lead to denial of
+      service. Closes: #505991
+  * debian/rsyslog-{mysql,pgsql}.config
+    - Do not ignore errors in config maintainer scripts.
+  * debian/rsyslog.postinst
+    - Rotate old .0 log files when migrating from sysklogd. Closes: #491672
+  * debian/rules
+    - Exclude sample conf file from being compressed as it is referenced in
+      the html documentation with the non-compressed file name.
+    - Depend on $(QUILT_STAMPFN) instead of patch; patch is a phony target and
+      thus always out of date.
+    - Move $(QUILT_STAMPFN) dependency to config.status to avoid potential
+      issues with parallel make.
+  * debian/rsyslog-doc.links
+    - Add a symlink index.html pointing at manual.html. Closes: #494634
+  * debian/rsyslog.default
+    - Fix a few spelling errors.
+  * Disable the logrotate file when removing the package to avoid log
+    rotation failures. Closes: #500569
+    Thanks to Kobayashi Noritada for the patch
+  * debian/rsyslog.postrm
+    - Rename /etc/logrotate.d/rsyslog to /etc/logrotate.d/rsyslog.disabled
+      when removing the package.
+    - Remove /etc/logrotate.d/rsyslog.disabled when purging and replacing
+      the package.
+  * debian/rsyslog.preinst
+    - Rename /etc/logrotate.d/rsyslog.disabled to /etc/logrotate.d/rsyslog
+      when reinstalling.
+
+ -- Michael Biebl <biebl@debian.org>  Thu, 20 Nov 2008 14:09:10 +0100
+
 rsyslog (3.18.2-1) unstable; urgency=low
 
   * New upstream release.
diff --git a/debian/rsyslog-doc.links b/debian/rsyslog-doc.links
new file mode 100644
index 0000000..cc4fa91
--- /dev/null
+++ b/debian/rsyslog-doc.links
@@ -0,0 +1 @@
+usr/share/doc/rsyslog-doc/html/manual.html usr/share/doc/rsyslog-doc/html/index.html
diff --git a/debian/rsyslog-mysql.config b/debian/rsyslog-mysql.config
index 9922a80..392bd4a 100644
--- a/debian/rsyslog-mysql.config
+++ b/debian/rsyslog-mysql.config
@@ -1,6 +1,8 @@
 #!/bin/sh
 # config maintainer script for rsyslog-mysql
 
+set -e
+
 # source debconf stuff
 . /usr/share/debconf/confmodule
 
diff --git a/debian/rsyslog-pgsql.config b/debian/rsyslog-pgsql.config
index d2084ed..0daa3d4 100644
--- a/debian/rsyslog-pgsql.config
+++ b/debian/rsyslog-pgsql.config
@@ -1,6 +1,8 @@
 #!/bin/sh
 # config maintainer script for rsyslog-pgsql
  
+set -e
+
 # source debconf stuff
 . /usr/share/debconf/confmodule
 
diff --git a/debian/rsyslog.default b/debian/rsyslog.default
index fe4b6e8..705c245 100644
--- a/debian/rsyslog.default
+++ b/debian/rsyslog.default
@@ -1,8 +1,8 @@
 # Options for rsyslogd
 # -m 0 disables 'MARK' messages (deprecated, only used in compat mode < 3)
 # -r enables logging from remote machines (deprecated, only used in compat mode < 3)
-# -x disables DNS lookups on messages recieved with -r
-# -c compatibilty mode
+# -x disables DNS lookups on messages received with -r
+# -c compatibility mode
 # See rsyslogd(8) for more details
 RSYSLOGD_OPTIONS="-c3"
 
diff --git a/debian/rsyslog.postinst b/debian/rsyslog.postinst
index 1df6726..8d93582 100644
--- a/debian/rsyslog.postinst
+++ b/debian/rsyslog.postinst
@@ -14,8 +14,50 @@ set -e
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
+rotate_old_log_files()
+{
+	log_files="syslog mail.info mail.warn mail.err mail.log daemon.log \
+	           kern.log auth.log user.log lpr.log cron.log debug messages"
+	skipped_files=""
+	dir=/var/log
+
+	for f in $log_files; do
+		if [ -e $dir/$f.0 ]; then
+			rotate="yes"
+			if [ -e $dir/$f.1.gz ]; then
+				date0=$(stat --format=%Y $dir/$f.0)
+				date1=$(stat --format=%Y $dir/$f.1.gz)
+				if [ $date0 -lt $date1 ] ; then
+					# .0 log file is older than .1
+					skipped_files="$dir/$f.0\n$skipped_files"
+					rotate="no"
+				fi
+			fi
+			if [ "$rotate" = "yes" ] ; then
+				for s in $(seq 9 -1 1) ; do
+					if [ -e $dir/$f.$s.gz ]; then
+						mv $dir/$f.$s.gz $dir/$f.$((s+1)).gz
+					fi
+				done
+				mv $dir/$f.0 $dir/$f.1
+			fi
+		fi
+	done
+	if [ -n "$skipped_files" ]; then
+		printf "The following old log files were found which could not be rotated safely.\n"
+		printf "\n$skipped_files\n"
+		printf "Please inspect them manually and delete them, if no longer required.\n"
+	fi
+}
+
+
 case "$1" in
     configure)
+	# Rotate .0 log files when migrating from sysklogd
+	if dpkg --compare-versions "$2" lt "3.18.5-1"; then
+		rotate_old_log_files
+	fi
+
 	# Stop the service on upgrades before it is started again.
 	# dh_installinit -r will create the start code.
 	if [ -n "$2" ]; then
diff --git a/debian/rsyslog.postrm b/debian/rsyslog.postrm
new file mode 100644
index 0000000..c73927b
--- /dev/null
+++ b/debian/rsyslog.postrm
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ]; then
+	[ -f /etc/logrotate.d/rsyslog ] && mv -f /etc/logrotate.d/rsyslog /etc/logrotate.d/rsyslog.disabled
+fi
+
+if [ "$1" = "purge" -o "$1" = "dissappear" ]; then
+	[ -f /etc/logrotate.d/rsyslog.disabled ] && rm -f /etc/logrotate.d/rsyslog.disabled
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rsyslog.preinst b/debian/rsyslog.preinst
new file mode 100644
index 0000000..ef0f856
--- /dev/null
+++ b/debian/rsyslog.preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "install" -a -n "$2" ] ; then
+	[ -f /etc/logrotate.d/rsyslog.disabled ] && mv -f /etc/logrotate.d/rsyslog.disabled /etc/logrotate.d/rsyslog
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rules b/debian/rules
index 5514ed3..13ccdcc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,7 +26,7 @@ else
 	CFLAGS += -O2
 endif
 
-config.status: configure
+config.status: $(QUILT_STAMPFN) configure
 	dh_testdir
 	# Add here commands to configure the package.
 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
@@ -48,7 +48,7 @@ endif
 
 build: build-stamp
 
-build-stamp: patch config.status
+build-stamp: config.status
 	dh_testdir
 
 	# Add here commands to compile the package.
@@ -90,7 +90,7 @@ binary-indep: build install
 	dh_installexamples
 	dh_install
 	dh_link
-	dh_compress
+	dh_compress -X .conf
 	dh_fixperms
 	dh_installdeb
 	dh_gencontrol
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 518b90e..34990d9 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,4 +1,5 @@
 html_files = \
+	index.html \
 	bugs.html \
 	debug.html \
 	features.html \
@@ -7,6 +8,7 @@ html_files = \
 	history.html \
 	how2help.html \
 	install.html \
+	build_from_repo.html \
 	ipv6.html \
 	log_rotation_fix_size.html \
 	manual.html \
diff --git a/doc/Makefile.in b/doc/Makefile.in
index e6d20e6..338a948 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -171,6 +171,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 zlib_libs = @zlib_libs@
 html_files = \
+	index.html \
 	bugs.html \
 	debug.html \
 	features.html \
@@ -179,6 +180,7 @@ html_files = \
 	history.html \
 	how2help.html \
 	install.html \
+	build_from_repo.html \
 	ipv6.html \
 	log_rotation_fix_size.html \
 	manual.html \
diff --git a/doc/build_from_repo.html b/doc/build_from_repo.html
new file mode 100644
index 0000000..8d3b20f
--- /dev/null
+++ b/doc/build_from_repo.html
@@ -0,0 +1,54 @@
+<html><head>
+<title>Building rsyslog from the source repository</title>
+</head>
+<body>
+<h1>Building rsyslog from the source repository</h1>
+<p>In most cases, people install rsyslog either via a package or use an "official"
+distribution tarball to generate it. But there may be situations where it is desirable
+to build directly from the source repository. This is useful for people who would like to
+participate in development or who would like to use the latest, not-yet-released code.
+The later may especially be the case if you are asked to try out an experimental version.
+<p>Building from the repsitory is not much different than building from the source
+tarball, but some files are missing because they are output files and thus do not
+belong into the repository.
+<h2>Obtaining the Source</h2>
+<p>First of all, you need to download the sources. Rsyslog is currently kept in a git
+repository. You can clone this repository either via http or git protocol (with the later
+being much faster. URLS are:
+<ul>
+<li>git://git.adiscon.com/git/rsyslog.git
+<li>http://git.adiscon.com/git/rsyslog.git
+</ul>
+<p>There is also a browsable version (gitweb) available at
+<a href="http://git.adiscon.com/?p=rsyslog.git;a=summary";>http://git.adiscon.com/?p=rsyslog.git;a=summary</a>.
+This version also offers snapshots of each commit for easy download. You can use these if
+you do not have git present on your system.
+<p>After you have cloned the repository, you are in the master branch by default. This
+is where we keep the devel branch. If you need any other branch, you need to do
+a "git checkout --track -b branch origin/branch". For example, the command to check out
+the beta branch is "git checkout --track -b beta origin/beta".
+<h2>Prequisites</h2>
+<p>To build the compilation system, you need the <b>pkg-config</b> package (an utility for
+autotools) present on your system. Otherwise, configure will fail with something like
+<pre><code>
+checking for SYSLOG_UNIXAF support... yes
+checking for FSSTND support... yes
+./configure: line 25895: syntax error near unexpected token `RELP,'
+./configure: line 25895: ` PKG_CHECK_MODULES(RELP, relp >= 0.1.1)'
+</code></pre>
+<h2>Creating the Build Environment</h2>
+<p>This is fairly easy: just issue "<b>autoreconf -fvi</b>", which should do everything you need.
+Once this is done, you can follow the usual ./configure steps just like when
+you downloaded an official distribution tarball (see the
+<a href="install.html">rsyslog install guide</a>, starting at step 2,
+for further details about that).
+
+<p>[<a href="manual.html">manual index</a>]
+[<a href="http://www.rsyslog.com/";>rsyslog site</a>]</p>
+<p><font size="2">This documentation is part of the
+<a href="http://www.rsyslog.com/";>rsyslog</a> project.<br>
+Copyright &copy; 2008 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 1.2 or higher.</font></p>
+</body>
+</html>
diff --git a/doc/imfile.html b/doc/imfile.html
index 6fc6c2e..5bdbce5 100644
--- a/doc/imfile.html
+++ b/doc/imfile.html
@@ -125,10 +125,8 @@ $InputFilePollingInterval 10
 <p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>]
 [<a href="manual.html">manual index</a>] [<a href="http://www.rsyslog.com/";>rsyslog site</a>]</p>
 <p><font size="2">This documentation is part of the
-<a href="http://www.rsyslog.com/";>rsyslog</a>
-project.<br>
-Copyright © 2008 by <a href="http://www.gerhards.net/rainer";>Rainer
-Gerhards</a> and
-<a href="http://www.adiscon.com/";>Adiscon</a>.
+<a href="http://www.rsyslog.com/";>rsyslog</a> project.<br>
+Copyright &copy; 2008 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 --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..349c8e5
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><title>Welcome to rsyslog</title></head>
+<body>
+<h1>Welcome to rsyslog</h1>
+<p><b><a href="http://www.rsyslog.com/";>Rsyslog</a>
+is an enhanced syslogd suitable both for small systems as
+well as large enterprises.</b>
+<p>This page provide a few quick pointers which hopefully make your
+experience with rsyslog a pleasant one. These are
+<ul>
+<li><b>Most importantly, the <a href="manual.html">rsyslog manual</a></b> - this points to locally
+installed documentation which exactly matches the version you have installed.
+It is highly suggested to at least briefly look over these files.
+<li>The <a href="http://www.rsyslog.com";>rsyslog web site</a> which offers
+probably every information you'll ever need (ok, just kidding...).
+<li>The <a href="http://www.rsyslog.com/doc-status.html";>project status page</a> provides
+information on current releases
+<li>and the <a href="troubleshoot.html">troubleshooting guide</a> hopefully helps if
+things do not immediately work out
+</ul>
+<p>In general, rsyslog supports plain old syslog.conf format, except that the
+config file is now called rsyslog.conf. This should help you get started
+quickly.
+To do the really cool things, though,
+you need to learn a bit about its new features.
+The man pages offer a bare minimum of information (and are still quite long). Read the 
+<a href="manual.html">html documentation</a> instead.
+When you change the configuration,
+remember to restart (or HUP) rsyslogd, because otherwise it won't use your
+new settings (and you'll end up totally puzzled why this great config of yours
+does not even work a bit...;))
+</body></html>
diff --git a/doc/install.html b/doc/install.html
index 661ae94..48b7f64 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -24,7 +24,11 @@ you volunteer to create one, <a href="mailto:rgerhards@adiscon.com";>drop me a
 line</a>). Thus, this guide focuses on installing from the source, which 
 thankfully is <b>quite easy</b>.</p>
 <h3>Step 1 - Download Software</h3>
-<p>For obvious reasons, you need to download rsyslog. Load the most recent build 
+<p>For obvious reasons, you need to download rsyslog. Here, I assume that you
+use a distribution tarball. If you would like to use a version directly from
+the repository, see <a href="build_from_repo.html">build rsyslog from repository</a>
+instead.
+<p>Load the most recent build 
 from <a href="http://www.rsyslog.com/downloads";>http://www.rsyslog.com/downloads</a>. 
 Extract the software with &quot;tar xzf -nameOfDownloadSet-&quot;. This will create a new 
 subdirectory rsyslog-version in the current working directory. CD into that. </p>
@@ -150,9 +154,12 @@ comments or bug sighting reports are very welcome. Please
 	<li>2007-07-13 * 
 	<a href="http://www.adiscon.com/en/people/rainer-gerhards.php";>Rainer Gerhards</a>&nbsp; 
 	* updated to new autotools-based build system</li>
+	<li>2008-10-01 * 
+	<a href="http://www.adiscon.com/en/people/rainer-gerhards.php";>Rainer Gerhards</a>&nbsp; 
+	* added info on building from source repository</li>
 </ul>
 <h3>Copyright</h3>
-<p>Copyright (c)  2005, 2007 
+<p>Copyright &copy;  2005-2008
 <a href="http://www.adiscon.com/en/people/rainer-gerhards.php";>Rainer Gerhards</a> and
 <a href="http://www.adiscon.com/en/";>Adiscon</a>.</p>
 <p>      Permission is granted to copy, distribute and/or modify this document
@@ -162,6 +169,12 @@ comments or bug sighting reports are very welcome. Please
 	 Texts.  A copy of the license can be viewed at
 <a href="http://www.gnu.org/copyleft/fdl.html";>
 http://www.gnu.org/copyleft/fdl.html</a>.</p>
-
+<p>[<a href="manual.html">manual index</a>]
+[<a href="http://www.rsyslog.com/";>rsyslog site</a>]</p>
+<p><font size="2">This documentation is part of the
+<a href="http://www.rsyslog.com/";>rsyslog</a> project.<br>
+Copyright &copy; 2008 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 1.2 or higher.</font></p>
 </body>
 </html>
diff --git a/doc/manual.html b/doc/manual.html
index eae38d1..f0c02fd 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -16,7 +16,7 @@ relay chains while at the same time being very easy to setup for the
 novice user. And as we know what enterprise users really need, there is
 also <a href="professional_support.html">professional
 rsyslog support</a> available directly from the source!</p>
-<p><b>This documentation is for version 3.18.2 (v3-stable branch) of rsyslog.</b>
+<p><b>This documentation is for version 3.18.5 (v3-stable branch) of rsyslog.</b>
 Visit the <i> <a href="http://www.rsyslog.com/doc-status.html";>rsyslog status page</a></i></b> to obtain current
 version information and project status.
 </p><p><b>If you like rsyslog, you might
@@ -50,6 +50,7 @@ modules</a></li><li><a href="man_rsyslogd.html">rsyslogd man page</a>
 <p><b>We have some in-depth papers on</b></p>
 <ul>
 <li><a href="install.html">installing rsyslog</a></li>
+<li><a href="build_from_repo.html">obtaining rsyslog from the source repository</a></li>
 <li><a href="ipv6.html">rsyslog and IPv6</a> (which is fully supported)</li>
 <li><a href="rsyslog_stunnel.html">ssl-encrypting syslog with stunnel</a></li>
 <li><a href="rsyslog_mysql.html">writing syslog messages to MySQL (and other databases as well)</a></li>
diff --git a/doc/rsconf1_actionexeconlywhenpreviousissuspended.html b/doc/rsconf1_actionexeconlywhenpreviousissuspended.html
index 3f18e24..d5cf8b1 100644
--- a/doc/rsconf1_actionexeconlywhenpreviousissuspended.html
+++ b/doc/rsconf1_actionexeconlywhenpreviousissuspended.html
@@ -9,14 +9,14 @@
 <p><b>Description:</b></p>
 <p>This directive allows to specify if actions should always be executed ("off," the default) or only if the previous action is suspended ("on"). This directive works hand-in-hand with the multiple actions per selector feature. It can be used, for example, to create rules that automatically switch destination servers or databases to a (set of) backup(s), if the primary server fails. Note that this feature depends on proper implementation of the suspend feature in the output module. All built-in output modules properly support it (most importantly the database write and the syslog message forwarder).</p>
 <p>This selector processes all messages it receives (*.*).  It tries to forward every message to primary-syslog.example.com (via tcp). If it can not reach that server, it tries secondary-1-syslog.example.com, if that fails too, it tries secondary-2-syslog.example.com. If neither of these servers can be connected, the data is stored in /var/log/localbuffer. Please note that the secondaries and the local log buffer are only used if the one before them does not work. So ideally, /var/log/localbuffer will never receive a message. If one of the servers resumes operation, it automatically takes over processing again.</p>
-<p>We strongly advise not to use repeated line reduction together with ActionExecOnlyIfPreviousIsSuspended. It may lead to "interesting" and undesired results (but you can try it if you like).</p>
+<p>We strongly advise not to use repeated line reduction together with ActionExecOnlyWhenPreviousIsSuspended. It may lead to "interesting" and undesired results (but you can try it if you like).</p>
 <p><b>Sample:</b></p>
 <p><code><b>*.* @@primary-syslog.example.com
-<br>$ActionExecOnlyIfPreviousIsSuspended on
+<br>$ActionExecOnlyWhenPreviousIsSuspended on
 <br>&   @@secondary-1-syslog.example.com    # & is used to have more than one action for
 <br>&   @@secondary-2-syslog.example.com    # the same selector - the mult-action feature
 <br>&   /var/log/localbuffer
-<br>$ActionExecOnlyIfPreviousIsSuspended off # to re-set it for the next selector </b></code></p>
+<br>$ActionExecOnlyWhenPreviousIsSuspended off # to re-set it for the next selector </b></code></p>
 
 <p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>] [<a href="manual.html">manual 
 index</a>] [<a href="http://www.rsyslog.com/";>rsyslog site</a>]</p>
@@ -26,4 +26,4 @@ Copyright &copy; 2007 by <a href="http://www.gerhards.net/rainer";>Rainer Gerhard
 <a href="http://www.adiscon.com/";>Adiscon</a>. Released under the GNU GPL 
 version 2 or higher.</font></p>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index e65be0b..1073cf5 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -29,8 +29,8 @@ what they do (list is currently not complete)</p>
 trap output module</li>
 <li><a href="omrelp.html">omrelp</a> - RELP
 output module</li>
-<li>omgss - output module for GSS-enabled syslog</li>
-<li>ommysql - output module for MySQL</li>
+<li>omgssapi - output module for GSS-enabled syslog</li>
+<li><a href="ommysql.html">ommysql</a> - output module for MySQL</li>
 <li>ompgsql - output module for PostgreSQL</li>
 <li><a href="omlibdbi.html">omlibdbi</a> -
 generic database output module (Firebird/Interbase, MS SQL, Sybase,
@@ -45,7 +45,7 @@ input module</li>
 <li><a href="imtcp.html">imtcp</a> - input
 plugin for plain tcp syslog</li>
 <li><a href="imgssapi.html">imgssapi</a> -
-input plugin for plain tcp and GSS-enable syslog</li>
+input plugin for plain tcp and GSS-enabled syslog</li>
 <li>immark - support for mark messages</li>
 <li><a href="imklog.html">imklog</a> - kernel logging</li>
 <li><a href="imuxsock.html">imuxsock</a> -
@@ -1197,6 +1197,5 @@ When compared to syslogd from sysklogd package, rsyslogd offers
 additional
 <a href="features.html">features</a> (like template
 and database support). For obvious reasons, the syntax for defining
-such features is available in rsyslogd, only.<br>
-&nbsp;</p>
+such features is available in rsyslogd, only.</p>
 </body></html>
diff --git a/doc/rsyslog_ng_comparison.html b/doc/rsyslog_ng_comparison.html
index 2841333..aac543a 100644
--- a/doc/rsyslog_ng_comparison.html
+++ b/doc/rsyslog_ng_comparison.html
@@ -424,11 +424,11 @@ directories (log targets) dynamically</td>
 <td valign="top">control of log output format,
 including ability to present channel and priority as visible log data</td>
 <td valign="top">yes</td>
-<td valign="top">not sure...</td>
+<td valign="top">yes</td>
 </tr>
 <tr><td valign="top">native ability to send mail messages</td>
 <td valign="top">yes (<a href="ommail.html">ommail</a>, introduced in 3.17.0)</td>
-<td valign="top">not sure...</td>
+<td valign="top">no (only via piped external process)</td>
 </tr>
 <tr>
 <td valign="top">good timestamp format control; at a
@@ -578,6 +578,6 @@ feature sheet. I have not yet been able to fully work through it. In
 the mean time, you may want to read it in parallel. It is available at
 <a href="http://www.balabit.com/network-security/syslog-ng/features/detailed/";>Balabit's
 site</a>.</p>
-<p>This document is current as of 2008-04-08 and definitely
+<p>This document is current as of 2008-08-15 and definitely
 incomplete (I did not yet manage to complete it!).</p>
-</body></html>
\ No newline at end of file
+</body></html>
diff --git a/doc/troubleshoot.html b/doc/troubleshoot.html
index f2e9206..b1e9c4a 100644
--- a/doc/troubleshoot.html
+++ b/doc/troubleshoot.html
@@ -5,13 +5,16 @@
 <p><b>Having trouble with <a href="http://www.rsyslog.com";>rsyslog</a>?</b>
 This page provides some tips on where to look for help and what to do
 if you need to ask for assistance. This page is continously being expanded.
-<p>Useful troublehshooting ressources are:
+<p>Useful troubleshooting ressources are:
 <ul>
 <li>The <a href="http://www.rsyslog.com/doc";>rsyslog documentation</a> - note that the online version always covers
 the most recent development version. However, there is a version-specific
 doc set in each tarball. If you installed rsyslog from a package, there usually
 is a rsyslog-doc package, that often needs to be installed separately.
 <li>The <a href="http://wiki.rsyslog.com";>rsyslog wiki</a> provides user tips and experiences.
+<li>A common trouble source are <a href="syslog_parsing.html">ill-formed syslog messages</a>, which
+lead to to all sorts of interesting problems, including malformed hostnames and dates. Read the quoted
+guide to find relief.
 </ul>
 <p><b>Asking for Help</b>
 <p>If you can't find the answer yourself, you should look at these places for
diff --git a/net.c b/net.c
index bbd6bec..4054b86 100644
--- a/net.c
+++ b/net.c
@@ -106,6 +106,27 @@ static inline void MaskIP4 (struct in_addr  *addr, uint8_t bits) {
 #define SIN(sa)  ((struct sockaddr_in  *)(sa))
 #define SIN6(sa) ((struct sockaddr_in6 *)(sa))
 
+
+/* This is a cancel-safe getnameinfo() version, because we learned
+ * (via drd/valgrind) that getnameinfo() seems to have some issues
+ * when being cancelled, at least if the module was dlloaded.
+ * rgerhards, 2008-09-30
+ */
+static inline int
+mygetnameinfo(const struct sockaddr *sa, socklen_t salen,
+                       char *host, size_t hostlen,
+                       char *serv, size_t servlen, int flags)
+{
+	int iCancelStateSave;
+	int i;
+
+	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
+	i = getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
+	pthread_setcancelstate(iCancelStateSave, NULL);
+	return i;
+}
+
+
 /* This function adds an allowed sender entry to the ACL linked list.
  * In any case, a single entry is added. If an error occurs, the
  * function does its error reporting itself. All validity checks
@@ -368,7 +389,7 @@ void PrintAllowedSenders(int iListToPrint)
 			if (F_ISSET(pSender->allowedSender.flags, ADDR_NAME))
 				dbgprintf ("\t%s\n", pSender->allowedSender.addr.HostWildcard);
 			else {
-				if(getnameinfo (pSender->allowedSender.addr.NetAddr,
+				if(mygetnameinfo (pSender->allowedSender.addr.NetAddr,
 						     SALEN(pSender->allowedSender.addr.NetAddr),
 						     (char*)szIP, 64, NULL, 0, NI_NUMERICHOST) == 0) {
 					dbgprintf ("\t%s/%u\n", szIP, pSender->SignificantBits);
@@ -642,7 +663,7 @@ gethname(struct sockaddr_storage *f, uchar *pszHostFQDN)
 	assert(f != NULL);
 	assert(pszHostFQDN != NULL);
 
-        error = getnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *)f),
+        error = mygetnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *)f),
 			    ip, sizeof ip, NULL, 0, NI_NUMERICHOST);
 
         if (error) {
@@ -656,7 +677,7 @@ gethname(struct sockaddr_storage *f, uchar *pszHostFQDN)
 		sigaddset(&nmask, SIGHUP);
 		pthread_sigmask(SIG_BLOCK, &nmask, &omask);
 
-		error = getnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *) f),
+		error = mygetnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *) f),
 				    (char*)pszHostFQDN, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
 		
 		if (error == 0) {
diff --git a/omfile.c b/omfile.c
index 6a53a72..0b16cd5 100644
--- a/omfile.c
+++ b/omfile.c
@@ -296,6 +296,8 @@ int resolveFileSizeLimit(instanceData *pData)
 
 	execProg(pCmd, 1, pParams);
 
+	free(pCmd);
+
 	pData->fd = open((char*) pData->f_fname, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY,
 			pData->fCreateMode);
 
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 75e54f0..2df1aaf 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -182,16 +182,19 @@ static void pollFileCancelCleanup(void *pArg)
 /* poll a file, need to check file rollover etc. open file if not open */
 static rsRetVal pollFile(fileInfo_t *pThis, int *pbHadFileData)
 {
-	DEFiRet;
 	cstr_t *pCStr = NULL;
+	DEFiRet;
 
 	ASSERT(pbHadFileData != NULL);
 
+	/* Note: we must do pthread_cleanup_push() immediately, because the POXIS macros
+	 * otherwise do not work if I include the _cleanup_pop() inside an if... -- rgerhards, 2008-08-14
+	 */
+	pthread_cleanup_push(pollFileCancelCleanup, &pCStr);
 	if(pThis->pStrm == NULL) {
 		CHKiRet(openFile(pThis)); /* open file */
 	}
 
-	pthread_cleanup_push(pollFileCancelCleanup, &pCStr);
 	/* loop below will be exited when strmReadLine() returns EOF */
 	while(1) {
 		CHKiRet(strmReadLine(pThis->pStrm, &pCStr));
@@ -199,9 +202,18 @@ static rsRetVal pollFile(fileInfo_t *pThis, int *pbHadFileData)
 		CHKiRet(enqLine(pThis, pCStr)); /* process line */
 		rsCStrDestruct(&pCStr); /* discard string (must be done by us!) */
 	}
-	pthread_cleanup_pop(0);
 
 finalize_it:
+	/*EMPTY - just to keep the compiler happy, do NOT remove*/;
+	/* Note: the problem above is that pthread:cleanup_pop() is a macro which
+	 * evaluates to something like "} while(0);". So the code would become
+	 * "finalize_it: }", that is a label without a statement. The C standard does
+	 * not permit this. So we add an empty statement "finalize_it: ; }" and
+	 * everybody is happy. Note that without the ;, an error is reported only
+	 * on some platforms/compiler versions. -- rgerhards, 2008-08-15
+	 */
+	pthread_cleanup_pop(0);
+
 	if(pCStr != NULL) {
 		rsCStrDestruct(&pCStr);
 	}
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index cda794c..81e7d7a 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -242,10 +242,14 @@ CODESTARTafterRun
 		net.clearAllowedSenders (net.pAllowedSenders_UDP);
 		net.pAllowedSenders_UDP = NULL;
 	}
-	if(udpLstnSocks != NULL)
+	if(udpLstnSocks != NULL) {
 		net.closeUDPListenSockets(udpLstnSocks);
-	if(pRcvBuf != NULL)
+		udpLstnSocks = NULL;
+	}
+	if(pRcvBuf != NULL) {
 		free(pRcvBuf);
+		pRcvBuf = NULL;
+	}
 ENDafterRun
 
 
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index f879803..60ccaff 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -181,7 +181,7 @@ static rsRetVal readSocket(int fd, int bParseHost, int flags)
 	iRcvd = recv(fd, line, MAXLINE - 1, 0);
 	dbgprintf("Message from UNIX socket: #%d\n", fd);
 	if (iRcvd > 0) {
-		parseAndSubmitMessage((char*)LocalHostName, line, iRcvd, bParseHost, flags, eFLOWCTL_LIGHT_DELAY);
+		parseAndSubmitMessage((char*)LocalHostName, line, iRcvd, bParseHost, flags, eFLOWCTL_NO_DELAY);
 	} else if (iRcvd < 0 && errno != EINTR) {
 		char errStr[1024];
 		rs_strerror_r(errno, errStr, sizeof(errStr));
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index 0522e31..807351d 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -44,6 +44,7 @@
 #include "ommysql.h"
 #include "module-template.h"
 #include "errmsg.h"
+#include "cfsysline.h"
 
 MODULE_TYPE_OUTPUT
 
@@ -55,12 +56,16 @@ DEFobjCurrIf(errmsg)
 typedef struct _instanceData {
 	MYSQL	*f_hmysql;		/* handle to MySQL */
 	char	f_dbsrv[MAXHOSTNAMELEN+1];	/* IP or hostname of DB server*/ 
+	unsigned int f_dbsrvPort;		/* port of MySQL server */
 	char	f_dbname[_DB_MAXDBLEN+1];	/* DB name */
 	char	f_dbuid[_DB_MAXUNAMELEN+1];	/* DB user */
 	char	f_dbpwd[_DB_MAXPWDLEN+1];	/* DB user's password */
 	unsigned uLastMySQLErrno;	/* last errno returned by MySQL or 0 if all is well */
 } instanceData;
 
+/* config variables */
+static int iSrvPort = 0;	/* database server port */
+
 
 BEGINcreateInstance
 CODESTARTcreateInstance
@@ -150,7 +155,7 @@ static rsRetVal initMySQL(instanceData *pData, int bSilent)
 	} else { /* we could get the handle, now on with work... */
 		/* Connect to database */
 		if(mysql_real_connect(pData->f_hmysql, pData->f_dbsrv, pData->f_dbuid,
-				      pData->f_dbpwd, pData->f_dbname, 0, NULL, 0) == NULL) {
+				      pData->f_dbpwd, pData->f_dbname, pData->f_dbsrvPort, NULL, 0) == NULL) {
 			reportDBError(pData, bSilent);
 			closeMySQL(pData); /* ignore any error we may get */
 			iRet = RS_RET_SUSPENDED;
@@ -273,6 +278,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
 		errmsg.LogError(NO_ERRCODE, "Trouble with MySQL connection properties. -MySQL logging disabled");
 		ABORT_FINALIZE(RS_RET_INVALID_PARAMS);
 	} else {
+		pData->f_dbsrvPort = (unsigned) iSrvPort;	/* set configured port */
 		pData->f_hmysql = NULL; /* initialize, but connect only on first message (important for queued mode!) */
 	}
 
@@ -291,12 +297,24 @@ CODEqueryEtryPt_STD_OMOD_QUERIES
 ENDqueryEtryPt
 
 
+/* Reset config variables for this module to default values.
+ */
+static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
+{
+	DEFiRet;
+	iSrvPort = 0; /* zero is the default port */
+	RETiRet;
+}
+
 BEGINmodInit()
 CODESTARTmodInit
 	*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
 CODEmodInit_QueryRegCFSLineHdlr
 	CHKiRet(objUse(errmsg, CORE_COMPONENT));
+	/* 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));
 ENDmodInit
-/*
- * vi:set ai:
+
+/* vi:set ai:
  */
diff --git a/queue.c b/queue.c
index 081f48b..37782cf 100644
--- a/queue.c
+++ b/queue.c
@@ -2142,7 +2142,7 @@ queueEnqObj(queue_t *pThis, flowControl_t flowCtlType, void *pUsr)
 			pthread_cond_wait(&pThis->belowFullDlyWtrMrk, pThis->mut); /* TODO error check? But what do then? */
 		}
 	} else if(flowCtlType == eFLOWCTL_LIGHT_DELAY) {
-		while(pThis->iQueueSize >= pThis->iLightDlyMrk) {
+		if(pThis->iQueueSize >= pThis->iLightDlyMrk) {
 			dbgoprint((obj_t*) pThis, "enqueueMsg: LightDelay mark reached for light delayble 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? */
diff --git a/rsyslog.conf.5 b/rsyslog.conf.5
index eb49853..0a2422c 100644
--- a/rsyslog.conf.5
+++ b/rsyslog.conf.5
@@ -91,7 +91,7 @@ $ModLoad imtcp
 $InputTCPServerRun 514
 .TP
 .TP
-.I imtcp
+.I imrelp
 Input plugin for the RELP protocol. RELP can be used instead
 of UDP or plain TCP syslog to provide reliable delivery of
 syslog messages. Please note that plain TCP syslog does NOT
@@ -159,6 +159,54 @@ Every rule line consists of two fields, a selector field and an action field. Th
 two fields are separated by one or more spaces or tabs. The selector field specifies 
 a pattern of facilities and priorities belonging to the specified action.
 
+.SH SELECTORS
+
+The selector field itself again consists of two parts, a facility and a
+priority, separated by a period ('.'). Both parts are case insensitive and can
+also be specified as decimal numbers, but don't do that, you have been warned.
+Both facilities and priorities are described in rsyslog(3). The names mentioned
+below correspond to the similar LOG_-values in /usr/include/rsyslog.h.
+
+The facility is one of the following keywords: auth, authpriv, cron, daemon,
+kern, lpr, mail, mark, news, security (same as auth), syslog, user, uucp and
+local0 through local7. The keyword security should not be used anymore and mark
+is only for internal use and therefore should not be used in applications.
+Anyway, you may want to specify and redirect these messages here. The facility
+specifies the subsystem that produced the message, i.e. all mail programs log
+with the mail facility (LOG_MAIL) if they log using syslog.
+
+The priority is one of the following keywords, in ascending order: debug, info,
+notice, warning, warn (same as warning), err, error (same as err), crit, alert,
+emerg, panic (same as emerg). The keywords error, warn and panic are deprecated
+and should not be used anymore. The priority defines the severity of the message.
+
+The behavior of the original BSD syslogd is that all messages of the specified
+priority and higher are logged according to the given action. Rsyslogd behaves
+the same, but has some extensions.
+
+In addition to the above mentioned names the rsyslogd(8) understands the
+following extensions: An asterisk ('*') stands for all facilities or all
+priorities, depending on where it is used (before or after the period). The
+keyword none stands for no priority of the given facility.
+
+You can specify multiple facilities with the same priority pattern in one
+statement using the comma (',') operator. You may specify as much facilities as
+you want. Remember that only the facility part from such a statement is taken, a
+priority part would be skipped.
+
+Multiple selectors may be specified for a single action using the semicolon
+(';') separator. Remember that each selector in the selector field is capable
+to overwrite the preceding ones. Using this behavior you can exclude some
+priorities from the pattern.
+
+Rsyslogd has a syntax extension to the original BSD source, that makes its use
+more intuitively. You may precede every priority with an equation sign ('=') to
+specify only this single priority and not any of the above. You may also (both
+is valid, too) precede the priority with an exclamation mark ('!') to ignore
+all that priorities, either exact this one or this and any higher priority. If
+you use both extensions than the exclamation mark must occur before the equation
+sign, just use it intuitively.
+
 .SH ACTIONS
 The action field of a rule describes what to do with the message. In general, message content 
 is written to a kind of "logfile". But also other actions might be done, like writing to a 
diff --git a/rsyslog.h b/rsyslog.h
index c73c659..8842963 100644
--- a/rsyslog.h
+++ b/rsyslog.h
@@ -123,7 +123,6 @@ enum rsRetVal_				/** return value. All methods return this if not specified oth
 	RS_RET_GSS_SEND_ERROR = -2024, /**< error during GSS (via TCP) send process */
 	RS_RET_TCP_SOCKCREATE_ERR = -2025, /**< error during creation of TCP socket */
 	RS_RET_GSS_SENDINIT_ERROR = -2024, /**< error during GSS (via TCP) send initialization process */
-	RS_RET_QUEUE_FULL = -2025, /**< queue is full, operation could not be completed */
 	RS_RET_EOF = -2026, /**< end of file reached, not necessarily an error */
 	RS_RET_IO_ERROR = -2027, /**< some kind of IO error happened */
 	RS_RET_INVALID_OID = -2028, /**< invalid object ID */
@@ -172,6 +171,7 @@ enum rsRetVal_				/** return value. All methods return this if not specified oth
 	RS_RET_MAIL_NO_TO = -2071, /**< recipient for mail destination is missing */
 	RS_RET_MAIL_NO_FROM = -2072, /**< sender for mail destination is missing */
 	RS_RET_INVALID_PRI = -2073, /**< PRI value is invalid */
+	RS_RET_QUEUE_FULL = -2074, /**< queue is full, operation could not be completed */
 
 	/* RainerScript error messages (range 1000.. 1999) */
 	RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
diff --git a/syslogd.c b/syslogd.c
index 35e91af..6855a8a 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -399,7 +399,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
 	iMainMsgQHighWtrMark = 8000;
 	iMainMsgQLowWtrMark = 2000;
 	iMainMsgQDiscardMark = 9800;
-	iMainMsgQDiscardSeverity = 4;
+	iMainMsgQDiscardSeverity = 8;
 	iMainMsgQueMaxFileSize = 1024 * 1024;
 	iMainMsgQueueNumWorkers = 1;
 	iMainMsgQPersistUpdCnt = 0;
@@ -1392,13 +1392,18 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
 	 */
 	if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) {
 		/* we are done - parse pointer is moved by ParseTIMESTAMP3339 */;
-	} else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), p2parse) == TRUE) {
-		p2parse += 16;
+	} else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) {
+		/* we are done - parse pointer is moved by ParseTIMESTAMP3164 */;
 	} else if(*p2parse == ' ') { /* try to see if it is slighly malformed - HP procurve seems to do that sometimes */
-		if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), p2parse+1) == TRUE) {
+		++p2parse;	/* move over space */
+		if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) {
 			/* indeed, we got it! */
-			p2parse += 17;
+			/* we are done - parse pointer is moved by ParseTIMESTAMP3164 */;
 		} else {
+			/* parse pointer needs to be restored, as we moved it off-by-one
+			 * for this try.
+			 */
+			--p2parse;
 			flags |= ADDDATE;
 		}
 	} else {
@@ -2693,7 +2698,7 @@ static rsRetVal loadBuildInModules(void)
 	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetimeoutshutdown", 0, eCmdHdlrInt, NULL, &iMainMsgQtoQShutdown, NULL));
 	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetimeoutactioncompletion", 0, eCmdHdlrInt, NULL, &iMainMsgQtoActShutdown, NULL));
 	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetimeoutenqueue", 0, eCmdHdlrInt, NULL, &iMainMsgQtoEnq, NULL));
-	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworketimeoutrthreadshutdown", 0, eCmdHdlrInt, NULL, &iMainMsgQtoWrkShutdown, NULL));
+	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworkertimeoutthreadshutdown", 0, eCmdHdlrInt, NULL, &iMainMsgQtoWrkShutdown, NULL));
 	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuedequeueslowdown", 0, eCmdHdlrInt, NULL, &iMainMsgQDeqSlowdown, NULL));
 	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworkerthreadminimummessages", 0, eCmdHdlrInt, NULL, &iMainMsgQWrkMinMsgs, NULL));
 	CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuemaxfilesize", 0, eCmdHdlrSize, NULL, &iMainMsgQueMaxFileSize, NULL));
@@ -3075,7 +3080,7 @@ int realMain(int argc, char **argv)
 	 * only when actually neeeded. 
 	 * rgerhards, 2008-04-04
 	 */
-	while ((ch = getopt(argc, argv, "46aAc:def:g:hi:l:m:M:nopqQr::s:t:u:vwx")) != EOF) {
+	while ((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nopqQr::s:t:u:vwx")) != EOF) {
 		switch((char)ch) {
                 case '4':
                 case '6':
diff --git a/threads.c b/threads.c
index e32ff0d..03f19ff 100644
--- a/threads.c
+++ b/threads.c
@@ -46,6 +46,7 @@ static linkedList_t llThrds;
  */
 static rsRetVal thrdConstruct(thrdInfo_t **ppThis)
 {
+	DEFiRet;
 	thrdInfo_t *pThis;
 
 	assert(ppThis != NULL);
@@ -60,7 +61,7 @@ static rsRetVal thrdConstruct(thrdInfo_t **ppThis)
 	pthread_mutex_init (pThis->mutTermOK, NULL);
 
 	*ppThis = pThis;
-	return RS_RET_OK;
+	RETiRet;
 }
 
 
@@ -70,6 +71,7 @@ static rsRetVal thrdConstruct(thrdInfo_t **ppThis)
  */
 static rsRetVal thrdDestruct(thrdInfo_t *pThis)
 {
+	DEFiRet;
 	assert(pThis != NULL);
 
 	if(pThis->bIsActive == 1) {
@@ -78,7 +80,7 @@ static rsRetVal thrdDestruct(thrdInfo_t *pThis)
 	free(pThis->mutTermOK);
 	free(pThis);
 
-	return RS_RET_OK;
+	RETiRet;
 }
 
 
@@ -86,6 +88,7 @@ static rsRetVal thrdDestruct(thrdInfo_t *pThis)
  */
 rsRetVal thrdTerminate(thrdInfo_t *pThis)
 {
+	DEFiRet;
 	assert(pThis != NULL);
 	
 	pthread_cancel(pThis->thrdID);
@@ -96,7 +99,7 @@ rsRetVal thrdTerminate(thrdInfo_t *pThis)
 	if(pThis->pAfterRun != NULL)
 		pThis->pAfterRun(pThis);
 	
-	return RS_RET_OK;
+	RETiRet;
 }
 
 
@@ -104,8 +107,9 @@ rsRetVal thrdTerminate(thrdInfo_t *pThis)
  */
 rsRetVal thrdTerminateAll(void)
 {
+	DEFiRet;
 	llDestroy(&llThrds);
-	return RS_RET_OK;
+	RETiRet;
 }
 
 

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: