summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog192
-rw-r--r--Makefile.am22
-rw-r--r--Makefile.in69
-rw-r--r--aclocal.m41
-rw-r--r--action.c131
-rw-r--r--action.h8
-rw-r--r--config.h.in9
-rwxr-xr-xconfigure876
-rw-r--r--configure.ac163
-rw-r--r--dirty.h6
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/Makefile.in43
-rw-r--r--doc/features.html3
-rw-r--r--doc/imuxsock.html62
-rw-r--r--doc/manual.html22
-rw-r--r--doc/ommail.html23
-rw-r--r--doc/property_replacer.html51
-rw-r--r--doc/rsyslog_conf.html60
-rw-r--r--doc/rsyslog_ng_comparison.html20
-rw-r--r--doc/syslog_protocol.html (renamed from doc/syslog-protocol.html)0
-rw-r--r--doc/troubleshoot.html66
-rw-r--r--m4/atomic_operations.m453
-rw-r--r--plugins/im3195/Makefile.am2
-rw-r--r--plugins/im3195/Makefile.in43
-rw-r--r--plugins/im3195/im3195.c2
-rw-r--r--plugins/imdiag/Makefile.am6
-rw-r--r--plugins/imdiag/Makefile.in503
-rw-r--r--plugins/imdiag/imdiag.c197
-rw-r--r--plugins/imfile/Makefile.am2
-rw-r--r--plugins/imfile/Makefile.in43
-rw-r--r--plugins/imfile/imfile.c2
-rw-r--r--plugins/imgssapi/Makefile.am4
-rw-r--r--plugins/imgssapi/Makefile.in45
-rw-r--r--plugins/imgssapi/imgssapi.c12
-rw-r--r--plugins/imklog/Makefile.am2
-rw-r--r--plugins/imklog/Makefile.in43
-rw-r--r--plugins/imklog/bsd.c37
-rw-r--r--plugins/imklog/imklog.c14
-rw-r--r--plugins/imklog/imklog.h1
-rw-r--r--plugins/immark/Makefile.am2
-rw-r--r--plugins/immark/Makefile.in43
-rw-r--r--plugins/immark/immark.c2
-rw-r--r--plugins/imrelp/Makefile.am2
-rw-r--r--plugins/imrelp/Makefile.in43
-rw-r--r--plugins/imrelp/imrelp.c2
-rw-r--r--plugins/imtcp/Makefile.am2
-rw-r--r--plugins/imtcp/Makefile.in43
-rw-r--r--plugins/imtcp/imtcp.c1
-rw-r--r--plugins/imtemplate/Makefile.am2
-rw-r--r--plugins/imtemplate/Makefile.in43
-rw-r--r--plugins/imtemplate/imtemplate.c3
-rw-r--r--plugins/imudp/Makefile.am2
-rw-r--r--plugins/imudp/Makefile.in43
-rw-r--r--plugins/imudp/imudp.c9
-rw-r--r--plugins/imuxsock/Makefile.am2
-rw-r--r--plugins/imuxsock/Makefile.in43
-rw-r--r--plugins/imuxsock/imuxsock.c94
-rw-r--r--plugins/omgssapi/Makefile.am4
-rw-r--r--plugins/omgssapi/Makefile.in45
-rw-r--r--plugins/omgssapi/omgssapi.c13
-rw-r--r--plugins/omlibdbi/Makefile.am4
-rw-r--r--plugins/omlibdbi/Makefile.in45
-rw-r--r--plugins/ommail/Makefile.am2
-rw-r--r--plugins/ommail/Makefile.in43
-rw-r--r--plugins/ommail/ommail.c116
-rw-r--r--plugins/ommysql/Makefile.am4
-rw-r--r--plugins/ommysql/Makefile.in45
-rw-r--r--plugins/ommysql/ommysql.c3
-rw-r--r--plugins/ompgsql/Makefile.am4
-rw-r--r--plugins/ompgsql/Makefile.in45
-rw-r--r--plugins/ompgsql/ompgsql.c50
-rw-r--r--plugins/omrelp/Makefile.am2
-rw-r--r--plugins/omrelp/Makefile.in43
-rw-r--r--plugins/omrelp/omrelp.c4
-rw-r--r--plugins/omsnmp/Makefile.am4
-rw-r--r--plugins/omsnmp/Makefile.in45
-rw-r--r--plugins/omtesting/Makefile.am2
-rw-r--r--plugins/omtesting/Makefile.in43
-rw-r--r--rsyslog.conf6
-rw-r--r--runtime/Makefile.am20
-rw-r--r--runtime/Makefile.in58
-rw-r--r--runtime/atomic.h30
-rw-r--r--runtime/conf.c58
-rw-r--r--runtime/conf.h4
-rw-r--r--runtime/datetime.c268
-rw-r--r--runtime/datetime.h4
-rw-r--r--runtime/debug.c233
-rw-r--r--runtime/debug.h3
-rw-r--r--runtime/glbl.c3
-rw-r--r--runtime/glbl.h1
-rw-r--r--runtime/modules.c108
-rw-r--r--runtime/msg.c75
-rw-r--r--runtime/msg.h5
-rw-r--r--runtime/net.c1
-rw-r--r--runtime/obj.c2
-rw-r--r--runtime/queue.c20
-rw-r--r--runtime/rsyslog.h8
-rw-r--r--runtime/var.c40
-rw-r--r--runtime/var.h1
-rw-r--r--runtime/vmop.c37
-rw-r--r--runtime/vmop.h2
-rw-r--r--runtime/vmprg.c39
-rw-r--r--runtime/vmprg.h3
-rw-r--r--runtime/wti.c9
-rw-r--r--runtime/wti.h1
-rw-r--r--runtime/wtp.c7
-rw-r--r--tcps_sess.c45
-rw-r--r--tcps_sess.h2
-rw-r--r--tcpsrv.c20
-rw-r--r--tcpsrv.h4
-rw-r--r--template.c5
-rw-r--r--template.h2
-rw-r--r--tests/1.rstest26
-rw-r--r--tests/2.rstest10
-rw-r--r--tests/DevNull.cfgtest3
-rw-r--r--tests/Makefile.am31
-rw-r--r--tests/Makefile.in144
-rw-r--r--tests/NoExistFile.cfgtest3
-rwxr-xr-xtests/cfg.sh139
-rw-r--r--tests/cfg1.cfgtest3
-rw-r--r--tests/cfg1.testin2
-rw-r--r--tests/cfg2.cfgtest3
-rw-r--r--tests/cfg2.testin1
-rw-r--r--tests/cfg3.cfgtest5
-rw-r--r--tests/cfg3.testin1
-rw-r--r--tests/cfg4.cfgtest1
-rw-r--r--tests/cfg4.testin67
-rw-r--r--tests/err1.rstest7
-rw-r--r--tests/rscript-parse.c100
-rw-r--r--tests/rscript.c259
-rw-r--r--tests/testbench.h3
-rw-r--r--tools/Makefile.am10
-rw-r--r--tools/Makefile.in64
-rw-r--r--tools/gethostn.c47
-rw-r--r--tools/iminternal.c3
-rw-r--r--tools/omfile.c4
-rw-r--r--tools/omfwd.c18
-rw-r--r--tools/rsyslogd.833
-rw-r--r--tools/syslogd.c463
139 files changed, 4397 insertions, 1964 deletions
diff --git a/ChangeLog b/ChangeLog
index a4eb615..3214ffc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,177 @@
---------------------------------------------------------------------------
+Version 3.22.0 [v3-stable] (rgerhards), 2009-04-21
+This is the first stable release that includes the full functionality
+of the 3.21.x version tree.
+- bugfix: $InputTCPMaxSessions config directive was accepted, but not
+ honored. This resulted in a fixed upper limit of 200 connections.
+- bugfix: the default for $DirCreateMode was 0644, and as such wrong.
+ It has now been changed to 0700. For some background, please see
+ http://lists.adiscon.net/pipermail/rsyslog/2009-April/001986.html
+- bugfix: ompgsql did not detect problems in sql command execution
+ this could cause loss of messages. The handling was correct if the
+ connection broke, but not if there was a problem with statement
+ execution. The most probable case for such a case would be invalid
+ sql inside the template, and this is now much easier to diagnose.
+---------------------------------------------------------------------------
+Version 3.21.11 [BETA] (rgerhards), 2009-04-03
+- build system improvements contributed by Michael Biebl - thx!
+- all patches from 3.20.5 incorporated (see it's ChangeLog entry)
+---------------------------------------------------------------------------
+Version 3.21.10 [BETA] (rgerhards), 2009-02-02
+- bugfix: inconsistent use of mutex/atomic operations could cause segfault
+ details are too many, for full analysis see blog post at:
+ http://blog.gerhards.net/2009/01/rsyslog-data-race-analysis.html
+- the string "Do Die" was accidently emited upon exit in non-debug mode
+ This has now been corrected. Thanks to varmojfekoj for the patch.
+- some legacy options were not correctly processed.
+ Thanks to varmojfekoj for the patch.
+- doc bugfix: v3-compatiblity document had typo in config directive
+ thanks to Andrej for reporting this
+---------------------------------------------------------------------------
+Version 3.21.9 [BETA] (rgerhards), 2008-12-04
+- re-release of 3.21.8 with an additional fix, that could also lead
+ to DoS; 3.21.8 has been removed from the official download archives
+- security fix: imudp emitted a message when a non-permitted sender
+ tried to send a message to it. This behaviour is operator-configurable.
+ If enabled, a message was emitted each time. That way an attacker could
+ effectively fill the disk via this facility. The message is now
+ emitted only once in a minute (this currently is a hard-coded limit,
+ if someone comes up with a good reason to make it configurable, we
+ will probably do that).
+---------------------------------------------------------------------------
+Version 3.21.8 [BETA] (rgerhards), 2008-12-04
+- bugfix: imklog did not compile on FreeBSD
+- security bugfix: $AllowedSender was not honored, all senders were
+ permitted instead (see http://www.rsyslog.com/Article322.phtml)
+- merged in all other changes from 3.20.1 (see there)
+---------------------------------------------------------------------------
+Version 3.21.7 [BETA] (rgerhards), 2008-11-11
+- this is the new beta branch, based on the former 3.21.6 devel
+- new functionality: ZERO property replacer nomatch option (from v3-stable)
+---------------------------------------------------------------------------
+Version 3.21.6 [DEVEL] (rgerhards), 2008-10-22
+- consolidated time calls during msg object creation, improves performance
+ and consistency
+- bugfix: solved a segfault condition
+- bugfix: subsecond time properties generated by imfile, imklog and
+ internal messages could be slightly inconsistent
+- added capability to support multiple module search pathes. Thank
+ to Marius Tomaschewski for providing the patch.
+- bugfix: im3195 did no longer compile
+---------------------------------------------------------------------------
+Version 3.21.5 [DEVEL] (rgerhards), 2008-09-30
+- performance optimization: unnecessary time() calls during message
+ parsing removed - thanks to David Lang for his excellent performance
+ analysis
+- added new capability to property replacer: multiple immediately
+ successive field delimiters are treated as a single one.
+ Thanks to Zhuang Yuyao for the patch.
+- added message property "inputname", which contains the name of the
+ input (module) that generated it. Presence is depending on suport in
+ each input module (else it is blank).
+- added system property "$myhostname", which contains the name of the
+ local host as it knows itself.
+- imported a number of fixes and enhancements from the stable and
+ devel branches, including a fix to a potential segfault on HUP
+ when using UDP listners
+- re-enabled gcc builtin atomic operations and added a proper
+ ./configure check
+- bugfix: potential race condition when adding messages to queue
+ There was a wrong order of mutex lock operations. It is hard to
+ believe that really caused problems, but in theory it could and with
+ threading we often see that theory becomes practice if something is only
+ used long enough on a fast enough machine with enough CPUs ;)
+- cleaned up internal debug system code and made it behave better
+ in regard to multi-threading
+---------------------------------------------------------------------------
+Version 3.21.4 [DEVEL] (rgerhards), 2008-09-04
+- removed compile time fixed message size limit (was 2K), limit can now
+ be set via $MaxMessageSize global config directive (finally gotten rid
+ of MAXLINE ;))
+- enhanced doc for $ActionExecOnlyEveryNthTimeTimeout
+- integrated a number of patches from 3.18.4, namely
+ - 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.
+---------------------------------------------------------------------------
+Version 3.21.3 [DEVEL] (rgerhards), 2008-08-13
+- added ability to specify flow control mode for imuxsock
+- added ability to execute actions only after the n-th call of the action
+ This also lead to the addition of two new config directives:
+ $ActionExecOnlyEveryNthTime and $ActionExecOnlyEveryNthTimeTimeout
+ This feature is useful, for example, for alerting: it permits you to
+ send an alert only after at least n occurences of a specific message
+ have been seen by rsyslogd. This protectes against false positives
+ due to waiting for additional confirmation.
+- bugfix: IPv6 addresses could not be specified in forwarding actions
+ New syntax @[addr]:port introduced to enable that. Root problem was IPv6
+ addresses contain colons.
+- somewhat enhanced debugging messages
+- imported from 3.18.3:
+ - 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.
+---------------------------------------------------------------------------
+Version 3.21.2 [DEVEL] (rgerhards), 2008-08-04
+- added $InputUnixListenSocketHostName config directive, which permits to
+ override the hostname being used on a local unix socket. This is useful
+ for differentiating "hosts" running in several jails. Feature was
+ suggested by David Darville, thanks for the suggestion.
+- enhanced ommail to support multiple email recipients. This is done by
+ specifying $ActionMailTo multiple times. Note that this introduces a
+ small incompatibility to previous config file syntax: the recipient
+ list is now reset for each action (we honestly believe that will
+ not cause any problem - apologies if it does).
+- enhanced troubleshooting documentation
+---------------------------------------------------------------------------
+Version 3.21.1 [DEVEL] (rgerhards), 2008-07-30
+- bugfix: no error was reported if the target of a $IncludeConfig
+ could not be accessed.
+- added testbed for common config errors
+- added doc for -u option to rsyslogd man page
+- enhanced config file checking - no active actions are detected
+- added -N rsyslogd command line option for a config validation run
+ (which does not execute actual syslogd code and does not interfere
+ with a running instance)
+- somewhat improved emergency configuration. It is now also selected
+ if the config contains no active actions
+- rsyslogd error messages are now reported to stderr by default. can be
+ turned off by the new "$ErrorMessagesToStderr off" directive
+ Thanks to HKS for suggesting the new features.
+---------------------------------------------------------------------------
+Version 3.21.0 [DEVEL] (rgerhards), 2008-07-18
+- starts a new devel branch
+- added a generic test driver for RainerScript plus some test cases
+ to the testbench
+- added a small diagnostic tool to obtain result of gethostname() API
+- imported all changes from 3.18.1 until today (some quite important,
+ see below)
+---------------------------------------------------------------------------
+Version 3.20.6 [v3-stable] (rgerhards), 2009-04-16
+- this is the last v3-stable for the 3.20.x series
+- bugfix: $InputTCPMaxSessions config directive was accepted, but not
+ honored. This resulted in a fixed upper limit of 200 connections.
+- bugfix: the default for $DirCreateMode was 0644, and as such wrong.
+ It has now been changed to 0700. For some background, please see
+ http://lists.adiscon.net/pipermail/rsyslog/2009-April/001986.html
+---------------------------------------------------------------------------
Version 3.20.5 [v3-stable] (rgerhards), 2009-04-02
- bugfix: potential abort with DA queue after high watermark is reached
There exists a race condition that can lead to a segfault. Thanks
@@ -242,7 +415,9 @@ Version 3.19.0 (rgerhards), 2008-05-06
for the patch
---------------------------------------------------------------------------
Version 3.18.7 (rgerhards), 2008-12-??
-=======
+- bugfix: the default for $DirCreateMode was 0644, and as such wrong.
+ It has now been changed to 0700. For some background, please see
+ http://lists.adiscon.net/pipermail/rsyslog/2009-April/001986.html
- fixed a potential segfault condition with $AllowedSender directive
On HUP, the root pointers were not properly cleaned up. Thanks to
Michael Biebel, olgoat, and Juha Koho for reporting and analyzing
@@ -928,12 +1103,25 @@ Version 3.10.0 (rgerhards), 2008-01-07
- much cleaner code due to new objects and removal of single-threading
mode
---------------------------------------------------------------------------
-Version 2.0.7 V2-STABLE (rgerhards), 2008-??-??
+Version 2.0.8 V2-STABLE (rgerhards), 2008-??-??
+- bugfix: ompgsql did not detect problems in sql command execution
+ this could cause loss of messages. The handling was correct if the
+ connection broke, but not if there was a problem with statement
+ execution. The most probable case for such a case would be invalid
+ sql inside the template, and this is now much easier to diagnose.
+---------------------------------------------------------------------------
+Version 2.0.7 V2-STABLE (rgerhards), 2008-04-14
+- bugfix: the default for $DirCreateMode was 0644, and as such wrong.
+ It has now been changed to 0700. For some background, please see
+ http://lists.adiscon.net/pipermail/rsyslog/2009-April/001986.html
- bugfix: "$CreateDirs off" also disabled file creation
Thanks to William Tisater for analyzing this bug and providing a patch.
The actual code change is heavily based on William's patch.
- bugfix: memory leak in ompgsql
Thanks to Ken for providing the patch
+- bugfix: potential memory leak in msg.c
+ This one did not surface yet and the issue was actually found due to
+ a problem in v4 - but better fix it here, too
---------------------------------------------------------------------------
Version 2.0.6 V2-STABLE (rgerhards), 2008-08-07
- bugfix: memory leaks in rsyslogd, primarily in singlethread mode
diff --git a/Makefile.am b/Makefile.am
index e78a413..d783a30 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,7 @@ lmtcpsrv_la_SOURCES = \
tcps_sess.h \
tcpsrv.c \
tcpsrv.h
-lmtcpsrv_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmtcpsrv_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmtcpsrv_la_LDFLAGS = -module -avoid-version
lmtcpsrv_la_LIBADD =
@@ -23,7 +23,7 @@ lmtcpsrv_la_LIBADD =
lmtcpclt_la_SOURCES = \
tcpclt.c \
tcpclt.h
-lmtcpclt_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmtcpclt_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmtcpclt_la_LDFLAGS = -module -avoid-version
lmtcpclt_la_LIBADD =
@@ -35,9 +35,9 @@ endif # if ENABLE_INET
if ENABLE_GSSAPI
pkglib_LTLIBRARIES += lmgssutil.la
lmgssutil_la_SOURCES = gss-misc.c gss-misc.h
-lmgssutil_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmgssutil_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmgssutil_la_LDFLAGS = -module -avoid-version
-lmgssutil_la_LIBADD = $(gss_libs)
+lmgssutil_la_LIBADD = $(GSS_LIBS)
endif
EXTRA_DIST = \
@@ -50,9 +50,7 @@ EXTRA_DIST = \
contrib/gnutls/cert.pem \
contrib/gnutls/key.pem
-SUBDIRS = doc runtime . tests
-
-SUBDIRS += plugins/immark plugins/imuxsock plugins/imtcp plugins/imudp plugins/omtesting
+SUBDIRS = doc runtime . plugins/immark plugins/imuxsock plugins/imtcp plugins/imudp plugins/omtesting
if ENABLE_RSYSLOGD
SUBDIRS += tools
@@ -94,6 +92,10 @@ if ENABLE_IMFILE
SUBDIRS += plugins/imfile
endif
+if ENABLE_IMDIAG
+SUBDIRS += plugins/imdiag
+endif
+
if ENABLE_MAIL
SUBDIRS += plugins/ommail
endif
@@ -101,3 +103,9 @@ endif
if ENABLE_RFC3195
SUBDIRS += plugins/im3195
endif
+
+# tests are added as last element, because tests may need different
+# modules that need to be generated first
+SUBDIRS += tests
+
+ACLOCAL_AMFLAGS = -I m4
diff --git a/Makefile.in b/Makefile.in
index 60b8eb2..3218bb1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -50,8 +50,9 @@ sbin_PROGRAMS =
@ENABLE_SNMP_TRUE@am__append_10 = plugins/omsnmp
@ENABLE_IMTEMPLATE_TRUE@am__append_11 = plugins/imtemplate
@ENABLE_IMFILE_TRUE@am__append_12 = plugins/imfile
-@ENABLE_MAIL_TRUE@am__append_13 = plugins/ommail
-@ENABLE_RFC3195_TRUE@am__append_14 = plugins/im3195
+@ENABLE_IMDIAG_TRUE@am__append_13 = plugins/imdiag
+@ENABLE_MAIL_TRUE@am__append_14 = plugins/ommail
+@ENABLE_RFC3195_TRUE@am__append_15 = plugins/im3195
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
@@ -59,7 +60,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -134,12 +136,13 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
-DIST_SUBDIRS = doc runtime . tests plugins/immark plugins/imuxsock \
+DIST_SUBDIRS = doc runtime . plugins/immark plugins/imuxsock \
plugins/imtcp plugins/imudp plugins/omtesting tools \
plugins/imklog plugins/omgssapi plugins/imgssapi \
plugins/omrelp plugins/imrelp plugins/ommysql plugins/omlibdbi \
plugins/ompgsql plugins/omsnmp plugins/imtemplate \
- plugins/imfile plugins/ommail plugins/im3195
+ plugins/imfile plugins/imdiag plugins/ommail plugins/im3195 \
+ tests
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -170,6 +173,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -179,8 +183,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -189,6 +195,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -198,6 +206,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -207,15 +217,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -237,13 +257,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -253,39 +269,26 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = $(am__append_1) $(am__append_2)
#
#
@@ -297,7 +300,7 @@ pkglib_LTLIBRARIES = $(am__append_1) $(am__append_2)
@ENABLE_INET_TRUE@ tcpsrv.c \
@ENABLE_INET_TRUE@ tcpsrv.h
-@ENABLE_INET_TRUE@lmtcpsrv_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_INET_TRUE@lmtcpsrv_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_INET_TRUE@lmtcpsrv_la_LDFLAGS = -module -avoid-version
@ENABLE_INET_TRUE@lmtcpsrv_la_LIBADD =
@@ -308,13 +311,13 @@ pkglib_LTLIBRARIES = $(am__append_1) $(am__append_2)
@ENABLE_INET_TRUE@ tcpclt.c \
@ENABLE_INET_TRUE@ tcpclt.h
-@ENABLE_INET_TRUE@lmtcpclt_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_INET_TRUE@lmtcpclt_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_INET_TRUE@lmtcpclt_la_LDFLAGS = -module -avoid-version
@ENABLE_INET_TRUE@lmtcpclt_la_LIBADD =
@ENABLE_GSSAPI_TRUE@lmgssutil_la_SOURCES = gss-misc.c gss-misc.h
-@ENABLE_GSSAPI_TRUE@lmgssutil_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_GSSAPI_TRUE@lmgssutil_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_GSSAPI_TRUE@lmgssutil_la_LDFLAGS = -module -avoid-version
-@ENABLE_GSSAPI_TRUE@lmgssutil_la_LIBADD = $(gss_libs)
+@ENABLE_GSSAPI_TRUE@lmgssutil_la_LIBADD = $(GSS_LIBS)
EXTRA_DIST = \
freebsd/rsyslogd \
slackware/rc.rsyslogd \
@@ -325,12 +328,16 @@ EXTRA_DIST = \
contrib/gnutls/cert.pem \
contrib/gnutls/key.pem
-SUBDIRS = doc runtime . tests plugins/immark plugins/imuxsock \
- plugins/imtcp plugins/imudp plugins/omtesting $(am__append_3) \
+
+# tests are added as last element, because tests may need different
+# modules that need to be generated first
+SUBDIRS = doc runtime . plugins/immark plugins/imuxsock plugins/imtcp \
+ plugins/imudp plugins/omtesting $(am__append_3) \
$(am__append_4) $(am__append_5) $(am__append_6) \
$(am__append_7) $(am__append_8) $(am__append_9) \
$(am__append_10) $(am__append_11) $(am__append_12) \
- $(am__append_13) $(am__append_14)
+ $(am__append_13) $(am__append_14) $(am__append_15) tests
+ACLOCAL_AMFLAGS = -I m4
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/aclocal.m4 b/aclocal.m4
index b8ca2a5..c9f806a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -7695,3 +7695,4 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([m4/atomic_operations.m4])
diff --git a/action.c b/action.c
index 5f9e35d..5c5bdbe 100644
--- a/action.c
+++ b/action.c
@@ -54,6 +54,8 @@ DEFobjCurrIf(datetime)
DEFobjCurrIf(module)
DEFobjCurrIf(errmsg)
+static int iActExecEveryNthOccur = 0; /* execute action every n-th occurence (0,1=always) */
+static time_t iActExecEveryNthOccurTO = 0; /* timeout for n-occurence setting (in seconds, 0=never) */
static int glbliActionResumeInterval = 30;
int glbliActionResumeRetryCount = 0; /* how often should suspended actions be retried? */
@@ -89,6 +91,44 @@ static int iActionNbr = 0;
/* ------------------------------ methods ------------------------------ */
+/* This function returns the "current" time for this action. Current time
+ * is not necessarily real-time. In order to enhance performance, current
+ * system time is obtained the first time an action needs to know the time
+ * and then kept cached inside the action structure. Later requests will
+ * always return that very same time. Wile not totally accurate, it is far
+ * accurate in most cases and considered "acurate enough" for all cases.
+ * When changing the threading model, please keep in mind that this
+ * logic needs to be changed should we once allow more than one parallel
+ * call into the same action (object). As this is currently not supported,
+ * we simply cache the time inside the action object itself, after it
+ * is under mutex protection.
+ * Side-note: the value -1 is used as tActNow, because it also is the
+ * error return value of time(). So we would do a retry with the next
+ * invocation if time() failed. Then, of course, we would probably already
+ * be in trouble, but for the sake of performance we accept this very,
+ * very slight risk.
+ * This logic has been added as part of an overall performance improvment
+ * effort inspired by David Lang. -- rgerhards, 2008-09-16
+ * Note: this function does not use the usual iRet call conventions
+ * because that would provide little to no benefit but complicate things
+ * a lot. So we simply return the system time.
+ */
+static inline time_t
+getActNow(action_t *pThis)
+{
+ assert(pThis != NULL);
+ if(pThis->tActNow == -1) {
+ pThis->tActNow = time(NULL); /* good time call - the only one done */
+ if(pThis->tLastExec > pThis->tActNow) {
+ /* if we are traveling back in time, reset tLastExec */
+ pThis->tLastExec = (time_t) 0;
+ }
+ }
+
+ return pThis->tActNow;
+}
+
+
/* resets action queue parameters to their default values. This happens
* after each action has been created in order to prevent any wild defaults
* to be used. It is somewhat against the original spirit of the config file
@@ -174,6 +214,7 @@ rsRetVal actionConstruct(action_t **ppThis)
pThis->iResumeInterval = glbliActionResumeInterval;
pThis->iResumeRetryCount = glbliActionResumeRetryCount;
+ pThis->tLastOccur = time(NULL); /* done once per action on startup only */
pthread_mutex_init(&pThis->mutActExec, NULL);
SYNC_OBJ_TOOL_INIT(pThis);
@@ -287,30 +328,31 @@ rsRetVal actionSetGlobalResumeInterval(int iNewVal)
/* suspend an action -- rgerhards, 2007-08-02
*/
-rsRetVal actionSuspend(action_t *pThis)
+static rsRetVal actionSuspend(action_t *pThis, time_t tNow)
{
DEFiRet;
ASSERT(pThis != NULL);
pThis->bSuspended = 1;
- pThis->ttResumeRtry = time(NULL) + pThis->iResumeInterval;
+ pThis->ttResumeRtry = tNow + pThis->iResumeInterval;
pThis->iNbrResRtry = 0; /* tell that we did not yet retry to resume */
RETiRet;
}
+
/* try to resume an action -- rgerhards, 2007-08-02
* returns RS_RET_OK if resumption worked, RS_RET_SUSPEND if the
* action is still suspended.
*/
-rsRetVal actionTryResume(action_t *pThis)
+static rsRetVal actionTryResume(action_t *pThis)
{
DEFiRet;
time_t ttNow;
ASSERT(pThis != NULL);
- ttNow = time(NULL); /* do the system call just once */
+ ttNow = getActNow(pThis); /* cache "now" */
/* first check if it is time for a re-try */
if(ttNow > pThis->ttResumeRtry) {
@@ -429,7 +471,7 @@ actionCallDoAction(action_t *pAction, msg_t *pMsg)
iRet = pAction->pMod->mod.om.doAction(ppMsgs, pMsg->msgFlags, pAction->pModData);
if(iRet == RS_RET_SUSPENDED) {
dbgprintf("Action requested to be suspended, done that.\n");
- actionSuspend(pAction);
+ actionSuspend(pAction, getActNow(pAction));
}
}
@@ -506,11 +548,37 @@ actionWriteToAction(action_t *pAction)
{
msg_t *pMsgSave; /* to save current message pointer, necessary to restore
it in case it needs to be updated (e.g. repeated msgs) */
- time_t now;
DEFiRet;
pMsgSave = NULL; /* indicate message poiner not saved */
- /* first check if this is a regular message or the repeation of
+
+ /* first, we check if the action should actually be called. The action-specific
+ * $ActionExecOnlyEveryNthTime permits us to execute an action only every Nth
+ * time. So we need to check if we need to drop the (otherwise perfectly executable)
+ * action for this reason. Note that in case we need to drop it, we return RS_RET_OK
+ * as the action was properly "passed to execution" from the upper layer's point
+ * of view. -- rgerhards, 2008-08-07.
+ */
+ if(pAction->iExecEveryNthOccur > 1) {
+ /* we need to care about multiple occurences */
+ if( pAction->iExecEveryNthOccurTO > 0
+ && (getActNow(pAction) - pAction->tLastOccur) > pAction->iExecEveryNthOccurTO) {
+ dbgprintf("n-th occurence handling timed out (%d sec), restarting from 0\n",
+ (int) (getActNow(pAction) - pAction->tLastOccur));
+ pAction->iNbrNoExec = 0;
+ pAction->tLastOccur = getActNow(pAction);
+ }
+ if(pAction->iNbrNoExec < pAction->iExecEveryNthOccur - 1) {
+ ++pAction->iNbrNoExec;
+ dbgprintf("action %p passed %d times to execution - less than neded - discarding\n",
+ pAction, pAction->iNbrNoExec);
+ FINALIZE;
+ } else {
+ pAction->iNbrNoExec = 0; /* we execute the action now, so the number of no execs is down to */
+ }
+ }
+
+ /* then check if this is a regular message or the repeation of
* a previous message. If so, we need to change the message text
* to "last message repeated n times" and then go ahead and write
* it. Please note that we can not modify the message object, because
@@ -535,7 +603,7 @@ actionWriteToAction(action_t *pAction)
* signatures inside the message are also invalidated.
*/
datetime.getCurrTime(&(pMsg->tRcvdAt));
- datetime.getCurrTime(&(pMsg->tTIMESTAMP));
+ memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime));
MsgSetMSG(pMsg, (char*)szRepMsg);
MsgSetRawMsg(pMsg, (char*)szRepMsg);
@@ -545,24 +613,25 @@ actionWriteToAction(action_t *pAction)
dbgprintf("Called action, logging to %s\n", 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
+ * Note that the check for "pAction->iSecsExecOnceInterval > 0" is not necessary from
+ * a purely logical point of view. However, if safes us to check the system time in
+ * (those common) cases where ExecOnceInterval is not used. -- rgerhards, 2008-09-16
*/
- if(pAction->f_time != 0 && pAction->iSecsExecOnceInterval + pAction->tLastExec > now) {
+ if(pAction->f_time != 0 && pAction->iSecsExecOnceInterval > 0 &&
+ pAction->iSecsExecOnceInterval + pAction->tLastExec > getActNow(pAction)) {
/* in this case we need to discard the message - its not yet time to exec the action */
dbgprintf("action not yet ready again to be executed, onceInterval %d, tCurr %d, tNext %d\n",
- (int) pAction->iSecsExecOnceInterval, (int) now,
+ (int) pAction->iSecsExecOnceInterval, (int) getActNow(pAction),
(int) (pAction->iSecsExecOnceInterval + pAction->tLastExec));
FINALIZE;
}
- pAction->tLastExec = now; /* we need this OnceInterval */
- pAction->f_time = now; /* we need this for message repeation processing */
+ pAction->f_time = pAction->tLastExec = getActNow(pAction); /* re-init time flags */
+ /* Note: tLastExec could be set in the if block above, but f_time causes us a hard time
+ * so far, I do not see a solution to getting rid of it. -- rgerhards, 2008-09-16
+ */
/* When we reach this point, we have a valid, non-disabled action.
* So let's enqueue our message for execution. -- rgerhards, 2007-07-24
@@ -593,6 +662,10 @@ finalize_it:
/* call the configured action. Does all necessary housekeeping.
* rgerhards, 2007-08-01
+ * FYI: currently, this function is only called from the queue
+ * consumer. So we (conceptually) run detached from the input
+ * threads (which also means we may run much later than when the
+ * message was generated).
*/
#pragma GCC diagnostic ignored "-Wempty-body"
rsRetVal
@@ -627,13 +700,14 @@ actionCallAction(action_t *pAction, msg_t *pMsg)
ABORT_FINALIZE(RS_RET_OK);
}
- /* don't output marks to recently written files */
- if ((pMsg->msgFlags & MARK) && (time(NULL) - pAction->f_time) < MarkInterval / 2) {
+ pAction->tActNow = -1; /* we do not yet know our current time (clear prev. value) */
+
+ /* don't output marks to recently written outputs */
+ if((pMsg->msgFlags & MARK) && (getActNow(pAction) - pAction->f_time) < MarkInterval / 2) {
ABORT_FINALIZE(RS_RET_OK);
}
- /* suppress duplicate messages
- */
+ /* suppress duplicate messages */
if ((pAction->f_ReduceRepeated == 1) && pAction->f_pMsg != NULL &&
(pMsg->msgFlags & MARK) == 0 && getMSGLen(pMsg) == getMSGLen(pAction->f_pMsg) &&
!strcmp(getMSG(pMsg), getMSG(pAction->f_pMsg)) &&
@@ -642,7 +716,7 @@ actionCallAction(action_t *pAction, msg_t *pMsg)
!strcmp(getAPPNAME(pMsg), getAPPNAME(pAction->f_pMsg))) {
pAction->f_prevcount++;
dbgprintf("msg repeated %d times, %ld sec of %d.\n",
- pAction->f_prevcount, (long) time(NULL) - pAction->f_time,
+ pAction->f_prevcount, (long) getActNow(pAction) - pAction->f_time,
repeatinterval[pAction->f_repeatcount]);
/* use current message, so we have the new timestamp (means we need to discard previous one) */
msgDestruct(&pAction->f_pMsg);
@@ -650,12 +724,11 @@ actionCallAction(action_t *pAction, msg_t *pMsg)
/* If domark would have logged this by now, flush it now (so we don't hold
* isolated messages), but back off so we'll flush less often in the future.
*/
- if(time(NULL) > REPEATTIME(pAction)) {
+ if(getActNow(pAction) > REPEATTIME(pAction)) {
iRet = actionWriteToAction(pAction);
BACKOFF(pAction);
}
- } else {
- /* new message, save it */
+ } else {/* new message, save it */
/* first check if we have a previous message stored
* if so, emit and then discard it first
*/
@@ -710,6 +783,8 @@ actionAddCfSysLineHdrl(void)
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuedequeueslowdown", 0, eCmdHdlrInt, NULL, &iActionQueueDeqSlowdown, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuedequeuetimebegin", 0, eCmdHdlrInt, NULL, &iActionQueueDeqtWinFromHr, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuedequeuetimeend", 0, eCmdHdlrInt, NULL, &iActionQueueDeqtWinToHr, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlyeverynthtime", 0, eCmdHdlrInt, NULL, &iActExecEveryNthOccur, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlyeverynthtimetimeout", 0, eCmdHdlrInt, NULL, &iActExecEveryNthOccurTO, NULL));
finalize_it:
RETiRet;
@@ -741,6 +816,10 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringReques
pAction->pModData = pModData;
pAction->bExecWhenPrevSusp = bActExecWhenPrevSusp;
pAction->iSecsExecOnceInterval = iActExecOnceInterval;
+ pAction->iExecEveryNthOccur = iActExecEveryNthOccur;
+ pAction->iExecEveryNthOccurTO = iActExecEveryNthOccurTO;
+ iActExecEveryNthOccur = 0; /* auto-reset */
+ iActExecEveryNthOccurTO = 0; /* auto-reset */
/* check if we can obtain the template pointers - TODO: move to separate function? */
pAction->iNumTpls = OMSRgetEntryCount(pOMSR);
@@ -794,7 +873,7 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringReques
pAction->bEnabled = 1; /* action is enabled */
if(bSuspended)
- actionSuspend(pAction);
+ actionSuspend(pAction, time(NULL)); /* "good" time call, only during init and unavoidable */
CHKiRet(actionConstructFinalize(pAction));
diff --git a/action.h b/action.h
index 99108aa..d26d15b 100644
--- a/action.h
+++ b/action.h
@@ -40,6 +40,8 @@ extern int glbliActionResumeRetryCount;
*/
struct action_s {
time_t f_time; /* used for "message repeated n times" - be careful, old, old code */
+ time_t tActNow; /* the current time for an action execution. Initially set to -1 and
+ populated on an as-needed basis. This is a performance optimization. */
time_t tLastExec; /* time this action was last executed */
int bExecWhenPrevSusp;/* execute only when previous action is suspended? */
int iSecsExecOnceInterval; /* if non-zero, minimum seconds to wait until action is executed again */
@@ -49,6 +51,10 @@ struct action_s {
int iResumeInterval;/* resume interval for this action */
int iResumeRetryCount;/* how often shall we retry a suspended action? (-1 --> eternal) */
int iNbrResRtry; /* number of retries since last suspend */
+ int iNbrNoExec; /* number of matches that did not yet yield to an exec */
+ int iExecEveryNthOccur;/* execute this action only every n-th occurence (with n=0,1 -> always) */
+ int iExecEveryNthOccurTO;/* timeout for n-th occurence feature */
+ time_t tLastOccur; /* time last occurence was seen (for timing them out) */
struct modInfo_s *pMod;/* pointer to output module handling this selector */
void *pModData; /* pointer to module data - content is module-specific */
int f_ReduceRepeated;/* reduce repeated lines 0 - no, 1 - yes */
@@ -74,8 +80,6 @@ rsRetVal actionConstruct(action_t **ppThis);
rsRetVal actionConstructFinalize(action_t *pThis);
rsRetVal actionDestruct(action_t *pThis);
rsRetVal actionAddCfSysLineHdrl(void);
-rsRetVal actionTryResume(action_t *pThis);
-rsRetVal actionSuspend(action_t *pThis);
rsRetVal actionDbgPrint(action_t *pThis);
rsRetVal actionSetGlobalResumeInterval(int iNewVal);
rsRetVal actionDoAction(action_t *pAction);
diff --git a/config.h.in b/config.h.in
index 87c7645..978a9d3 100644
--- a/config.h.in
+++ b/config.h.in
@@ -18,6 +18,9 @@
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#undef HAVE_ARPA_NAMESER_H
+/* Define if compiler provides atomic builtins */
+#undef HAVE_ATOMIC_BUILTINS
+
/* Define to 1 if you have the `basename' function. */
#undef HAVE_BASENAME
@@ -61,9 +64,6 @@
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
-/* Define to 1 if you have the <gnutls/gnutls.h> header file. */
-#undef HAVE_GNUTLS_GNUTLS_H
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -89,9 +89,6 @@
/* Define to 1 if you have the `mkdir' function. */
#undef HAVE_MKDIR
-/* Define to 1 if you have the <mysql/mysql.h> header file. */
-#undef HAVE_MYSQL_MYSQL_H
-
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
diff --git a/configure b/configure
index 98617bd..d9bca4a 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.63 for rsyslog 3.20.5.
+# Generated by GNU Autoconf 2.63 for rsyslog 3.22.0.
#
# Report bugs to <rsyslog@lists.adiscon.com>.
#
@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='rsyslog'
PACKAGE_TARNAME='rsyslog'
-PACKAGE_VERSION='3.20.5'
-PACKAGE_STRING='rsyslog 3.20.5'
+PACKAGE_VERSION='3.22.0'
+PACKAGE_STRING='rsyslog 3.22.0'
PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com'
ac_unique_file="ChangeLog"
@@ -804,37 +804,40 @@ ENABLE_RELP_FALSE
ENABLE_RELP_TRUE
RELP_LIBS
RELP_CFLAGS
+ENABLE_IMDIAG_FALSE
+ENABLE_IMDIAG_TRUE
ENABLE_MAIL_FALSE
ENABLE_MAIL_TRUE
ENABLE_RSYSLOGD_FALSE
ENABLE_RSYSLOGD_TRUE
-rsrt_libs
-rsrt_cflags
+RSRT_LIBS
+RSRT_CFLAGS
ENABLE_RSYSLOGRT_FALSE
ENABLE_RSYSLOGRT_TRUE
-gnutls_libs
-gnutls_cflags
ENABLE_GNUTLS_FALSE
ENABLE_GNUTLS_TRUE
-HAVE_GNUTLS_CONFIG
-snmp_libs
-snmp_cflags
+GNUTLS_LIBS
+GNUTLS_CFLAGS
+SNMP_LIBS
+SNMP_CFLAGS
ENABLE_SNMP_FALSE
ENABLE_SNMP_TRUE
-libdbi_libs
-libdbi_cflags
+LIBDBI_LIBS
+LIBDBI_CFLAGS
ENABLE_OMLIBDBI_FALSE
ENABLE_OMLIBDBI_TRUE
-pgsql_libs
-pgsql_cflags
+PGSQL_LIBS
+PGSQL_CFLAGS
ENABLE_PGSQL_FALSE
ENABLE_PGSQL_TRUE
HAVE_PGSQL_CONFIG
-mysql_libs
-mysql_cflags
+MYSQL_LIBS
+MYSQL_CFLAGS
ENABLE_MYSQL_FALSE
ENABLE_MYSQL_TRUE
HAVE_MYSQL_CONFIG
+ENABLE_DIAGTOOLS_FALSE
+ENABLE_DIAGTOOLS_TRUE
ENABLE_INET_FALSE
ENABLE_INET_TRUE
ENABLE_IMKLOG_LINUX_FALSE
@@ -843,17 +846,20 @@ ENABLE_IMKLOG_BSD_FALSE
ENABLE_IMKLOG_BSD_TRUE
ENABLE_IMKLOG_FALSE
ENABLE_IMKLOG_TRUE
-pthreads_cflags
-pthreads_libs
+PTHREADS_CFLAGS
+PTHREADS_LIBS
ENABLE_GSSAPI_FALSE
ENABLE_GSSAPI_TRUE
-gss_libs
-zlib_libs
+GSS_LIBS
+ZLIB_LIBS
ENABLE_REGEXP_FALSE
ENABLE_REGEXP_TRUE
+moddirs
+WITH_MODDIRS_FALSE
+WITH_MODDIRS_TRUE
LIBOBJS
-dl_libs
-rt_libs
+DL_LIBS
+RT_LIBS
PKG_CONFIG
LIBTOOL
ac_ct_F77
@@ -971,6 +977,7 @@ with_gnu_ld
enable_libtool_lock
with_pic
with_tags
+with_moddirs
enable_largefile
enable_regexp
enable_zlib
@@ -983,6 +990,7 @@ enable_fsstnd
enable_debug
enable_rtinst
enable_valgrind
+enable_diagtools
enable_mysql
enable_pgsql
enable_libdbi
@@ -991,6 +999,7 @@ enable_gnutls
enable_rsyslogrt
enable_rsyslogd
enable_mail
+enable_imdiag
enable_relp
enable_rfc3195
enable_imfile
@@ -1012,6 +1021,8 @@ CXXCPP
F77
FFLAGS
PKG_CONFIG
+GNUTLS_CFLAGS
+GNUTLS_LIBS
RELP_CFLAGS
RELP_LIBS
LIBLOGGING_CFLAGS
@@ -1568,7 +1579,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.20.5 to adapt to many kinds of systems.
+\`configure' configures rsyslog 3.22.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1638,7 +1649,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of rsyslog 3.20.5:";;
+ short | recursive ) echo "Configuration of rsyslog 3.22.0:";;
esac
cat <<\_ACEOF
@@ -1665,6 +1676,7 @@ Optional Features:
--enable-debug Enable debug mode [default=no]
--enable-rtinst Enable runtime instrumentation mode [default=no]
--enable-valgrind Enable valgrind support settings [default=no]
+ --enable-diagtools Enable diagnostic tools [default=no]
--enable-mysql Enable MySql database support [default=no]
--enable-pgsql Enable PostgreSQL database support [default=no]
--enable-libdbi Enable libdbi database support [default=no]
@@ -1673,6 +1685,7 @@ Optional Features:
--enable-rsyslogrt Build rsyslogrt [default=yes]
--enable-rsyslogd Build rsyslogd [default=yes]
--enable-mail Enable mail support [default=no]
+ --enable-imdiag Enable imdiag [default=yes]
--enable-relp Enable RELP support [default=no]
--enable-rfc3195 Enable RFC3195 support [default=no]
--enable-imfile file input module enabled [default=no]
@@ -1685,6 +1698,8 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-tags[=TAGS] include additional configurations [automatic]
+ --with-moddirs=DIRS Additional module search paths appended to
+ [$libdir/rsyslog]
Some influential environment variables:
CC C compiler command
@@ -1701,6 +1716,9 @@ Some influential environment variables:
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
PKG_CONFIG path to pkg-config utility
+ GNUTLS_CFLAGS
+ C compiler flags for GNUTLS, overriding pkg-config
+ GNUTLS_LIBS linker flags for GNUTLS, overriding pkg-config
RELP_CFLAGS C compiler flags for RELP, overriding pkg-config
RELP_LIBS linker flags for RELP, overriding pkg-config
LIBLOGGING_CFLAGS
@@ -1774,7 +1792,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-rsyslog configure 3.20.5
+rsyslog configure 3.22.0
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1788,7 +1806,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.20.5, which was
+It was created by rsyslog $as_me 3.22.0, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2504,7 +2522,7 @@ fi
# Define the identity of the package.
PACKAGE='rsyslog'
- VERSION='3.20.5'
+ VERSION='3.22.0'
cat >>confdefs.h <<_ACEOF
@@ -2647,6 +2665,7 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
ac_config_headers="$ac_config_headers config.h"
@@ -6183,7 +6202,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6186 "configure"' > conftest.$ac_ext
+ echo '#line 6205 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8781,11 +8800,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8784: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8803: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8788: \$? = $ac_status" >&5
+ echo "$as_me:8807: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9071,11 +9090,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9074: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9093: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9078: \$? = $ac_status" >&5
+ echo "$as_me:9097: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9175,11 +9194,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9178: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9197: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9182: \$? = $ac_status" >&5
+ echo "$as_me:9201: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11577,7 +11596,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11580 "configure"
+#line 11599 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11677,7 +11696,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11680 "configure"
+#line 11699 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14086,11 +14105,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14089: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14108: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14093: \$? = $ac_status" >&5
+ echo "$as_me:14112: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14190,11 +14209,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14193: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14212: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14197: \$? = $ac_status" >&5
+ echo "$as_me:14216: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15775,11 +15794,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15778: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15797: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15782: \$? = $ac_status" >&5
+ echo "$as_me:15801: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -15879,11 +15898,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15882: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15901: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15886: \$? = $ac_status" >&5
+ echo "$as_me:15905: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18096,11 +18115,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18099: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18118: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18103: \$? = $ac_status" >&5
+ echo "$as_me:18122: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -18386,11 +18405,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18389: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18408: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18393: \$? = $ac_status" >&5
+ echo "$as_me:18412: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -18490,11 +18509,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18493: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18512: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18497: \$? = $ac_status" >&5
+ echo "$as_me:18516: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21447,7 +21466,7 @@ if test "$ac_res" != no; then
fi
-rt_libs=$LIBS
+RT_LIBS=$LIBS
LIBS=
{ $as_echo "$as_me:$LINENO: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; }
@@ -21536,7 +21555,7 @@ if test "$ac_res" != no; then
fi
-dl_libs=$LIBS
+DL_LIBS=$LIBS
LIBS=$save_LIBS
@@ -25589,6 +25608,144 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# check for availability of atomic operations
+{ $as_echo "$as_me:$LINENO: checking whether the compiler provides atomic builtins" >&5
+$as_echo_n "checking whether the compiler provides atomic builtins... " >&6; }
+if test "${ap_cv_atomic_builtins+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ ap_cv_atomic_builtins=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int main()
+{
+ unsigned long val = 1010, tmp, *mem = &val;
+
+ if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
+ return 1;
+
+ tmp = val;
+
+ if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
+ return 1;
+
+ if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
+ return 1;
+
+ tmp = 3030;
+
+ if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
+ return 1;
+
+ if (__sync_lock_test_and_set(&val, 4040) != 3030)
+ return 1;
+
+ mem = &tmp;
+
+ if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
+ return 1;
+
+ __sync_synchronize();
+
+ if (mem != &val)
+ return 1;
+
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ap_cv_atomic_builtins=yes
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ap_cv_atomic_builtins=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ap_cv_atomic_builtins" >&5
+$as_echo "$ap_cv_atomic_builtins" >&6; }
+
+if test "$ap_cv_atomic_builtins" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATOMIC_BUILTINS 1
+_ACEOF
+
+fi
+
+
+
+
+# Additional module directories
+
+# Check whether --with-moddirs was given.
+if test "${with_moddirs+set}" = set; then
+ withval=$with_moddirs; _save_IFS=$IFS ; IFS=$PATH_SEPARATOR ; moddirs=""
+ for w in ${with_moddirs} ;
+ do
+ case $w in
+ "") continue ;; */) ;; *) w="${w}/" ;;
+ esac
+ for m in ${moddirs} ;
+ do
+ test "x$w" = "x${libdir}/${PACKAGE}/" || \
+ test "x$w" = "x$m" || test "x$w" = "x/" && \
+ continue 2
+ done
+ case $moddirs in
+ "") moddirs="$w" ;; *) moddirs="${moddirs}:${w}" ;;
+ esac
+ done ; IFS=$_save_IFS
+else
+ moddirs=""
+
+fi
+
+ if test x$moddirs != x; then
+ WITH_MODDIRS_TRUE=
+ WITH_MODDIRS_FALSE='#'
+else
+ WITH_MODDIRS_TRUE='#'
+ WITH_MODDIRS_FALSE=
+fi
+
+
+
# Large file support
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then
@@ -25870,7 +26027,7 @@ cat >>confdefs.h <<\_ACEOF
#define USE_NETZIP 1
_ACEOF
- zlib_libs="-lz"
+ ZLIB_LIBS="-lz"
else
enable_zlib="false"
@@ -26101,7 +26258,7 @@ cat >>confdefs.h <<\_ACEOF
#define USE_GSSAPI /**/
_ACEOF
- gss_libs="-lgssapi_krb5"
+ GSS_LIBS="-lgssapi_krb5"
fi
@@ -26363,8 +26520,8 @@ cat >>confdefs.h <<\_ACEOF
#define USE_PTHREADS 1
_ACEOF
- pthreads_libs="-lpthread"
- pthreads_cflags="-pthread"
+ PTHREADS_LIBS="-lpthread"
+ PTHREADS_CFLAGS="-pthread"
@@ -26613,6 +26770,31 @@ _ACEOF
fi
+# compile diagnostic tools (small helpers usually not needed)
+# Check whether --enable-diagtools was given.
+if test "${enable_diagtools+set}" = set; then
+ enableval=$enable_diagtools; case "${enableval}" in
+ yes) enable_diagtools="yes" ;;
+ no) enable_diagtools="no" ;;
+ *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-diagtools" >&5
+$as_echo "$as_me: error: bad value ${enableval} for --enable-diagtools" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ enable_diagtools=no
+
+fi
+
+ if test x$enable_diagtools = xyes; then
+ ENABLE_DIAGTOOLS_TRUE=
+ ENABLE_DIAGTOOLS_FALSE='#'
+else
+ ENABLE_DIAGTOOLS_TRUE='#'
+ ENABLE_DIAGTOOLS_FALSE=
+fi
+
+
+
# MySQL support
# Check whether --enable-mysql was given.
@@ -26630,166 +26812,6 @@ else
fi
if test "x$enable_mysql" = "xyes"; then
-
-for ac_header in mysql/mysql.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ---------------------------------------- ##
-## Report this to rsyslog@lists.adiscon.com ##
-## ---------------------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: MySQL is missing
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: MySQL is missing
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-
-fi
-
-done
-
# Extract the first word of "mysql_config", so it can be a program name with args.
set dummy mysql_config; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -26903,8 +26925,8 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_init" >&5
$as_echo "$ac_cv_lib_mysqlclient_mysql_init" >&6; }
if test "x$ac_cv_lib_mysqlclient_mysql_init" = x""yes; then
- mysql_cflags=`mysql_config --cflags`
- mysql_libs=`mysql_config --libs`
+ MYSQL_CFLAGS=`mysql_config --cflags`
+ MYSQL_LIBS=`mysql_config --libs`
else
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
@@ -27058,8 +27080,8 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQconnectdb" >&5
$as_echo "$ac_cv_lib_pq_PQconnectdb" >&6; }
if test "x$ac_cv_lib_pq_PQconnectdb" = x""yes; then
- pgsql_cflags="-I`pg_config --includedir`"
- pgsql_libs="-L`pg_config --libdir` -lpq"
+ PGSQL_CFLAGS="-I`pg_config --includedir`"
+ PGSQL_LIBS="-L`pg_config --libdir` -lpq"
else
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
@@ -27326,8 +27348,8 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dbi_dbi_initialize" >&5
$as_echo "$ac_cv_lib_dbi_dbi_initialize" >&6; }
if test "x$ac_cv_lib_dbi_dbi_initialize" = x""yes; then
- libdbi_cflags=""
- libdbi_libs="-ldbi"
+ LIBDBI_CFLAGS=""
+ LIBDBI_LIBS="-ldbi"
else
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
@@ -27669,8 +27691,8 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_netsnmp_snmp_timeout" >&5
$as_echo "$ac_cv_lib_netsnmp_snmp_timeout" >&6; }
if test "x$ac_cv_lib_netsnmp_snmp_timeout" = x""yes; then
- snmp_cflags=""
- snmp_libs="-lnetsnmp"
+ SNMP_CFLAGS=""
+ SNMP_LIBS="-lnetsnmp"
else
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
@@ -27696,7 +27718,7 @@ fi
-# GNUtls support
+# GnuTLS support
# Check whether --enable-gnutls was given.
if test "${enable_gnutls+set}" = set; then
enableval=$enable_gnutls; case "${enableval}" in
@@ -27713,291 +27735,114 @@ fi
if test "x$enable_gnutls" = "xyes"; then
-for ac_header in gnutls/gnutls.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
+pkg_failed=no
+{ $as_echo "$as_me:$LINENO: checking for GNUTLS" >&5
+$as_echo_n "checking for GNUTLS... " >&6; }
+
+if test -n "$GNUTLS_CFLAGS"; then
+ pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gnutls >= 2.0.0\"") >&5
+ ($PKG_CONFIG --exists --print-errors "gnutls >= 2.0.0") 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
+ (exit $ac_status); }; then
+ pkg_cv_GNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.0.0" 2>/dev/null`
else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
+ pkg_failed=yes
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ else
+ pkg_failed=untried
+fi
+if test -n "$GNUTLS_LIBS"; then
+ pkg_cv_GNUTLS_LIBS="$GNUTLS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gnutls >= 2.0.0\"") >&5
+ ($PKG_CONFIG --exists --print-errors "gnutls >= 2.0.0") 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
+ (exit $ac_status); }; then
+ pkg_cv_GNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.0.0" 2>/dev/null`
else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
fi
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ---------------------------------------- ##
-## Report this to rsyslog@lists.adiscon.com ##
-## ---------------------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+if test $pkg_failed = yes; then
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: GNUTls is missing
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: GNUTls is missing
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-
+ _pkg_short_errors_supported=no
fi
+ if test $_pkg_short_errors_supported = yes; then
+ GNUTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gnutls >= 2.0.0" 2>&1`
+ else
+ GNUTLS_PKG_ERRORS=`$PKG_CONFIG --print-errors "gnutls >= 2.0.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$GNUTLS_PKG_ERRORS" >&5
-done
+ { { $as_echo "$as_me:$LINENO: error: Package requirements (gnutls >= 2.0.0) were not met:
- # Extract the first word of "libgnutls-config", so it can be a program name with args.
-set dummy libgnutls-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_HAVE_GNUTLS_CONFIG+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$HAVE_GNUTLS_CONFIG"; then
- ac_cv_prog_HAVE_GNUTLS_CONFIG="$HAVE_GNUTLS_CONFIG" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_HAVE_GNUTLS_CONFIG="yes"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
+$GNUTLS_PKG_ERRORS
-fi
-fi
-HAVE_GNUTLS_CONFIG=$ac_cv_prog_HAVE_GNUTLS_CONFIG
-if test -n "$HAVE_GNUTLS_CONFIG"; then
- { $as_echo "$as_me:$LINENO: result: $HAVE_GNUTLS_CONFIG" >&5
-$as_echo "$HAVE_GNUTLS_CONFIG" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+Alternatively, you may set the environment variables GNUTLS_CFLAGS
+and GNUTLS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&5
+$as_echo "$as_me: error: Package requirements (gnutls >= 2.0.0) were not met:
- if test "x${HAVE_GNUTLS_CONFIG}" != "xyes"; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: libgnutls-config not found in PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: libgnutls-config not found in PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
- fi
- { $as_echo "$as_me:$LINENO: checking for gnutls_check_version in -lgnutls" >&5
-$as_echo_n "checking for gnutls_check_version in -lgnutls... " >&6; }
-if test "${ac_cv_lib_gnutls_gnutls_check_version+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgnutls `libgnutls-config --libs`
- $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
+$GNUTLS_PKG_ERRORS
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gnutls_check_version ();
-int
-main ()
-{
-return gnutls_check_version ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_lib_gnutls_gnutls_check_version=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
- ac_cv_lib_gnutls_gnutls_check_version=no
-fi
+Alternatively, you may set the environment variables GNUTLS_CFLAGS
+and GNUTLS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&2;}
+ { (exit 1); exit 1; }; }
+elif test $pkg_failed = untried; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gnutls_gnutls_check_version" >&5
-$as_echo "$ac_cv_lib_gnutls_gnutls_check_version" >&6; }
-if test "x$ac_cv_lib_gnutls_gnutls_check_version" = x""yes; then
- gnutls_cflags=`libgnutls-config --cflags`
- gnutls_libs=`libgnutls-config --libs`
+Alternatively, you may set the environment variables GNUTLS_CFLAGS
+and GNUTLS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: GNU TLS library is missing
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details." >&5
-$as_echo "$as_me: error: GNU TLS library is missing
+$as_echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables GNUTLS_CFLAGS
+and GNUTLS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }; }
+else
+ GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS
+ GNUTLS_LIBS=$pkg_cv_GNUTLS_LIBS
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ :
fi
-
fi
if test x$enable_gnutls = xyes; then
ENABLE_GNUTLS_TRUE=
@@ -28027,8 +27872,8 @@ else
fi
if test "x$enable_rsyslogrt" = "xyes"; then
- rsrt_cflags="-I\$(top_srcdir)/runtime -I\$(top_srcdir)"
- rsrt_libs="\$(top_builddir)/runtime/librsyslog.la"
+ RSRT_CFLAGS="-I\$(top_srcdir)/runtime -I\$(top_srcdir)"
+ RSRT_LIBS="\$(top_builddir)/runtime/librsyslog.la"
fi
if test x$enable_rsyslogrt = xyes; then
ENABLE_RSYSLOGRT_TRUE=
@@ -28092,6 +27937,35 @@ fi
+# imdiag support (so far we do not need a library, but we need to turn this on and off)
+# note that we enable this be default, because an important point is to make
+# it available to users who do not know much about how to handle things. It
+# would complicate things if we first needed to tell them how to enable imdiag.
+# rgerhards, 2008-07-25
+# Check whether --enable-imdiag was given.
+if test "${enable_imdiag+set}" = set; then
+ enableval=$enable_imdiag; case "${enableval}" in
+ yes) enable_imdiag="yes" ;;
+ no) enable_imdiag="no" ;;
+ *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-imdiag" >&5
+$as_echo "$as_me: error: bad value ${enableval} for --enable-imdiag" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ enable_imdiag=no
+
+fi
+
+ if test x$enable_imdiag = xyes; then
+ ENABLE_IMDIAG_TRUE=
+ ENABLE_IMDIAG_FALSE='#'
+else
+ ENABLE_IMDIAG_TRUE='#'
+ ENABLE_IMDIAG_FALSE=
+fi
+
+
+
# RELP support
# Check whether --enable-relp was given.
if test "${enable_relp+set}" = set; then
@@ -28438,7 +28312,7 @@ fi
# end of copy template - be sure to serach for imtemplate to find everything!
-ac_config_files="$ac_config_files Makefile runtime/Makefile tools/Makefile tests/Makefile doc/Makefile plugins/imudp/Makefile plugins/imtcp/Makefile plugins/im3195/Makefile plugins/imgssapi/Makefile plugins/imuxsock/Makefile plugins/immark/Makefile plugins/imklog/Makefile plugins/imtemplate/Makefile plugins/imfile/Makefile plugins/imrelp/Makefile plugins/omtesting/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile plugins/omrelp/Makefile plugins/omlibdbi/Makefile plugins/ommail/Makefile plugins/omsnmp/Makefile"
+ac_config_files="$ac_config_files Makefile runtime/Makefile tools/Makefile doc/Makefile plugins/imudp/Makefile plugins/imtcp/Makefile plugins/im3195/Makefile plugins/imgssapi/Makefile plugins/imuxsock/Makefile plugins/immark/Makefile plugins/imklog/Makefile plugins/imtemplate/Makefile plugins/imfile/Makefile plugins/imrelp/Makefile plugins/imdiag/Makefile plugins/omtesting/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile plugins/omrelp/Makefile plugins/omlibdbi/Makefile plugins/ommail/Makefile plugins/omsnmp/Makefile tests/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -28565,6 +28439,13 @@ $as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${WITH_MODDIRS_TRUE}" && test -z "${WITH_MODDIRS_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_MODDIRS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"WITH_MODDIRS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${ENABLE_REGEXP_TRUE}" && test -z "${ENABLE_REGEXP_FALSE}"; then
{ { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_REGEXP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -28607,6 +28488,13 @@ $as_echo "$as_me: error: conditional \"ENABLE_INET\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${ENABLE_DIAGTOOLS_TRUE}" && test -z "${ENABLE_DIAGTOOLS_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_DIAGTOOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"ENABLE_DIAGTOOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${ENABLE_MYSQL_TRUE}" && test -z "${ENABLE_MYSQL_FALSE}"; then
{ { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_MYSQL\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -28663,6 +28551,13 @@ $as_echo "$as_me: error: conditional \"ENABLE_MAIL\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${ENABLE_IMDIAG_TRUE}" && test -z "${ENABLE_IMDIAG_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_IMDIAG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"ENABLE_IMDIAG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${ENABLE_RELP_TRUE}" && test -z "${ENABLE_RELP_FALSE}"; then
{ { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_RELP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -29020,7 +28915,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.20.5, which was
+This file was extended by rsyslog $as_me 3.22.0, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -29083,7 +28978,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-rsyslog config.status 3.20.5
+rsyslog config.status 3.22.0
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -29211,7 +29106,6 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"runtime/Makefile") CONFIG_FILES="$CONFIG_FILES runtime/Makefile" ;;
"tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
- "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"plugins/imudp/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/imudp/Makefile" ;;
"plugins/imtcp/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/imtcp/Makefile" ;;
@@ -29223,6 +29117,7 @@ do
"plugins/imtemplate/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/imtemplate/Makefile" ;;
"plugins/imfile/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/imfile/Makefile" ;;
"plugins/imrelp/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/imrelp/Makefile" ;;
+ "plugins/imdiag/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/imdiag/Makefile" ;;
"plugins/omtesting/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/omtesting/Makefile" ;;
"plugins/omgssapi/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/omgssapi/Makefile" ;;
"plugins/ommysql/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ommysql/Makefile" ;;
@@ -29231,6 +29126,7 @@ do
"plugins/omlibdbi/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/omlibdbi/Makefile" ;;
"plugins/ommail/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ommail/Makefile" ;;
"plugins/omsnmp/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/omsnmp/Makefile" ;;
+ "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -30064,6 +29960,7 @@ echo "PostgreSQL support enabled: $enable_pgsql"
echo "SNMP support enabled: $enable_snmp"
echo "Mail support enabled: $enable_mail"
echo "RELP support enabled: $enable_relp"
+echo "imdiag enabled: $enable_imdiag"
echo "file input module enabled: $enable_imfile"
echo "input template module will be compiled: $enable_imtemplate"
echo "Large file support enabled: $enable_largefile"
@@ -30072,6 +29969,7 @@ echo "GnuTLS network stream driver enabled: $enable_gnutls"
echo "Enable GSSAPI Kerberos 5 support: $want_gssapi_krb5"
echo "Debug mode enabled: $enable_debug"
echo "Runtime Instrumentation enabled: $enable_rtinst"
+echo "Diagnostic tools enabled: $enable_diagtools"
echo "valgrind support settings enabled: $enable_valgrind"
echo "rsyslog runtime will be built: $enable_rsyslogrt"
echo "rsyslogd will be built: $enable_rsyslogd"
diff --git a/configure.ac b/configure.ac
index e636070..38e7dcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,9 +2,10 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([rsyslog],[3.20.5],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[3.22.0],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([ChangeLog])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_GNU_SOURCE
@@ -42,14 +43,14 @@ AC_DEFINE_UNQUOTED([HOSTENV], "$host", [the host environment, can be queried via
save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS(clock_gettime, rt)
-rt_libs=$LIBS
+RT_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS(dlopen, dl)
-dl_libs=$LIBS
+DL_LIBS=$LIBS
LIBS=$save_LIBS
-AC_SUBST(rt_libs)
-AC_SUBST(dl_libs)
+AC_SUBST(RT_LIBS)
+AC_SUBST(DL_LIBS)
# Checks for header files.
AC_HEADER_RESOLV
@@ -109,6 +110,33 @@ AC_TRY_COMPILE([
AC_MSG_RESULT(no; defined as 64)
)
+# check for availability of atomic operations
+RS_ATOMIC_OPERATIONS
+
+
+# Additional module directories
+AC_ARG_WITH(moddirs,
+ [AS_HELP_STRING([--with-moddirs=DIRS],[Additional module search paths appended to @<:@$libdir/rsyslog@:>@])],
+ [_save_IFS=$IFS ; IFS=$PATH_SEPARATOR ; moddirs=""
+ for w in ${with_moddirs} ;
+ do
+ case $w in
+ "") continue ;; */) ;; *) w="${w}/" ;;
+ esac
+ for m in ${moddirs} ;
+ do
+ test "x$w" = "x${libdir}/${PACKAGE}/" || \
+ test "x$w" = "x$m" || test "x$w" = "x/" && \
+ continue 2
+ done
+ case $moddirs in
+ "") moddirs="$w" ;; *) moddirs="${moddirs}:${w}" ;;
+ esac
+ done ; IFS=$_save_IFS],[moddirs=""]
+)
+AM_CONDITIONAL(WITH_MODDIRS, test x$moddirs != x)
+AC_SUBST(moddirs)
+
# Large file support
AC_ARG_ENABLE(largefile,
[AS_HELP_STRING([--enable-largefile],[Enable large file support @<:@default=yes@:>@])],
@@ -153,8 +181,8 @@ if test "$enable_zlib" = "yes"; then
if test "$zlib_header" = "yes"; then
AC_CHECK_LIB(z, deflate,
[AC_DEFINE(USE_NETZIP, 1, [Define if you want to enable zlib support])
- zlib_libs="-lz"
- AC_SUBST(zlib_libs)], enable_zlib="false")
+ ZLIB_LIBS="-lz"
+ AC_SUBST(ZLIB_LIBS)], enable_zlib="false")
fi
fi
@@ -173,8 +201,8 @@ if test $want_gssapi_krb5 = yes; then
AC_CHECK_HEADER(gssapi/gssapi.h, [
AC_DEFINE(USE_GSSAPI,,
Define if you want to use GSSAPI)
- gss_libs="-lgssapi_krb5"
- AC_SUBST(gss_libs)
+ GSS_LIBS="-lgssapi_krb5"
+ AC_SUBST(GSS_LIBS)
])
])
fi
@@ -204,10 +232,10 @@ if test "x$enable_pthreads" != "xno"; then
[pthread_create],
[
AC_DEFINE([USE_PTHREADS], [1], [Multithreading support enabled.])
- pthreads_libs="-lpthread"
- pthreads_cflags="-pthread"
- AC_SUBST(pthreads_libs)
- AC_SUBST(pthreads_cflags)
+ PTHREADS_LIBS="-lpthread"
+ PTHREADS_CFLAGS="-pthread"
+ AC_SUBST(PTHREADS_LIBS)
+ AC_SUBST(PTHREADS_CFLAGS)
],
[AC_MSG_FAILURE([pthread is missing])],
[-lpthread]
@@ -333,6 +361,19 @@ if test "$enable_valgrind" = "yes"; then
fi
+# compile diagnostic tools (small helpers usually not needed)
+AC_ARG_ENABLE(diagtools,
+ [AS_HELP_STRING([--enable-diagtools],[Enable diagnostic tools @<:@default=no@:>@])],
+ [case "${enableval}" in
+ yes) enable_diagtools="yes" ;;
+ no) enable_diagtools="no" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-diagtools) ;;
+ esac],
+ [enable_diagtools=no]
+)
+AM_CONDITIONAL(ENABLE_DIAGTOOLS, test x$enable_diagtools = xyes)
+
+
# MySQL support
AC_ARG_ENABLE(mysql,
@@ -345,10 +386,6 @@ AC_ARG_ENABLE(mysql,
[enable_mysql=no]
)
if test "x$enable_mysql" = "xyes"; then
- AC_CHECK_HEADERS(
- [mysql/mysql.h],,
- [AC_MSG_FAILURE([MySQL is missing])]
- )
AC_CHECK_PROG(
[HAVE_MYSQL_CONFIG],
[mysql_config],
@@ -360,16 +397,16 @@ if test "x$enable_mysql" = "xyes"; then
AC_CHECK_LIB(
[mysqlclient],
[mysql_init],
- [mysql_cflags=`mysql_config --cflags`
- mysql_libs=`mysql_config --libs`
+ [MYSQL_CFLAGS=`mysql_config --cflags`
+ MYSQL_LIBS=`mysql_config --libs`
],
[AC_MSG_FAILURE([MySQL library is missing])],
[`mysql_config --libs`]
)
fi
AM_CONDITIONAL(ENABLE_MYSQL, test x$enable_mysql = xyes)
-AC_SUBST(mysql_cflags)
-AC_SUBST(mysql_libs)
+AC_SUBST(MYSQL_CFLAGS)
+AC_SUBST(MYSQL_LIBS)
# PostgreSQL support
@@ -394,16 +431,16 @@ if test "x$enable_pgsql" = "xyes"; then
AC_CHECK_LIB(
[pq],
[PQconnectdb],
- [pgsql_cflags="-I`pg_config --includedir`"
- pgsql_libs="-L`pg_config --libdir` -lpq"
+ [PGSQL_CFLAGS="-I`pg_config --includedir`"
+ PGSQL_LIBS="-L`pg_config --libdir` -lpq"
],
[AC_MSG_FAILURE([PgSQL library is missing])],
[-L`pg_config --libdir`]
)
fi
AM_CONDITIONAL(ENABLE_PGSQL, test x$enable_pgsql = xyes)
-AC_SUBST(pgsql_cflags)
-AC_SUBST(pgsql_libs)
+AC_SUBST(PGSQL_CFLAGS)
+AC_SUBST(PGSQL_LIBS)
# libdbi support
@@ -424,8 +461,8 @@ if test "x$enable_libdbi" = "xyes"; then
AC_CHECK_LIB(
[dbi],
[dbi_initialize],
- [libdbi_cflags=""
- libdbi_libs="-ldbi"
+ [LIBDBI_CFLAGS=""
+ LIBDBI_LIBS="-ldbi"
],
[AC_MSG_FAILURE([libdbi library is missing])]
)
@@ -436,8 +473,8 @@ if test "x$enable_libdbi" = "xyes"; then
)
fi
AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes)
-AC_SUBST(libdbi_cflags)
-AC_SUBST(libdbi_libs)
+AC_SUBST(LIBDBI_CFLAGS)
+AC_SUBST(LIBDBI_LIBS)
# SNMP support
@@ -458,18 +495,18 @@ if test "x$enable_snmp" = "xyes"; then
AC_CHECK_LIB(
[netsnmp],
[snmp_timeout],
- [snmp_cflags=""
- snmp_libs="-lnetsnmp"
+ [SNMP_CFLAGS=""
+ SNMP_LIBS="-lnetsnmp"
],
[AC_MSG_FAILURE([Net-SNMP library is missing])]
)
fi
AM_CONDITIONAL(ENABLE_SNMP, test x$enable_snmp = xyes)
-AC_SUBST(snmp_cflags)
-AC_SUBST(snmp_libs)
+AC_SUBST(SNMP_CFLAGS)
+AC_SUBST(SNMP_LIBS)
-# GNUtls support
+# GnuTLS support
AC_ARG_ENABLE(gnutls,
[AS_HELP_STRING([--enable-gnutls],[Enable GNU TLS support @<:@default=no@:>@])],
[case "${enableval}" in
@@ -480,31 +517,11 @@ AC_ARG_ENABLE(gnutls,
[enable_gnutls=no]
)
if test "x$enable_gnutls" = "xyes"; then
- AC_CHECK_HEADERS(
- [gnutls/gnutls.h],,
- [AC_MSG_FAILURE([GNUTls is missing])]
- )
- AC_CHECK_PROG(
- [HAVE_GNUTLS_CONFIG],
- [libgnutls-config],
- [yes],,,
- )
- if test "x${HAVE_GNUTLS_CONFIG}" != "xyes"; then
- AC_MSG_FAILURE([libgnutls-config not found in PATH])
- fi
- AC_CHECK_LIB(
- [gnutls],
- [gnutls_check_version],
- [gnutls_cflags=`libgnutls-config --cflags`
- gnutls_libs=`libgnutls-config --libs`
- ],
- [AC_MSG_FAILURE([GNU TLS library is missing])],
- [`libgnutls-config --libs`]
- )
+ PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.0.0)
fi
AM_CONDITIONAL(ENABLE_GNUTLS, test x$enable_gnutls = xyes)
-AC_SUBST(gnutls_cflags)
-AC_SUBST(gnutls_libs)
+AC_SUBST(GNUTLS_CFLAGS)
+AC_SUBST(GNUTLS_LIBS)
# support for building the rsyslogd runtime
@@ -518,12 +535,12 @@ AC_ARG_ENABLE(rsyslogrt,
[enable_rsyslogrt=yes]
)
if test "x$enable_rsyslogrt" = "xyes"; then
- rsrt_cflags="-I\$(top_srcdir)/runtime -I\$(top_srcdir)"
- rsrt_libs="\$(top_builddir)/runtime/librsyslog.la"
+ RSRT_CFLAGS="-I\$(top_srcdir)/runtime -I\$(top_srcdir)"
+ RSRT_LIBS="\$(top_builddir)/runtime/librsyslog.la"
fi
AM_CONDITIONAL(ENABLE_RSYSLOGRT, test x$enable_rsyslogrt = xyes)
-AC_SUBST(rsrt_cflags)
-AC_SUBST(rsrt_libs)
+AC_SUBST(RSRT_CFLAGS)
+AC_SUBST(RSRT_LIBS)
# support for NOT building rsyslogd (useful for source-based packaging systems)
@@ -552,6 +569,23 @@ AC_ARG_ENABLE(mail,
AM_CONDITIONAL(ENABLE_MAIL, test x$enable_mail = xyes)
+# imdiag support (so far we do not need a library, but we need to turn this on and off)
+# note that we enable this be default, because an important point is to make
+# it available to users who do not know much about how to handle things. It
+# would complicate things if we first needed to tell them how to enable imdiag.
+# rgerhards, 2008-07-25
+AC_ARG_ENABLE(imdiag,
+ [AS_HELP_STRING([--enable-imdiag],[Enable imdiag @<:@default=yes@:>@])],
+ [case "${enableval}" in
+ yes) enable_imdiag="yes" ;;
+ no) enable_imdiag="no" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-imdiag) ;;
+ esac],
+ [enable_imdiag=no]
+)
+AM_CONDITIONAL(ENABLE_IMDIAG, test x$enable_imdiag = xyes)
+
+
# RELP support
AC_ARG_ENABLE(relp,
[AS_HELP_STRING([--enable-relp],[Enable RELP support @<:@default=no@:>@])],
@@ -630,7 +664,6 @@ AM_CONDITIONAL(ENABLE_IMTEMPLATE, test x$enable_imtemplate = xyes)
AC_CONFIG_FILES([Makefile \
runtime/Makefile \
tools/Makefile \
- tests/Makefile \
doc/Makefile \
plugins/imudp/Makefile \
plugins/imtcp/Makefile \
@@ -642,6 +675,7 @@ AC_CONFIG_FILES([Makefile \
plugins/imtemplate/Makefile \
plugins/imfile/Makefile \
plugins/imrelp/Makefile \
+ plugins/imdiag/Makefile \
plugins/omtesting/Makefile \
plugins/omgssapi/Makefile \
plugins/ommysql/Makefile \
@@ -649,7 +683,8 @@ AC_CONFIG_FILES([Makefile \
plugins/omrelp/Makefile \
plugins/omlibdbi/Makefile \
plugins/ommail/Makefile \
- plugins/omsnmp/Makefile])
+ plugins/omsnmp/Makefile \
+ tests/Makefile])
AC_OUTPUT
echo "****************************************************"
@@ -665,6 +700,7 @@ echo "PostgreSQL support enabled: $enable_pgsql"
echo "SNMP support enabled: $enable_snmp"
echo "Mail support enabled: $enable_mail"
echo "RELP support enabled: $enable_relp"
+echo "imdiag enabled: $enable_imdiag"
echo "file input module enabled: $enable_imfile"
echo "input template module will be compiled: $enable_imtemplate"
echo "Large file support enabled: $enable_largefile"
@@ -673,6 +709,7 @@ echo "GnuTLS network stream driver enabled: $enable_gnutls"
echo "Enable GSSAPI Kerberos 5 support: $want_gssapi_krb5"
echo "Debug mode enabled: $enable_debug"
echo "Runtime Instrumentation enabled: $enable_rtinst"
+echo "Diagnostic tools enabled: $enable_diagtools"
echo "valgrind support settings enabled: $enable_valgrind"
echo "rsyslog runtime will be built: $enable_rsyslogrt"
echo "rsyslogd will be built: $enable_rsyslogd"
diff --git a/dirty.h b/dirty.h
index 2cf00b4..796df18 100644
--- a/dirty.h
+++ b/dirty.h
@@ -27,14 +27,12 @@
#ifndef DIRTY_H_INCLUDED
#define DIRTY_H_INCLUDED 1
-#define MAXLINE 2048 /* maximum line length */
-
/* Flags to logmsg().
*/
#define NOFLAG 0x000 /* no flag is set (to be used when a flag must be specified and none is required) */
#define INTERNAL_MSG 0x001 /* msg generated by logmsgInternal() --> special handling */
/* NO LONGER USED: #define SYNC_FILE 0x002 / * do fsync on file after printing */
-#define ADDDATE 0x004 /* add a date to the message */
+#define IGNDATE 0x004 /* ignore, if given, date in message and use date of reception as msg date */
#define MARK 0x008 /* this message is a mark */
#define MSG_PARSE_HOSTNAME 1
@@ -42,7 +40,7 @@
rsRetVal submitMsg(msg_t *pMsg);
rsRetVal logmsgInternal(int iErr, int pri, uchar *msg, int flags);
-rsRetVal parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bParseHost, int flags, flowControl_t flowCtlType);
+rsRetVal parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bParseHost, int flags, flowControl_t flowCtlTypeu, uchar *pszInputName);
/* TODO: the following 2 need to go in conf obj interface... */
rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *dfltTplName);
diff --git a/doc/Makefile.am b/doc/Makefile.am
index e7ce18c..d38d4d0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -26,7 +26,7 @@ html_files = \
rsyslog_tls.html \
rsyslog_reliable_forwarding.html \
rsyslog_stunnel.html \
- syslog-protocol.html \
+ syslog_protocol.html \
version_naming.html \
contributors.html \
dev_queue.html \
diff --git a/doc/Makefile.in b/doc/Makefile.in
index d24e9ff..85b1dc8 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -34,7 +34,8 @@ host_triplet = @host@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -62,6 +63,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -71,8 +73,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -81,6 +85,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -90,6 +96,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -99,15 +107,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -129,13 +147,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -145,39 +159,26 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
html_files = \
index.html \
bugs.html \
@@ -206,7 +207,7 @@ html_files = \
rsyslog_tls.html \
rsyslog_reliable_forwarding.html \
rsyslog_stunnel.html \
- syslog-protocol.html \
+ syslog_protocol.html \
version_naming.html \
contributors.html \
dev_queue.html \
diff --git a/doc/features.html b/doc/features.html
index 2b3b31d..d221eb7 100644
--- a/doc/features.html
+++ b/doc/features.html
@@ -74,7 +74,7 @@ easy multi-host support</li>
<li> massively multi-threaded with dynamic work thread pools
that start up and shut themselves down on an as-needed basis (great for
high log volume on multicore machines)</li>
-<li>very experimental and volatile support for <a href="syslog-protocol.html">syslog-protocol</a>
+<li>very experimental and volatile support for <a href="syslog_protocol.html">syslog-protocol</a>
compliant messages (it is volatile because standardization is currently
underway and this is a proof-of-concept implementation to aid this
effort)</li>
@@ -94,6 +94,7 @@ loadable plug-in</li>
via custom plugins</li>
<li> an easy-to-write to plugin interface</li>
<li> ability to send SNMP trap messages</li>
+<li> ability to filter out messages based on sequence of arrival</li>
<li>support for arbitrary complex boolean, string and
arithmetic expressions in message filters</li>
</ul>
diff --git a/doc/imuxsock.html b/doc/imuxsock.html
index ee367db..7749199 100644
--- a/doc/imuxsock.html
+++ b/doc/imuxsock.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
-<meta http-equiv="Content-Language" content="en"><title>Unix Socket Input</title>
-
+<meta http-equiv="Content-Language" content="en">
+<title>Unix Socket Input</title>
</head>
<body>
<h1>Unix Socket Input</h1>
@@ -9,31 +9,65 @@
<p><b>Author: </b>Rainer Gerhards
&lt;rgerhards@adiscon.com&gt;</p>
<p><b>Description</b>:</p>
-<p>Provides the ability to accept syslog messages via local Unix
+<p><b>Provides the ability to accept syslog messages via local Unix
sockets. Most importantly, this is the mechanism by which the syslog(3)
-call delivers syslog messages to rsyslogd. So you need to have this
+call delivers syslog messages to rsyslogd.</b> So you need to have this
module loaded to read the system log socket and be able to process log
-messages from applications running on the local system.</p><p>Application-provided
-timestamps are ignored by default. This is needed, as some programs
-(e.g. sshd)&nbsp;log with inconsistent timezone information, what
+messages from applications running on the local system.</p>
+<p><b>Application-provided
+timestamps are ignored by default.</b> This is needed, as some programs
+(e.g. sshd) log with inconsistent timezone information, what
messes up the local logs (which by default don't even contain time zone
information). This seems to be consistent with what sysklogd did for
the past four years. Alternate behaviour may be desirable if
gateway-like processes send messages via the local log slot - in this
case, it can be enabled via the
-$InputUnixListenSocketIgnoreMsgTimestamp and $SystemLogSocketIgnoreMsgTimestamp config directives</p><p><b>Configuration Directives</b>:</p>
+$InputUnixListenSocketIgnoreMsgTimestamp and $SystemLogSocketIgnoreMsgTimestamp config directives</p>
+<p><b>Unix log sockets can be flow-controlled.</b> That is, if processing queues fill up,
+the unix socket reader is blocked for a short while. This may be useful to prevent overruning
+the queues (which may cause exessive disk-io where it actually would not be needed). However,
+flow-controlling a log socket (and especially the system log socket) can lead to a very
+unresponsive system. As such, flow control is disabled by default. That means any log records
+are places as quickly as possible into the processing queues. If you would like to have
+flow control, you need to enable it via the $SystemLogSocketFlowControl and
+$InputUnixListenSocketFlowControl config directives. Just make sure you thought about
+the implications. Note that for many systems, turning on flow control does not hurt.
+<p><b>Configuration Directives</b>:</p>
<ul>
-<li><span style="font-weight: bold;">$InputUnixListenSocketIgnoreMsgTimestamp</span> [<span style="font-weight: bold;">on</span>/off]<strong></strong><br>Ignore timestamps included in the message. Applies to the next socket being added.</li><li><span style="font-weight: bold;">$SystemLogSocketIgnoreMsgTimestamp</span> [<span style="font-weight: bold;">on</span>/off]<br>Ignore timestamps included in the messages, applies to messages received via the system log socket.</li><li><span style="font-weight: bold;">$OmitLocalLogging</span> (imuxsock) [on/<b>off</b>] --
-former -o option</li><li><span style="font-weight: bold;">$SystemLogSocketName</span> &lt;name-of-socket&gt; --
-former -p option</li><li><span style="font-weight: bold;">$AddUnixListenSocket</span> &lt;name-of-socket&gt; adds
-additional unix socket, default none -- former -a option</li></ul>
+<li><b>$InputUnixListenSocketIgnoreMsgTimestamp</b> [<b>on</b>/off]
+<br>Ignore timestamps included in the message. Applies to the next socket being added.</li>
+<li><b>$InputUnixListenSocketFlowControl</b> [on/<b>off</b>] - specifies if flow control should be applied
+to the next socket.</li>
+<li><b>$SystemLogSocketIgnoreMsgTimestamp</b> [<b>on</b>/off]<br>
+Ignore timestamps included in the messages, applies to messages received via the system log socket.</li>
+<li><b>$OmitLocalLogging</b> (imuxsock) [on/<b>off</b>] -- former -o option</li>
+<li><b>$SystemLogSocketName</b> &lt;name-of-socket&gt; -- former -p option</li>
+<li><b>$SystemLogFlowControl</b> [on/<b>off</b>] - specifies if flow control should be applied
+to the system log socket.</li>
+<li><b>$AddUnixListenSocket</b> &lt;name-of-socket&gt; adds additional unix socket, default none -- former -a option</li>
+<li><b>$InputUnixListenSocketHostName</b> &lt;hostname&gt; permits to override the hostname that
+shall be used inside messages taken from the <b>next</b> $AddUnixListenSocket socket. Note that
+the hostname must be specified before the $AddUnixListenSocket configuration directive, and it
+will only affect the next one and then automatically be reset. This functionality is provided so
+that the local hostname can be overridden in cases where that is desired.</li>
+</ul>
<b>Caveats/Known Bugs:</b><br>
<br>
This documentation is sparse and incomplete.
<p><b>Sample:</b></p>
<p>The following sample is the minimum setup required to accept syslog messages from applications running on the local system.<br>
</p>
-<textarea rows="15" cols="60">$ModLoad imuxsock # needs to be done just once
+<textarea rows="2" cols="70">$ModLoad imuxsock # needs to be done just once
+$SystemLogSocketFlowControl on # enable flow control (use if needed)
+</textarea>
+<p>The following sample is a configuration where rsyslogd pulls logs from two
+jails, and assigns different hostnames to each of the jails: </p>
+<textarea rows="6" cols="60">$ModLoad imuxsock # needs to be done just once
+
+$InputUnixListenSocketHostName jail1.example.net
+$AddUnixListenSocket /jail/1/dev/log
+$InputUnixListenSocketHostName jail2.example.net
+$AddUnixListenSocket /jail/2/dev/log
</textarea>
<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>
@@ -44,4 +78,4 @@ Copyright © 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> \ No newline at end of file
+</body></html>
diff --git a/doc/manual.html b/doc/manual.html
index c9fd9b9..4626992 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.20.5 (v3-stable branch) of rsyslog.</b>
+<p><b>This documentation is for version 3.22.0 (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
@@ -33,20 +33,15 @@ the links below for the</b><br></p><ul>
<li><a href="troubleshoot.html">troubleshooting rsyslog problems</a></li>
<li><a href="rsyslog_conf.html">configuration file syntax (rsyslog.conf)</a></li>
-<li> <a href="property_replacer.html">property
-replacer, an important core component</a></li>
+<li> <a href="property_replacer.html">property replacer, an important core component</a></li>
<li><a href="http://www.rsyslog.com/tool-regex">a regular expression checker/generator tool for rsyslog</a></li>
-<li>a commented <a href="sample.conf.html">sample
-rsyslog.conf</a>
-</li>
+<li>a commented <a href="sample.conf.html">sample rsyslog.conf</a> </li>
<li><a href="bugs.html">rsyslog bug list</a></li>
-<li><a href="rsyslog_packages.html"> rsyslog
-packages</a></li>
+<li><a href="rsyslog_packages.html"> rsyslog packages</a></li>
<li><a href="generic_design.html">backgrounder on
generic syslog application design</a><!-- not good as it currently is ;) <li><a href="contributors.html">contributor &quot;Hall of Fame&quot;</a>--></li>
-<li><a href="modules.html">description of rsyslog
-modules</a></li><li><a href="man_rsyslogd.html">rsyslogd man page</a>
-(heavily outdated)</li>
+<li><a href="modules.html">description of rsyslog modules</a></li>
+<li><a href="man_rsyslogd.html">rsyslogd man page</a> (heavily outdated)</li>
</ul>
<p><b>We have some in-depth papers on</b></p>
<ul>
@@ -76,8 +71,7 @@ the world needs another syslogd</a>".</p>
<p>Documentation is added continuously. Please note that the
documentation here
matches only the current version of rsyslog. If you use an older
-version, be sure
-to use the doc that came with it.</p>
+version, be sure to use the doc that came with it.</p>
<p><b>You can also browse the following online resources:</b></p>
<ul>
<li>the <a href="http://wiki.rsyslog.com/">rsyslog
@@ -103,4 +97,6 @@ If you would like to use rsyslog source code inside your open source project, yo
any restriction as long as your license is GPLv3 compatible. If your license is incompatible to GPLv3,
you may even be still permitted to use rsyslog source code. However, then you need to look at the way
<a href="licensing.html">rsyslog is licensed</a>.</p>
+<p>Feedback is always welcome, but if you have a support question, please do not
+mail Rainer directly (<a href="free_support.html">why not?</a>).
</body></html>
diff --git a/doc/ommail.html b/doc/ommail.html
index 62ded6d..c18cf3f 100644
--- a/doc/ommail.html
+++ b/doc/ommail.html
@@ -50,7 +50,10 @@ standard SMTP port.</li>
<li><span style="font-weight: bold;">$ActionMailFrom</span><br>
The email address used as the senders address. There is no default.</li>
<li><span style="font-weight: bold;">$ActionMailTo</span><br>
-The recipients email address. There is no default.</li>
+The recipient email addresses. There is no default. To specify multiple
+recpients, repeat this directive as often as needed. Note: <b>This directive
+must be specified for each new action and is automatically reset.</b>
+[Multiple recipients are supported for 3.21.2 and above.]</li>
<li><span style="font-weight: bold;">$ActionMailSubject</span><br>
The name of the <span style="font-weight: bold;">template</span>
to be used as the mail subject. If this is not specified, a more or
@@ -112,14 +115,28 @@ $ActionExecOnlyOnceEveryInterval 21600
# the if ... then ... mailBody mus be on one line!
if $msg contains 'hard disk fatal failure' then :ommail:;mailBody
</textarea>
+<p>The sample below is the same, but sends mail to two recipients:</p>
+<textarea rows="15" cols="80">$ModLoad ommail
+$ActionMailSMTPServer mail.example.net
+$ActionMailFrom rsyslog@example.net
+$ActionMailTo operator@example.net
+$ActionMailTo admin@example.net
+$template mailSubject,"disk problem on %hostname%"
+$template mailBody,"RSYSLOG Alert\r\nmsg='%msg%'"
+$ActionMailSubject mailSubject
+# make sure we receive a mail only once in six
+# hours (21,600 seconds ;))
+$ActionExecOnlyOnceEveryInterval 21600
+# the if ... then ... mailBody mus be on one line!
+if $msg contains 'hard disk fatal failure' then :ommail:;mailBody
+</textarea>
<p>A more advanced example plus a discussion on using the email feature
inside a reliable system can be found in Rainer's blogpost
"<a style="font-style: italic;" href="http://rgerhards.blogspot.com/2008/04/why-is-native-email-capability.html">Why
is native email capability an advantage for a syslogd?</a>"
<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>
+<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
diff --git a/doc/property_replacer.html b/doc/property_replacer.html
index 2748dc8..c2a0c0d 100644
--- a/doc/property_replacer.html
+++ b/doc/property_replacer.html
@@ -72,7 +72,7 @@ BSD syslogd. For example, when TAG is "named[12345]", programname is
"syslog.info")</td>
</tr>
<tr>
-<td><span style="font-weight: bold;">iut</span></td>
+<td><b>iut</b></td>
<td>the monitorware InfoUnitType - used when talking
to a <a href="http://www.monitorware.com">MonitorWare</a>
backend (also for <a href="http://www.phplogcon.org/">phpLogCon</a>)</td>
@@ -138,10 +138,26 @@ draft-ietf-syslog-protocol</td>
draft-ietf-syslog-protocol</td>
</tr>
<tr>
-<td height="24"><b>msgid</b></td>
-<td height="24">The contents of the MSGID field from
+<td><b>msgid</b></td>
+<td>The contents of the MSGID field from
IETF draft draft-ietf-syslog-protocol</td>
</tr>
+<td><b>inputname</b></td>
+<td>The name of the input module that generated the
+message (e.g. "imuxsock", "imudp"). Note that not all modules
+necessarily provide this property. If not provided, it is an
+empty string. Also note that the input module may provide
+any value of its liking. Most importantly, it is <b>not</b>
+necessarily the module input name. Internal sources can also
+provide inputnames. Currently, "rsyslogd" is defined as inputname
+for messages internally generated by rsyslogd, for example startup
+and shutdown and error messages.
+This property is considered useful when trying to filter messages
+based on where they originated - e.g. locally generated messages
+("rsyslogd", "imuxsock", "imklog") should go to a different place
+than messages generated somewhere.
+</td>
+</tr>
<tr>
<td><b>$now</b></td>
<td>The current date stamp in the format YYYY-MM-DD</td>
@@ -177,6 +193,11 @@ range from 0 to 3 (for the four quater hours that are in each hour)</td>
<td><b>$minute</b></td>
<td>The current minute (2-digit)</td>
</tr>
+<tr>
+<td><b>$myhostname</b></td>
+<td>The name of the current host as it knows itself (probably useful
+for filtering in a generic way)</td>
+</tr>
</tbody>
</table>
<p>Properties starting with a $-sign are so-called system
@@ -258,8 +279,30 @@ same example with semicolon as delimiter is "%msg:F,59:3%".</p>
<p>Please note that the special characters "F" and "R" are
case-sensitive. Only upper case works, lower case will return an error.
There are no white spaces permitted inside the sequence (that will lead
-to error messages and will NOT provide the intended result).<br>
+to error messages and will NOT provide the intended result).</p>
+<p>Each occurence of the field delimiter starts a new field. However,
+if you add a plus sign ("+") after the field delimiter, multiple
+delimiters, one immediately after the others, are treated as separate
+fields. This can be useful in cases where the syslog message contains
+such sequences. A frequent case may be with code that is written as
+follows:</p>
+<code><pre>
+int n, m;
+...
+syslog(LOG_ERR, "%d test %6d", n, m);
+</pre></code>
+<p>This will result into things like this in syslog messages:
+"1 test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2",
+"1 test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;23",
+"1 test&nbsp;&nbsp;234567"
+<p>As you can see, the fields are delimited by space characters, but
+their exact number is unknown. They can properly be extracted as follows:
+<p>
+"%msg:F,32:2%" to "%msg:F,32+:2%".
+<p>This feature was suggested by Zhuang Yuyao and implemented by him.
+It is modeled after perl compatible regular expressions.
</p>
+
<h2>Property Options</h2>
<b><code>property options</code></b> are
case-insensitive. Currently, the following options are defined:
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index 9855a1b..1a24e79 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -79,8 +79,33 @@ default, it is usually well-chosen and applicable in most cases.</p>
execute action only if the last execute is at last
&lt;seconds&gt; seconds in the past (more info in <a href="ommail.html">ommail</a>,
but may be used with any action)</li>
-<li>$ActionFileDefaultTemplate [templateName] - sets a new
-default template for file actions</li>
+<li><i><b>$ActionExecOnlyEveryNthTime</b> &lt;number&gt;</i> - If configured, the next action will
+only be executed every n-th time. For example, if configured to 3, the first two messages
+that go into the action will be dropped, the 3rd will actually cause the action to execute,
+the 4th and 5th will be dropped, the 6th executed under the action, ... and so on. Note:
+this setting is automatically re-set when the actual action is defined.</li>
+<li><i><b>$ActionExecOnlyEveryNthTimeTimeout</b> &lt;number-of-seconds&gt;</i> - has a meaning only if
+$ActionExecOnlyEveryNthTime is also configured for the same action. If so, the timeout
+setting specifies after which period the counting of "previous actions" expires and
+a new action count is begun. Specify 0 (the default) to disable timeouts.
+<br>
+<i>Why is this option needed?</i> Consider this case: a message comes in at, eg., 10am. That's
+count 1. Then, nothing happens for the next 10 hours. At 8pm, the next
+one occurs. That's count 2. Another 5 hours later, the next message
+occurs, bringing the total count to 3. Thus, this message now triggers
+the rule.
+<br>
+The question is if this is desired behavior? Or should the rule only be
+triggered if the messages occur within an e.g. 20 minute window? If the
+later is the case, you need a
+<br>
+$ActionExecOnlyEveryNthTimeTimeout 1200
+<br>
+This directive will timeout previous messages seen if they are older
+than 20 minutes. In the example above, the count would now be always 1
+and consequently no rule would ever be triggered.
+
+<li>$ActionFileDefaultTemplate [templateName] - sets a new default template for file actions</li>
<li>$ActionFileEnableSync [on/<span style="font-weight: bold;">off</span>] - enables file
syncing capability of omfile</li>
<li>$ActionForwardDefaultTemplate [templateName] - sets a new
@@ -142,6 +167,7 @@ default 60000 (1 minute)]</li>
<li><a href="rsconf1_droptrailinglfonreception.html">$DropTrailingLFOnReception</a></li>
<li><a href="rsconf1_dynafilecachesize.html">$DynaFileCacheSize</a></li>
<li><a href="rsconf1_escapecontrolcharactersonreceive.html">$EscapeControlCharactersOnReceive</a></li>
+<li>$ErrorMessagesToStderr [<b>on</b>|off] - direct rsyslogd error message to stderr (in addition to other targets)</li>
<li><a href="rsconf1_failonchownfailure.html">$FailOnChownFailure</a></li>
<li><a href="rsconf1_filecreatemode.html">$FileCreateMode</a></li>
<li><a href="rsconf1_filegroup.html">$FileGroup</a></li>
@@ -182,10 +208,30 @@ default 60000 (1 minute)]</li>
</li>
<li>$MainMsgQueueWorkerThreads &lt;number&gt;, num
worker threads, default 1, recommended 1</li>
-<li>$MainMsgQueueWorkerThreadMinumumMessages
-&lt;number&gt;, default 100</li>
-<li><a href="rsconf1_markmessageperiod.html">$MarkMessagePeriod</a>
-(immark)</li>
+<li>$MainMsgQueueWorkerThreadMinumumMessages &lt;number&gt;, default 100</li>
+<li><a href="rsconf1_markmessageperiod.html">$MarkMessagePeriod</a> (immark)</li>
+<li><b><i>$MaxMessageSize</i></b> &lt;size_nbr&gt;, default 2k - allows to specify maximum supported message size
+(both for sending and receiving). The default
+should be sufficient for almost all cases. Do not set this below 1k, as it would cause
+interoperability problems with other syslog implementations.<br>
+Change the setting to e.g. 32768 if you would like to
+support large message sizes for IHE (32k is the current maximum
+needed for IHE). I was initially tempted to set the default to 32k,
+but there is a some memory footprint with the current
+implementation in rsyslog.
+<br>If you intend to receive Windows Event Log data (e.g. via
+<a href="http://www.eventreporter.com/">EventReporter</a>), you might want to
+increase this number to an even higher value, as event
+log messages can be very lengthy ("$MaxMessageSize 64k" is not a bad idea).
+Note: testing showed that 4k seems to be
+the typical maximum for <b>UDP</b> based syslog. This is an IP stack
+restriction. Not always ... but very often. If you go beyond
+that value, be sure to test that rsyslogd actually does what
+you think it should do ;) It is highly suggested to use a TCP based transport
+instead of UDP (plain TCP syslog, RELP). This resolves the UDP stack size restrictions.
+<br>Note that 2k, the current default, is the smallest size that must be
+supported in order to be compliant to the upcoming new syslog RFC series.
+</li>
<li><a href="rsconf1_moddir.html">$ModDir</a></li>
<li><a href="rsconf1_modload.html">$ModLoad</a></li>
<li><a href="rsconf1_repeatedmsgreduction.html">$RepeatedMsgReduction</a></li>
@@ -789,7 +835,7 @@ administration needs.<br>
forward messages it has received from the network to another host.
Specify the "-h" option to enable this.</b></p>
<p>To forward messages to another host, prepend the hostname with
-the at sign ("@").&nbsp; A single at sign means that messages will
+the at sign ("@"). A single at sign means that messages will
be forwarded via UDP protocol (the standard for syslog). If you prepend
two at signs ("@@"), the messages will be transmitted via TCP. Please
note that plain TCP based syslog is not officially standardized, but
diff --git a/doc/rsyslog_ng_comparison.html b/doc/rsyslog_ng_comparison.html
index 6d14d93..2f383f7 100644
--- a/doc/rsyslog_ng_comparison.html
+++ b/doc/rsyslog_ng_comparison.html
@@ -209,10 +209,8 @@ priority</td>
<td></td>
</tr>
<tr>
-<td valign="top">ability to filter on any other
-message
-field not mentioned above
-(including substrings and the like)</td>
+<td valign="top">ability to filter on any other message
+field not mentioned above (including substrings and the like)</td>
<td valign="top">yes</td>
<td valign="top">no</td>
</tr>
@@ -248,6 +246,12 @@ based on filters</td>
<td></td>
</tr>
<tr>
+<td valign="top">ability to filter out messages based on sequence of appearing</td>
+<td valign="top">yes (starting with 3.21.3)</td>
+<td valign="top">no</td>
+<td></td>
+</tr>
+<tr>
<td valign="top">powerful BSD-style hostname and
program name blocks for easy multi-host support</td>
<td valign="top">yes</td>
@@ -428,17 +432,9 @@ including ability to present channel and priority as visible log data</td>
<td valign="top">yes</td>
<td valign="top">yes</td>
</tr>
-<<<<<<< HEAD:doc/rsyslog_ng_comparison.html
-<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>
-=======
<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">no (only via piped external process)</td>
->>>>>>> 3f2856b4b5010dfcaa720b292dc3a655e7b9f6da:doc/rsyslog_ng_comparison.html
</tr>
<tr>
<td valign="top">good timestamp format control; at a
diff --git a/doc/syslog-protocol.html b/doc/syslog_protocol.html
index 72de5c2..72de5c2 100644
--- a/doc/syslog-protocol.html
+++ b/doc/syslog_protocol.html
diff --git a/doc/troubleshoot.html b/doc/troubleshoot.html
index b1e9c4a..e655c2e 100644
--- a/doc/troubleshoot.html
+++ b/doc/troubleshoot.html
@@ -12,10 +12,22 @@ 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.
+<li>Check <a href="http://bugzilla.adiscon.com">the bugzilla</a> to see if your problem is a known
+(and even fixed ;)) bug.
</ul>
+<p><b>Malformed Messages and Message Properties</b>
+<p>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.
+<p><b>Configuration Problems</b>
+<p>Rsyslog 3.21.1 and above has been enhanced to support extended configuration checking.
+It offers a special command line switch (-N1) that puts it into "config verfication mode".
+In that mode, it interprets and check the configuration file, but does not startup. This
+mode can be used in parallel to a running instance of rsyslogd.
+<p>To enable it, run rsyslog interactively as follows:
+<p><b><i>/path/to/rsyslogd -f/path/to/config-file -N1</i></b>
+<p>You should also specify other options you usually give (like -c3 and whatever else).
+Any problems experienced are reported to stderr [aka "your screen" (if not redirected)].
<p><b>Asking for Help</b>
<p>If you can't find the answer yourself, you should look at these places for
community help.
@@ -26,6 +38,54 @@ the preferred method of obtaining support.
This is a low-volume list which occasional gets traffic spikes.
The mailing list is probably a good place for complex questions.
</ul>
+<p><b>Debug Log</b>
+<p>If you ask for help, there are chances that we need to ask for an rsyslog debug log.
+The debug log is a detailled report of what rsyslog does during processing. As such, it may
+even be useful for your very own troubleshooting. People have seen things inside their debug
+log that enabled them to find problems they did not see before. So having a look at the
+debug log, even before asking for help, may be useful.
+<p>Note that the debug log contains most of those things we consider useful. This is a lot
+of information, but may still be too few. So it sometimes may happen that you will be asked
+to run a specific version which has additional debug output. Also, we revise from time to
+time what is worth putting into the standard debug log. As such, log content may change
+from version to version. We do not guarantee any specific debug log contents, so do not
+rely on that. The amount of debug logging can also be controlled via some environment
+options. Please see <a href="debug.html">debugging support</a> for further details.
+<p>In general, it is advisable to run rsyslogd in the foreground to obtain the log.
+To do so, make sure you know which options are usually used when you start rsyslogd
+as a background daemon. Let's assume "-c3" is the only option used. Then, do the following:
+<ul>
+<li>make sure rsyslogd as a daemon is stopped (verify with ps -ef|grep rsyslogd)
+<li>make sure you have a console session with root permissions
+<li>run rsyslogd interactively: /sbin/rsyslogd ..your options.. -dn &gt; logfile
+<br>where "your options" is what you usually use. /sbin/rsyslogd is the full path
+to the rsyslogd binary (location different depending on distro).
+In our case, the command would be
+<br>/sbin/rsyslogd -c3 -dn &gt; logfile
+<li>press ctrl-C when you have sufficient data (e.g. a device logged a record)
+<br><b>NOTE: rsyslogd will NOT stop automatically - you need to ctrl-c out of it!</b>
+<li>Once you have done all that, you can review logfile. It contains the debug output.
+<li>When you are done, make sure you re-enable (and start) the background daemon!
+</ul>
+<p>If you need to submit the logfile, you may want to check if it contains any
+passwords or other sensitive data. If it does, you can change it to some <b>consistent</b>
+meaningless value. <b>Do not delete the lines</b>, as this renders the debug log
+unusable (and makes Rainer quite angry for wasted time, aka significantly reduces the chance
+he will remain motivated to look at your problem ;)). For the same reason, make sure
+whatever you change is change consistently. Really!
+<p>Debug log file can get quite large. Before submitting them, it is a good idea to zip them.
+Rainer has handled files of around 1 to 2 GB. If your's is larger ask before submitting. Often,
+it is sufficient to submit the first 2,000 lines of the log file and around another 1,000 around
+the area where you see a problem. Also,
+ask you can submit a file via private mail. Private mail is usually a good way to go for large files
+or files with sensitive content. However, do NOT send anything sensitive that you do not want
+the outside to be known. While Rainer so far made effort no to leak any sensitive information,
+there is no guarantee that doesn't happen. If you need a guarantee, you are probably a
+candidate for a <a href="professional_support.html">commercial support contract</a>. Free support
+comes without any guarantees, include no guarantee on confidentiality
+[aka "we don't want to be sued for work were are not even paid for ;)].
+<b>So if you submit debug logs, do so at your sole risk</b>. By submitting them, you accept
+this policy.
<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
diff --git a/m4/atomic_operations.m4 b/m4/atomic_operations.m4
new file mode 100644
index 0000000..ad0ee60
--- /dev/null
+++ b/m4/atomic_operations.m4
@@ -0,0 +1,53 @@
+# rsyslog
+#
+# atomic_operations.m4 - autoconf macro to check if compiler supports atomic
+# operations
+#
+# rgerhards, 2008-09-18, added based on
+# http://svn.apache.org/repos/asf/apr/apr/trunk/configure.in
+#
+#
+AC_DEFUN([RS_ATOMIC_OPERATIONS],
+[AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins],
+[AC_TRY_RUN([
+int main()
+{
+ unsigned long val = 1010, tmp, *mem = &val;
+
+ if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
+ return 1;
+
+ tmp = val;
+
+ if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
+ return 1;
+
+ if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
+ return 1;
+
+ tmp = 3030;
+
+ if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
+ return 1;
+
+ if (__sync_lock_test_and_set(&val, 4040) != 3030)
+ return 1;
+
+ mem = &tmp;
+
+ if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
+ return 1;
+
+ __sync_synchronize();
+
+ if (mem != &val)
+ return 1;
+
+ return 0;
+}], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])])
+
+if test "$ap_cv_atomic_builtins" = "yes"; then
+ AC_DEFINE(HAVE_ATOMIC_BUILTINS, 1, [Define if compiler provides atomic builtins])
+fi
+
+])
diff --git a/plugins/im3195/Makefile.am b/plugins/im3195/Makefile.am
index bfceb71..5af0b6f 100644
--- a/plugins/im3195/Makefile.am
+++ b/plugins/im3195/Makefile.am
@@ -1,7 +1,7 @@
pkglib_LTLIBRARIES = im3195.la
im3195_la_SOURCES = im3195.c
-im3195_la_CPPFLAGS = $(rsrt_cflags) $(pthreads_cflags) $(LIBLOGGING_CFLAGS)
+im3195_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) $(LIBLOGGING_CFLAGS)
im3195_la_LDFLAGS = -module -avoid-version
im3195_la_LIBADD = $(LIBLOGGING_LIBS)
diff --git a/plugins/im3195/Makefile.in b/plugins/im3195/Makefile.in
index 06d8aaf..495eb54 100644
--- a/plugins/im3195/Makefile.in
+++ b/plugins/im3195/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/im3195
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,42 +190,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = im3195.la
im3195_la_SOURCES = im3195.c
-im3195_la_CPPFLAGS = $(rsrt_cflags) $(pthreads_cflags) $(LIBLOGGING_CFLAGS)
+im3195_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) $(LIBLOGGING_CFLAGS)
im3195_la_LDFLAGS = -module -avoid-version
im3195_la_LIBADD = $(LIBLOGGING_LIBS)
EXTRA_DIST =
diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c
index 32dd8dc..1c2502f 100644
--- a/plugins/im3195/im3195.c
+++ b/plugins/im3195/im3195.c
@@ -83,7 +83,7 @@ void OnReceive(srAPIObj __attribute__((unused)) *pMyAPI, srSLMGObj* pSLMG)
srSLMGGetRawMSG(pSLMG, &pszRawMsg);
parseAndSubmitMessage(fromHost, fromHostIP, pszRawMsg, strlen((char*)pszRawMsg),
- MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_FULL_DELAY);
+ MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_FULL_DELAY, (uchar*)"im3195");
}
diff --git a/plugins/imdiag/Makefile.am b/plugins/imdiag/Makefile.am
new file mode 100644
index 0000000..33e86e9
--- /dev/null
+++ b/plugins/imdiag/Makefile.am
@@ -0,0 +1,6 @@
+pkglib_LTLIBRARIES = imdiag.la
+
+imdiag_la_SOURCES = imdiag.c
+imdiag_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+imdiag_la_LDFLAGS = -module -avoid-version
+imdiag_la_LIBADD =
diff --git a/plugins/imdiag/Makefile.in b/plugins/imdiag/Makefile.in
new file mode 100644
index 0000000..0396286
--- /dev/null
+++ b/plugins/imdiag/Makefile.in
@@ -0,0 +1,503 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = plugins/imdiag
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkglibdir)"
+pkglibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(pkglib_LTLIBRARIES)
+imdiag_la_DEPENDENCIES =
+am_imdiag_la_OBJECTS = imdiag_la-imdiag.lo
+imdiag_la_OBJECTS = $(am_imdiag_la_OBJECTS)
+imdiag_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(imdiag_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(imdiag_la_SOURCES)
+DIST_SOURCES = $(imdiag_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
+GREP = @GREP@
+GSS_LIBS = @GSS_LIBS@
+HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
+HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
+LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
+LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
+PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
+RANLIB = @RANLIB@
+RELP_CFLAGS = @RELP_CFLAGS@
+RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moddirs = @moddirs@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+pkglib_LTLIBRARIES = imdiag.la
+imdiag_la_SOURCES = imdiag.c
+imdiag_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+imdiag_la_LDFLAGS = -module -avoid-version
+imdiag_la_LIBADD =
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/imdiag/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plugins/imdiag/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)"
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-pkglibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ done
+
+clean-pkglibLTLIBRARIES:
+ -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+imdiag.la: $(imdiag_la_OBJECTS) $(imdiag_la_DEPENDENCIES)
+ $(imdiag_la_LINK) -rpath $(pkglibdir) $(imdiag_la_OBJECTS) $(imdiag_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imdiag_la-imdiag.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+imdiag_la-imdiag.lo: imdiag.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(imdiag_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT imdiag_la-imdiag.lo -MD -MP -MF $(DEPDIR)/imdiag_la-imdiag.Tpo -c -o imdiag_la-imdiag.lo `test -f 'imdiag.c' || echo '$(srcdir)/'`imdiag.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/imdiag_la-imdiag.Tpo $(DEPDIR)/imdiag_la-imdiag.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='imdiag.c' object='imdiag_la-imdiag.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(imdiag_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o imdiag_la-imdiag.lo `test -f 'imdiag.c' || echo '$(srcdir)/'`imdiag.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-pkglibLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkglibLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pkglibLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
new file mode 100644
index 0000000..3cd2dcf
--- /dev/null
+++ b/plugins/imdiag/imdiag.c
@@ -0,0 +1,197 @@
+/* imdiag.c
+ * This is a diagnostics module, primarily meant for troubleshooting
+ * and information about the runtime state of rsyslog. It is implemented
+ * as an input plugin, because that interface best suits our needs
+ * and also enables us to inject test messages (something not yet
+ * implemented).
+ *
+ * File begun on 2008-07-25 by RGerhards
+ *
+ * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include "rsyslog.h"
+//#include "dirty.h"
+#include "cfsysline.h"
+#include "module-template.h"
+#include "net.h"
+#include "netstrm.h"
+#include "errmsg.h"
+
+MODULE_TYPE_INPUT
+
+/* static data */
+DEF_IMOD_STATIC_DATA
+DEFobjCurrIf(net)
+DEFobjCurrIf(netstrm)
+DEFobjCurrIf(errmsg)
+
+/* Module static data */
+netstrms_t *pNS; /**< pointer to network stream subsystem */
+netstrm_t **ppLstn[10]; /**< our netstream listners */
+int iLstnMax = 0; /**< max nbr of listeners currently supported */
+
+
+/* config settings */
+
+
+/* add a listen socket to our listen socket array. This is a callback
+ * invoked from the netstrm class. -- rgerhards, 2008-04-23
+ */
+static rsRetVal
+addTcpLstn(void *pUsr, netstrm_t *pLstn)
+{
+ DEFiRet;
+
+ ISOBJ_TYPE_assert(pLstn, netstrm);
+
+ if(iLstnMax >= sizeof(ppLstn)/sizeof(netstrm_t))
+ ABORT_FINALIZE(RS_RET_MAX_LSTN_REACHED);
+
+ ppLstn[pThis->iLstnMax] = pLstn;
+ ++iLstnMax;
+
+finalize_it:
+ RETiRet;
+}
+
+
+/* initialize network stream subsystem */
+static rsRetVal
+initNetstrm(void)
+{
+ DEFiRet;
+
+ /* prepare network stream subsystem */
+ CHKiRet(netstrms.Construct(&pNS));
+ CHKiRet(netstrms.SetDrvrMode(pNS, 0)); /* always plain text */
+ //CHKiRet(netstrms.SetDrvrAuthMode(pThis->pNS, pThis->pszDrvrAuthMode));
+ //CHKiRet(netstrms.SetDrvrPermPeers(pThis->pNS, pThis->pPermPeers));
+ // TODO: set driver!
+ CHKiRet(netstrms.ConstructFinalize(pThis->pNS));
+
+ /* set up listeners */
+ CHKiRet(netstrm.LstnInit(pNS, NULL, addTcpLstn, "127.0.0.1", "44514", 1));
+
+finalize_it:
+ if(iRet != RS_RET_OK) {
+ if(pThis->pNS != NULL)
+ netstrms.Destruct(&pThis->pNS);
+ }
+ RETiRet;
+}
+
+
+/* This function is called to gather input. In our case, it is a bit abused
+ * to drive the listener loop for the diagnostics code.
+ */
+BEGINrunInput
+CODESTARTrunInput
+ENDrunInput
+
+
+/* initialize and return if will run or not */
+BEGINwillRun
+CODESTARTwillRun
+ iRet = initNetstrm();
+ENDwillRun
+
+
+BEGINafterRun
+CODESTARTafterRun
+ /* do cleanup here */
+ /* finally close our listen streams */
+ for(i = 0 ; i < iLstnMax ; ++i) {
+ netstrm.Destruct(ppLstn + i);
+ }
+
+ /* destruct netstream subsystem */
+ netstrms.Destruct(pNS);
+ENDafterRun
+
+
+BEGINmodExit
+CODESTARTmodExit
+ /* release objects we used */
+ objRelease(net, LM_NET_FILENAME);
+ objRelease(netstrm, LM_NETSTRMS_FILENAME);
+ objRelease(errmsg, CORE_COMPONENT);
+ENDmodExit
+
+
+static rsRetVal
+resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
+{
+ return RS_RET_OK;
+}
+
+
+
+BEGINqueryEtryPt
+CODESTARTqueryEtryPt
+CODEqueryEtryPt_STD_IMOD_QUERIES
+ENDqueryEtryPt
+
+
+BEGINmodInit()
+CODESTARTmodInit
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
+CODEmodInit_QueryRegCFSLineHdlr
+ pOurTcpsrv = NULL;
+ /* request objects we use */
+ CHKiRet(objUse(net, LM_NET_FILENAME));
+ CHKiRet(objUse(netstrm, LM_NETSTRMS_FILENAME));
+ CHKiRet(objUse(errmsg, CORE_COMPONENT));
+
+#if 0
+ /* register config file handlers */
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverrun", 0, eCmdHdlrGetWord,
+ addTCPListener, NULL, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpmaxsessions", 0, eCmdHdlrInt,
+ NULL, &iTCPSessMax, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverstreamdrivermode", 0,
+ eCmdHdlrInt, NULL, &iStrmDrvrMode, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverstreamdriverauthmode", 0,
+ eCmdHdlrGetWord, NULL, &pszStrmDrvrAuthMode, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverstreamdriverpermittedpeer", 0,
+ eCmdHdlrGetWord, setPermittedPeer, NULL, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
+ resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
+#endif
+ENDmodInit
+
+
+/* vim:set ai:
+ */
diff --git a/plugins/imfile/Makefile.am b/plugins/imfile/Makefile.am
index a4011d1..551639b 100644
--- a/plugins/imfile/Makefile.am
+++ b/plugins/imfile/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imfile.la
imfile_la_SOURCES = imfile.c
-imfile_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imfile_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imfile_la_LDFLAGS = -module -avoid-version
imfile_la_LIBADD =
diff --git a/plugins/imfile/Makefile.in b/plugins/imfile/Makefile.in
index 9039537..b99de5e 100644
--- a/plugins/imfile/Makefile.in
+++ b/plugins/imfile/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imfile
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imfile.la
imfile_la_SOURCES = imfile.c
-imfile_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imfile_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imfile_la_LDFLAGS = -module -avoid-version
imfile_la_LIBADD =
all: all-am
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 3bc07b9..b0211bf 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -94,6 +94,7 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
CHKiRet(msgConstruct(&pMsg));
MsgSetFlowControlType(pMsg, eFLOWCTL_FULL_DELAY);
+ MsgSetInputName(pMsg, "imfile");
MsgSetUxTradMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
MsgSetMSG(pMsg, (char*)rsCStrGetSzStr(cstrLine));
@@ -102,7 +103,6 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
pMsg->iFacility = LOG_FAC(pInfo->iFacility);
pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
pMsg->bParseHOSTNAME = 0;
- datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
CHKiRet(submitMsg(pMsg));
finalize_it:
RETiRet;
diff --git a/plugins/imgssapi/Makefile.am b/plugins/imgssapi/Makefile.am
index a5cce32..ea01635 100644
--- a/plugins/imgssapi/Makefile.am
+++ b/plugins/imgssapi/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imgssapi.la
imgssapi_la_SOURCES = imgssapi.c
-imgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imgssapi_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imgssapi_la_LDFLAGS = -module -avoid-version
-imgssapi_la_LIBADD = $(gss_libs)
+imgssapi_la_LIBADD = $(GSS_LIBS)
diff --git a/plugins/imgssapi/Makefile.in b/plugins/imgssapi/Makefile.in
index 26f57f9..861acff 100644
--- a/plugins/imgssapi/Makefile.in
+++ b/plugins/imgssapi/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imgssapi
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,44 +190,31 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imgssapi.la
imgssapi_la_SOURCES = imgssapi.c
-imgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imgssapi_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imgssapi_la_LDFLAGS = -module -avoid-version
-imgssapi_la_LIBADD = $(gss_libs)
+imgssapi_la_LIBADD = $(GSS_LIBS)
all: all-am
.SUFFIXES:
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index d2b5fd8..debe935 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -55,6 +55,7 @@
#include "tcps_sess.h"
#include "errmsg.h"
#include "netstrm.h"
+#include "glbl.h"
MODULE_TYPE_INPUT
@@ -80,6 +81,7 @@ DEFobjCurrIf(gssutil)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(netstrm)
DEFobjCurrIf(net)
+DEFobjCurrIf(glbl)
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
static gss_cred_id_t gss_server_creds = GSS_C_NO_CREDENTIAL;
@@ -399,10 +401,14 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
allowedMethods = pGSrv->allowedMethods;
if(allowedMethods & ALLOWEDMETHOD_GSS) {
/* Buffer to store raw message in case that
- * gss authentication fails halfway through.
+ * gss authentication fails halfway through. This buffer
+ * is currently dynamically allocated, for performance
+ * reasons we should look for a better way to do it.
+ * rgerhars, 2008-09-02
*/
- char buf[MAXLINE];
+ char *buf;
int ret = 0;
+ CHKmalloc(buf = (char*) malloc(sizeof(char) * (glbl.GetMaxLine() + 1)));
dbgprintf("GSS-API Trying to accept TCP session %p\n", pSess);
@@ -655,6 +661,7 @@ CODESTARTmodExit
objRelease(tcpsrv, LM_TCPSRV_FILENAME);
objRelease(gssutil, LM_GSSUTIL_FILENAME);
objRelease(errmsg, CORE_COMPONENT);
+ objRelease(glbl, CORE_COMPONENT);
objRelease(netstrm, LM_NETSTRM_FILENAME);
objRelease(net, LM_NET_FILENAME);
ENDmodExit
@@ -696,6 +703,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(tcpsrv, LM_TCPSRV_FILENAME));
CHKiRet(objUse(gssutil, LM_GSSUTIL_FILENAME));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(netstrm, LM_NETSTRM_FILENAME));
CHKiRet(objUse(net, LM_NET_FILENAME));
diff --git a/plugins/imklog/Makefile.am b/plugins/imklog/Makefile.am
index 8f50cfb..5d4d046 100644
--- a/plugins/imklog/Makefile.am
+++ b/plugins/imklog/Makefile.am
@@ -11,6 +11,6 @@ if ENABLE_IMKLOG_LINUX
imklog_la_SOURCES += linux.c module.h ksym.c ksyms.h ksym_mod.c
endif
-imklog_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imklog_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imklog_la_LDFLAGS = -module -avoid-version
imklog_la_LIBADD =
diff --git a/plugins/imklog/Makefile.in b/plugins/imklog/Makefile.in
index e0cd8bf..9e0fe77 100644
--- a/plugins/imklog/Makefile.in
+++ b/plugins/imklog/Makefile.in
@@ -39,7 +39,8 @@ host_triplet = @host@
subdir = plugins/imklog
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -103,6 +104,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -112,8 +114,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -122,6 +126,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -131,6 +137,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -140,15 +148,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -170,13 +188,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -186,42 +200,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imklog.la
imklog_la_SOURCES = imklog.c imklog.h $(am__append_1) $(am__append_2)
-imklog_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imklog_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imklog_la_LDFLAGS = -module -avoid-version
imklog_la_LIBADD =
all: all-am
diff --git a/plugins/imklog/bsd.c b/plugins/imklog/bsd.c
index 39b644c..090c4e9 100644
--- a/plugins/imklog/bsd.c
+++ b/plugins/imklog/bsd.c
@@ -110,15 +110,33 @@ klogWillRun(void)
static void
readklog(void)
{
- char *p, *q, line[MAXLINE + 1];
+ char *p, *q;
int len, i;
+ int iMaxLine;
+ uchar bufRcv[4096+1];
+ uchar *pRcv = NULL; /* receive buffer */
+
+ iMaxLine = klog_getMaxLine();
+
+ /* we optimize performance: if iMaxLine is below 4K (which it is in almost all
+ * cases, we use a fixed buffer on the stack. Only if it is higher, heap memory
+ * is used. We could use alloca() to achive a similar aspect, but there are so
+ * many issues with alloca() that I do not want to take that route.
+ * rgerhards, 2008-09-02
+ */
+ if((size_t) iMaxLine < sizeof(bufRcv) - 1) {
+ pRcv = bufRcv;
+ } else {
+ if((pRcv = (uchar*) malloc(sizeof(uchar) * (iMaxLine + 1))) == NULL)
+ iMaxLine = sizeof(bufRcv) - 1; /* better this than noting */
+ }
len = 0;
for (;;) {
- dbgprintf("----------imklog waiting for kernel log line\n");
- i = read(fklog, line + len, MAXLINE - 1 - len);
+ dbgprintf("----------imklog(BSD) waiting for kernel log line\n");
+ i = read(fklog, pRcv + len, iMaxLine - len);
if (i > 0) {
- line[i + len] = '\0';
+ pRcv[i + len] = '\0';
} else {
if (i < 0 && errno != EINTR && errno != EAGAIN) {
imklogLogIntMsg(LOG_ERR,
@@ -129,20 +147,23 @@ readklog(void)
break;
}
- for (p = line; (q = strchr(p, '\n')) != NULL; p = q + 1) {
+ for (p = pRcv; (q = strchr(p, '\n')) != NULL; p = q + 1) {
*q = '\0';
Syslog(LOG_INFO, (uchar*) p);
}
len = strlen(p);
- if (len >= MAXLINE - 1) {
+ if (len >= iMaxLine - 1) {
Syslog(LOG_INFO, (uchar*)p);
len = 0;
}
if (len > 0)
- memmove(line, p, len + 1);
+ memmove(pRcv, p, len + 1);
}
if (len > 0)
- Syslog(LOG_INFO, (uchar*)line);
+ Syslog(LOG_INFO, pRcv);
+
+ if(pRcv != NULL && (size_t) iMaxLine >= sizeof(bufRcv) - 1)
+ free(pRcv);
}
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 1fbc287..20bc34a 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -94,6 +94,8 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity)
CHKiRet(msgConstruct(&pMsg));
MsgSetFlowControlType(pMsg, eFLOWCTL_LIGHT_DELAY);
+ MsgSetInputName(pMsg, "imklog");
+ MsgSetRawMsg(pMsg, (char*)msg);
MsgSetUxTradMsg(pMsg, (char*)msg);
MsgSetRawMsg(pMsg, (char*)msg);
MsgSetMSG(pMsg, (char*)msg);
@@ -104,7 +106,6 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity)
pMsg->iFacility = LOG_FAC(iFacility);
pMsg->iSeverity = LOG_PRI(iSeverity);
pMsg->bParseHOSTNAME = 0;
- datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
CHKiRet(submitMsg(pMsg));
finalize_it:
@@ -198,6 +199,17 @@ finalize_it:
}
+/* helper for some klog drivers which need to know the MaxLine global setting. They can
+ * not obtain it themselfs, because they are no modules and can not query the object hander.
+ * It would probably be a good idea to extend the interface to support it, but so far
+ * we create a (sufficiently valid) work-around. -- rgerhards, 2008-11-24
+ */
+int klog_getMaxLine(void)
+{
+ return glbl.GetMaxLine();
+}
+
+
BEGINrunInput
CODESTARTrunInput
/* this is an endless loop - it is terminated when the thread is
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index 0847140..37bd58b 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -58,6 +58,7 @@ rsRetVal imklogLogIntMsg(int priority, char *fmt, ...) __attribute__((format(pri
rsRetVal Syslog(int priority, uchar *msg);
/* prototypes */
+extern int klog_getMaxLine(void); /* work-around for klog drivers to get configured max line size */
extern int InitKsyms(char *);
extern void DeinitKsyms(void);
extern int InitMsyms(void);
diff --git a/plugins/immark/Makefile.am b/plugins/immark/Makefile.am
index 9c0f8f6..6d8ed24 100644
--- a/plugins/immark/Makefile.am
+++ b/plugins/immark/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = immark.la
immark_la_SOURCES = immark.c immark.h
-immark_la_CPPFLAGS = $(rsrt_cflags) -I$(top_srcdir) $(pthreads_cflags)
+immark_la_CPPFLAGS = $(RSRT_CFLAGS) -I$(top_srcdir) $(PTHREADS_CFLAGS)
immark_la_LDFLAGS = -module -avoid-version
immark_la_LIBADD =
diff --git a/plugins/immark/Makefile.in b/plugins/immark/Makefile.in
index 1efd6d1..ca14e28 100644
--- a/plugins/immark/Makefile.in
+++ b/plugins/immark/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/immark
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = immark.la
immark_la_SOURCES = immark.c immark.h
-immark_la_CPPFLAGS = $(rsrt_cflags) -I$(top_srcdir) $(pthreads_cflags)
+immark_la_CPPFLAGS = $(RSRT_CFLAGS) -I$(top_srcdir) $(PTHREADS_CFLAGS)
immark_la_LDFLAGS = -module -avoid-version
immark_la_LIBADD =
all: all-am
diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c
index bdca4d5..323da3f 100644
--- a/plugins/immark/immark.c
+++ b/plugins/immark/immark.c
@@ -76,7 +76,7 @@ CODESTARTrunInput
* rgerhards, 2007-12-17
*/
CHKiRet(thrdSleep(pThrd, iMarkMessagePeriod, 0)); /* seconds, micro seconds */
- logmsgInternal(NO_ERRCODE, LOG_INFO, (uchar*)"-- MARK --", ADDDATE|MARK);
+ logmsgInternal(NO_ERRCODE, LOG_INFO, (uchar*)"-- MARK --", MARK);
}
finalize_it:
return iRet;
diff --git a/plugins/imrelp/Makefile.am b/plugins/imrelp/Makefile.am
index a96e2b4..8c6faff 100644
--- a/plugins/imrelp/Makefile.am
+++ b/plugins/imrelp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imrelp.la
imrelp_la_SOURCES = imrelp.c
-imrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS) $(rsrt_cflags)
+imrelp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RELP_CFLAGS) $(RSRT_CFLAGS)
imrelp_la_LDFLAGS = -module -avoid-version
imrelp_la_LIBADD = $(RELP_LIBS)
diff --git a/plugins/imrelp/Makefile.in b/plugins/imrelp/Makefile.in
index dc3c3f3..95084d6 100644
--- a/plugins/imrelp/Makefile.in
+++ b/plugins/imrelp/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imrelp
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,42 +190,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imrelp.la
imrelp_la_SOURCES = imrelp.c
-imrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS) $(rsrt_cflags)
+imrelp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RELP_CFLAGS) $(RSRT_CFLAGS)
imrelp_la_LDFLAGS = -module -avoid-version
imrelp_la_LIBADD = $(RELP_LIBS)
all: all-am
diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c
index 5c9bbce..b01dd98 100644
--- a/plugins/imrelp/imrelp.c
+++ b/plugins/imrelp/imrelp.c
@@ -84,7 +84,7 @@ onSyslogRcv(uchar *pHostname, uchar __attribute__((unused)) *pIP, uchar *pMsg, s
{
DEFiRet;
parseAndSubmitMessage(pHostname, (uchar*) "[unset]", pMsg, lenMsg, MSG_PARSE_HOSTNAME,
- NOFLAG, eFLOWCTL_LIGHT_DELAY);
+ NOFLAG, eFLOWCTL_LIGHT_DELAY, (uchar*)"imrelp");
RETiRet;
}
diff --git a/plugins/imtcp/Makefile.am b/plugins/imtcp/Makefile.am
index de746a9..2665353 100644
--- a/plugins/imtcp/Makefile.am
+++ b/plugins/imtcp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imtcp.la
imtcp_la_SOURCES = imtcp.c
-imtcp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imtcp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imtcp_la_LDFLAGS = -module -avoid-version
imtcp_la_LIBADD =
diff --git a/plugins/imtcp/Makefile.in b/plugins/imtcp/Makefile.in
index 2fd148b..e32472d 100644
--- a/plugins/imtcp/Makefile.in
+++ b/plugins/imtcp/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imtcp
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imtcp.la
imtcp_la_SOURCES = imtcp.c
-imtcp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imtcp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imtcp_la_LDFLAGS = -module -avoid-version
imtcp_la_LIBADD =
all: all-am
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index 89f1dbc..7b3eeda 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -160,6 +160,7 @@ static rsRetVal addTCPListener(void __attribute__((unused)) *pVal, uchar *pNewVa
if(pOurTcpsrv == NULL) {
CHKiRet(tcpsrv.Construct(&pOurTcpsrv));
+ CHKiRet(tcpsrv.SetSessMax(pOurTcpsrv, iTCPSessMax));
CHKiRet(tcpsrv.SetCBIsPermittedHost(pOurTcpsrv, isPermittedHost));
CHKiRet(tcpsrv.SetCBRcvData(pOurTcpsrv, doRcvData));
CHKiRet(tcpsrv.SetCBOpenLstnSocks(pOurTcpsrv, doOpenLstnSocks));
diff --git a/plugins/imtemplate/Makefile.am b/plugins/imtemplate/Makefile.am
index 0ea4355..1825b5b 100644
--- a/plugins/imtemplate/Makefile.am
+++ b/plugins/imtemplate/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imtemplate.la
imtemplate_la_SOURCES = imtemplate.c
-imtemplate_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imtemplate_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imtemplate_la_LDFLAGS = -module -avoid-version
imtemplate_la_LIBADD =
diff --git a/plugins/imtemplate/Makefile.in b/plugins/imtemplate/Makefile.in
index 96de010..e1444e8 100644
--- a/plugins/imtemplate/Makefile.in
+++ b/plugins/imtemplate/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imtemplate
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imtemplate.la
imtemplate_la_SOURCES = imtemplate.c
-imtemplate_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imtemplate_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imtemplate_la_LDFLAGS = -module -avoid-version
imtemplate_la_LIBADD =
all: all-am
diff --git a/plugins/imtemplate/imtemplate.c b/plugins/imtemplate/imtemplate.c
index 6d29c4f..366408a 100644
--- a/plugins/imtemplate/imtemplate.c
+++ b/plugins/imtemplate/imtemplate.c
@@ -269,7 +269,6 @@ CODESTARTrunInput
pMsg->iFacility = LOG_FAC(pri);
pMsg->iSeverity = LOG_PRI(pri);
pMsg->bParseHOSTNAME = 0;
- getCurrTime(&(pMsg->tTIMESTAMP)); / * use the current time! * /
flags |= INTERNAL_MSG;
logmsg(pMsg, flags); / * some time, CHKiRet() will work here, too [today NOT!] * /
*
@@ -315,7 +314,7 @@ CODESTARTwillRun
if(udpLstnSocks == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
- if((pRcvBuf = malloc(MAXLINE * sizeof(char))) == NULL) {
+ if((pRcvBuf = malloc(glbl.GetMaxLine * sizeof(char))) == NULL) {
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
}
*
diff --git a/plugins/imudp/Makefile.am b/plugins/imudp/Makefile.am
index 28ee985..517b128 100644
--- a/plugins/imudp/Makefile.am
+++ b/plugins/imudp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imudp.la
imudp_la_SOURCES = imudp.c
-imudp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imudp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imudp_la_LDFLAGS = -module -avoid-version
imudp_la_LIBADD =
diff --git a/plugins/imudp/Makefile.in b/plugins/imudp/Makefile.in
index 4d84a07..c76dd8b 100644
--- a/plugins/imudp/Makefile.in
+++ b/plugins/imudp/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imudp
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imudp.la
imudp_la_SOURCES = imudp.c
-imudp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imudp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imudp_la_LDFLAGS = -module -avoid-version
imudp_la_LIBADD =
all: all-am
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index b18c0db..e9e82b2 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -51,6 +51,7 @@ DEFobjCurrIf(errmsg)
DEFobjCurrIf(glbl)
DEFobjCurrIf(net)
+static int iMaxLine; /* maximum UDP message size supported */
static time_t ttLastDiscard = 0; /* timestamp when a message from a non-permitted sender was last discarded
* This shall prevent remote DoS when the "discard on disallowed sender"
* message is configured to be logged on occurance of such a case.
@@ -184,7 +185,7 @@ CODESTARTrunInput
for (i = 0; nfds && i < *udpLstnSocks; i++) {
if (FD_ISSET(udpLstnSocks[i+1], &readfds)) {
socklen = sizeof(frominet);
- l = recvfrom(udpLstnSocks[i+1], (char*) pRcvBuf, MAXLINE - 1, 0,
+ l = recvfrom(udpLstnSocks[i+1], (char*) pRcvBuf, iMaxLine, 0,
(struct sockaddr *)&frominet, &socklen);
if (l > 0) {
if(net.cvthname(&frominet, fromHost, fromHostFQDN, fromHostIP) == RS_RET_OK) {
@@ -199,7 +200,7 @@ CODESTARTrunInput
if(net.isAllowedSender((uchar*) "UDP",
(struct sockaddr *)&frominet, (char*)fromHostFQDN)) {
parseAndSubmitMessage(fromHost, fromHostIP, pRcvBuf, l,
- MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_NO_DELAY);
+ MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_NO_DELAY, (uchar*)"imudp");
} else {
dbgprintf("%s is not an allowed sender\n", (char*)fromHostFQDN);
if(glbl.GetOption_DisallowWarning) {
@@ -242,7 +243,9 @@ CODESTARTwillRun
if(udpLstnSocks == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
- if((pRcvBuf = malloc(MAXLINE * sizeof(char))) == NULL) {
+ iMaxLine = glbl.GetMaxLine();
+
+ if((pRcvBuf = malloc((iMaxLine + 1) * sizeof(char))) == NULL) {
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
}
finalize_it:
diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am
index 11a0ba3..a2fe0ba 100644
--- a/plugins/imuxsock/Makefile.am
+++ b/plugins/imuxsock/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imuxsock.la
imuxsock_la_SOURCES = imuxsock.c
-imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imuxsock_la_LDFLAGS = -module -avoid-version
imuxsock_la_LIBADD =
diff --git a/plugins/imuxsock/Makefile.in b/plugins/imuxsock/Makefile.in
index 072d082..c9032af 100644
--- a/plugins/imuxsock/Makefile.in
+++ b/plugins/imuxsock/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/imuxsock
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = imuxsock.la
imuxsock_la_SOURCES = imuxsock.c
-imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imuxsock_la_LDFLAGS = -module -avoid-version
imuxsock_la_LIBADD =
all: all-am
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 05bcb64..55b8b2d 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -71,14 +71,18 @@ static int startIndexUxLocalSockets; /* process funix from that index on (used t
* read-only after startup
*/
static int funixParseHost[MAXFUNIX] = { 0, }; /* should parser parse host name? read-only after startup */
-static int funixFlags[MAXFUNIX] = { ADDDATE, }; /* should parser parse host name? read-only after startup */
+static int funixFlags[MAXFUNIX] = { IGNDATE, }; /* should parser parse host name? read-only after startup */
static uchar *funixn[MAXFUNIX] = { (uchar*) _PATH_LOG }; /* read-only after startup */
+static uchar *funixHName[MAXFUNIX] = { NULL, }; /* host-name override - if set, use this instead of actual name */
+static int funixFlowCtl[MAXFUNIX] = { eFLOWCTL_NO_DELAY, }; /* flow control settings for this socket */
static int funix[MAXFUNIX] = { -1, }; /* read-only after startup */
static int nfunix = 1; /* number of Unix sockets open / read-only after startup */
/* config settings */
static int bOmitLocalLogging = 0;
static uchar *pLogSockName = NULL;
+static uchar *pLogHostName = NULL; /* host name to use with this socket */
+static int bUseFlowCtl = 0; /* use flow control or not (if yes, only LIGHT is used! */
static int bIgnoreTimestamp = 1; /* ignore timestamps present in the incoming message? */
@@ -89,10 +93,18 @@ static int bIgnoreTimestamp = 1; /* ignore timestamps present in the incoming me
static rsRetVal setSystemLogTimestampIgnore(void __attribute__((unused)) *pVal, int iNewVal)
{
DEFiRet;
- funixFlags[0] = iNewVal ? ADDDATE : NOFLAG;
+ funixFlags[0] = iNewVal ? IGNDATE : NOFLAG;
RETiRet;
}
+/* set flowcontrol for the system log socket
+ */
+static rsRetVal setSystemLogFlowControl(void __attribute__((unused)) *pVal, int iNewVal)
+{
+ DEFiRet;
+ funixFlowCtl[0] = iNewVal ? eFLOWCTL_LIGHT_DELAY : eFLOWCTL_NO_DELAY;
+ RETiRet;
+}
/* add an additional listen socket. Socket names are added
* until the array is filled up. It is never reset, only at
@@ -100,6 +112,7 @@ static rsRetVal setSystemLogTimestampIgnore(void __attribute__((unused)) *pVal,
* TODO: we should change the array to a list so that we
* can support any number of listen socket names.
* rgerhards, 2007-12-20
+ * added capability to specify hostname for socket -- rgerhards, 2008-08-01
*/
static rsRetVal addLstnSocketName(void __attribute__((unused)) *pVal, uchar *pNewVal)
{
@@ -110,7 +123,10 @@ static rsRetVal addLstnSocketName(void __attribute__((unused)) *pVal, uchar *pNe
else {
funixParseHost[nfunix] = 0;
}
- funixFlags[nfunix] = bIgnoreTimestamp ? ADDDATE : NOFLAG;
+ funixHName[nfunix] = pLogHostName;
+ pLogHostName = NULL; /* re-init for next, not freed because funixHName[] now owns it */
+ funixFlowCtl[nfunix] = bUseFlowCtl ? eFLOWCTL_LIGHT_DELAY : eFLOWCTL_NO_DELAY;
+ funixFlags[nfunix] = bIgnoreTimestamp ? IGNDATE : NOFLAG;
funixn[nfunix++] = pNewVal;
}
else {
@@ -134,6 +150,10 @@ static rsRetVal discardFunixn(void)
free(funixn[i]);
funixn[i] = NULL;
}
+ if(funixHName[i] != NULL) {
+ free(funixHName[i]);
+ funixHName[i] = NULL;
+ }
}
return RS_RET_OK;
@@ -144,7 +164,6 @@ static int create_unix_socket(const char *path)
{
struct sockaddr_un sunx;
int fd;
- char line[MAXLINE +1];
if (path[0] == '\0')
return -1;
@@ -155,11 +174,9 @@ static int create_unix_socket(const char *path)
sunx.sun_family = AF_UNIX;
(void) strncpy(sunx.sun_path, path, sizeof(sunx.sun_path));
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
- if (fd < 0 || bind(fd, (struct sockaddr *) &sunx,
- SUN_LEN(&sunx)) < 0 ||
+ if (fd < 0 || bind(fd, (struct sockaddr *) &sunx, SUN_LEN(&sunx)) < 0 ||
chmod(path, 0666) < 0) {
- snprintf(line, sizeof(line), "cannot create %s", path);
- errmsg.LogError(errno, NO_ERRCODE, "%s", line);
+ errmsg.LogError(errno, NO_ERRCODE, "connot create '%s'", path);
dbgprintf("cannot create %s (%d).\n", path, errno);
close(fd);
return -1;
@@ -171,18 +188,40 @@ static int create_unix_socket(const char *path)
/* This function receives data from a socket indicated to be ready
* to receive and submits the message received for processing.
* rgerhards, 2007-12-20
+ * Interface changed so that this function is passed the array index
+ * of the socket which is to be processed. This eases access to the
+ * growing number of properties. -- rgerhards, 2008-08-01
*/
-static rsRetVal readSocket(int fd, int bParseHost, int flags)
+static rsRetVal readSocket(int fd, int iSock)
{
DEFiRet;
int iRcvd;
- uchar line[MAXLINE +1];
+ int iMaxLine;
+ uchar bufRcv[4096+1];
+ uchar *pRcv = NULL; /* receive buffer */
+
+ assert(iSock >= 0);
+
+ iMaxLine = glbl.GetMaxLine();
- iRcvd = recv(fd, line, MAXLINE - 1, 0);
+ /* we optimize performance: if iMaxLine is below 4K (which it is in almost all
+ * cases, we use a fixed buffer on the stack. Only if it is higher, heap memory
+ * is used. We could use alloca() to achive a similar aspect, but there are so
+ * many issues with alloca() that I do not want to take that route.
+ * rgerhards, 2008-09-02
+ */
+ if((size_t) iMaxLine < sizeof(bufRcv) - 1) {
+ pRcv = bufRcv;
+ } else {
+ CHKmalloc(pRcv = (uchar*) malloc(sizeof(uchar) * (iMaxLine + 1)));
+ }
+
+ iRcvd = recv(fd, pRcv, iMaxLine, 0);
dbgprintf("Message from UNIX socket: #%d\n", fd);
if (iRcvd > 0) {
- parseAndSubmitMessage(glbl.GetLocalHostName(), (uchar*)"127.0.0.1", line,
- iRcvd, bParseHost, flags, eFLOWCTL_NO_DELAY);
+ parseAndSubmitMessage(funixHName[iSock] == NULL ? glbl.GetLocalHostName() : funixHName[iSock],
+ (uchar*)"127.0.0.1", pRcv,
+ iRcvd, funixParseHost[iSock], funixFlags[iSock], funixFlowCtl[iSock], (uchar*)"imuxsock");
} else if (iRcvd < 0 && errno != EINTR) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
@@ -190,12 +229,15 @@ static rsRetVal readSocket(int fd, int bParseHost, int flags)
errmsg.LogError(errno, NO_ERRCODE, "recvfrom UNIX");
}
+finalize_it:
+ if(pRcv != NULL && (size_t) iMaxLine >= sizeof(bufRcv) - 1)
+ free(pRcv);
+
RETiRet;
}
-/* This function is called to gather input.
- */
+/* This function is called to gather input. */
BEGINrunInput
int maxfds;
int nfds;
@@ -237,7 +279,7 @@ CODESTARTrunInput
for (i = 0; i < nfunix && nfds > 0; i++) {
if ((fd = funix[i]) != -1 && FD_ISSET(fd, &readfds)) {
- readSocket(fd, funixParseHost[i], funixFlags[i]);
+ readSocket(fd, i);
--nfds; /* indicate we have processed one */
}
}
@@ -282,6 +324,9 @@ CODESTARTafterRun
/* free no longer needed string */
if(pLogSockName != NULL)
free(pLogSockName);
+ if(pLogHostName != NULL) {
+ free(pLogHostName);
+ }
discardFunixn();
nfunix = 1;
@@ -307,10 +352,15 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
free(pLogSockName);
pLogSockName = NULL;
}
+ if(pLogHostName != NULL) {
+ free(pLogHostName);
+ pLogHostName = NULL;
+ }
discardFunixn();
nfunix = 1;
bIgnoreTimestamp = 1;
+ bUseFlowCtl = 0;
return RS_RET_OK;
}
@@ -324,6 +374,8 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(glbl, CORE_COMPONENT));
+ dbgprintf("imuxsock version %s initializing\n", PACKAGE_VERSION);
+
/* initialize funixn[] array */
for(i = 1 ; i < MAXFUNIX ; ++i) {
funixn[i] = NULL;
@@ -337,18 +389,24 @@ CODEmodInit_QueryRegCFSLineHdlr
NULL, &bIgnoreTimestamp, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"systemlogsocketname", 0, eCmdHdlrGetWord,
NULL, &pLogSockName, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputunixlistensockethostname", 0, eCmdHdlrGetWord,
+ NULL, &pLogHostName, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputunixlistensocketflowcontrol", 0, eCmdHdlrBinary,
+ NULL, &bUseFlowCtl, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"addunixlistensocket", 0, eCmdHdlrGetWord,
addLstnSocketName, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
/* the following one is a (dirty) trick: the system log socket is not added via
- * an "addUnixListenSocket" config format. As such, the timestamp can not be modified
- * via $InputUnixListenSocketIgnoreMsgTimestamp". So we need to add a special directive
+ * an "addUnixListenSocket" config format. As such, it's properties can not be modified
+ * via $InputUnixListenSocket*". So we need to add a special directive
* for that. We should revisit all of that once we have the new config format...
* rgerhards, 2008-03-06
*/
CHKiRet(omsdRegCFSLineHdlr((uchar *)"systemlogsocketignoremsgtimestamp", 0, eCmdHdlrBinary,
setSystemLogTimestampIgnore, NULL, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"systemlogsocketflowcontrol", 0, eCmdHdlrBinary,
+ setSystemLogFlowControl, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
/* vim:set ai:
*/
diff --git a/plugins/omgssapi/Makefile.am b/plugins/omgssapi/Makefile.am
index c2cbe38..a57a64b 100644
--- a/plugins/omgssapi/Makefile.am
+++ b/plugins/omgssapi/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omgssapi.la
omgssapi_la_SOURCES = omgssapi.c
-omgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+omgssapi_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omgssapi_la_LDFLAGS = -module -avoid-version
-omgssapi_la_LIBADD = $(gss_libs)
+omgssapi_la_LIBADD = $(GSS_LIBS)
diff --git a/plugins/omgssapi/Makefile.in b/plugins/omgssapi/Makefile.in
index 2aab6d9..51de396 100644
--- a/plugins/omgssapi/Makefile.in
+++ b/plugins/omgssapi/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/omgssapi
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,44 +190,31 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = omgssapi.la
omgssapi_la_SOURCES = omgssapi.c
-omgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+omgssapi_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omgssapi_la_LDFLAGS = -module -avoid-version
-omgssapi_la_LIBADD = $(gss_libs)
+omgssapi_la_LIBADD = $(GSS_LIBS)
all: all-am
.SUFFIXES:
diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c
index 82fca2d..e0cc8af 100644
--- a/plugins/omgssapi/omgssapi.c
+++ b/plugins/omgssapi/omgssapi.c
@@ -378,6 +378,7 @@ ENDtryResume
BEGINdoAction
char *psz; /* temporary buffering */
register unsigned l;
+ int iMaxLine;
CODESTARTdoAction
switch (pData->eDestState) {
case eDestFORW_SUSP:
@@ -392,10 +393,11 @@ CODESTARTdoAction
case eDestFORW:
dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData), "tcp-gssapi");
+ iMaxLine = glbl.GetMaxLine();
psz = (char*) ppString[0];
l = strlen((char*) psz);
- if (l > MAXLINE)
- l = MAXLINE;
+ if((int) l > iMaxLine)
+ l = iMaxLine;
# ifdef USE_NETZIP
/* Check if we should compress and, if so, do it. We also
@@ -407,10 +409,14 @@ CODESTARTdoAction
* rgerhards, 2006-11-30
*/
if(pData->compressionLevel && (l > MIN_SIZE_FOR_COMPRESS)) {
- Bytef out[MAXLINE+MAXLINE/100+12] = "z";
+ Bytef *out;
uLongf destLen = sizeof(out) / sizeof(Bytef);
uLong srcLen = l;
int ret;
+ /* TODO: optimize malloc sequence? -- rgerhards, 2008-09-02 */
+ CHKmalloc(out = (Bytef*) malloc(iMaxLine + iMaxLine/100 + 12));
+ out[0] = 'z';
+ out[1] = '\0';
ret = compress2((Bytef*) out+1, &destLen, (Bytef*) psz,
srcLen, pData->compressionLevel);
dbgprintf("Compressing message, length was %d now %d, return state %d.\n",
@@ -442,6 +448,7 @@ CODESTARTdoAction
}
break;
}
+finalize_it:
ENDdoAction
diff --git a/plugins/omlibdbi/Makefile.am b/plugins/omlibdbi/Makefile.am
index d224f9e..6a26f80 100644
--- a/plugins/omlibdbi/Makefile.am
+++ b/plugins/omlibdbi/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omlibdbi.la
omlibdbi_la_SOURCES = omlibdbi.c
-omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(libdbi_cflags) $(pthreads_cflags) $(rsrt_cflags)
+omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(LIBDBI_CFLAGS) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omlibdbi_la_LDFLAGS = -module -avoid-version
-omlibdbi_la_LIBADD = $(libdbi_libs)
+omlibdbi_la_LIBADD = $(LIBDBI_LIBS)
diff --git a/plugins/omlibdbi/Makefile.in b/plugins/omlibdbi/Makefile.in
index b159267..4f7ed4e 100644
--- a/plugins/omlibdbi/Makefile.in
+++ b/plugins/omlibdbi/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/omlibdbi
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,44 +190,31 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = omlibdbi.la
omlibdbi_la_SOURCES = omlibdbi.c
-omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(libdbi_cflags) $(pthreads_cflags) $(rsrt_cflags)
+omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(LIBDBI_CFLAGS) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omlibdbi_la_LDFLAGS = -module -avoid-version
-omlibdbi_la_LIBADD = $(libdbi_libs)
+omlibdbi_la_LIBADD = $(LIBDBI_LIBS)
all: all-am
.SUFFIXES:
diff --git a/plugins/ommail/Makefile.am b/plugins/ommail/Makefile.am
index fa470a4..97c9296 100644
--- a/plugins/ommail/Makefile.am
+++ b/plugins/ommail/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = ommail.la
ommail_la_SOURCES = ommail.c
-ommail_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+ommail_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
ommail_la_LDFLAGS = -module -avoid-version
ommail_la_LIBADD =
diff --git a/plugins/ommail/Makefile.in b/plugins/ommail/Makefile.in
index e13d116..e773b3a 100644
--- a/plugins/ommail/Makefile.in
+++ b/plugins/ommail/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/ommail
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = ommail.la
ommail_la_SOURCES = ommail.c
-ommail_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+ommail_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
ommail_la_LDFLAGS = -module -avoid-version
ommail_la_LIBADD =
all: all-am
diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c
index 4bbb844..5faadce 100644
--- a/plugins/ommail/ommail.c
+++ b/plugins/ommail/ommail.c
@@ -60,10 +60,18 @@ DEF_OMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
DEFobjCurrIf(glbl)
+/* we add a little support for multiple recipients. We do this via a
+ * singly-linked list, enqueued from the top. -- rgerhards, 2008-08-04
+ */
+typedef struct toRcpt_s toRcpt_t;
+struct toRcpt_s {
+ uchar *pszTo;
+ toRcpt_t *pNext;
+};
+static toRcpt_t *lstRcpt = NULL;
static uchar *pszSrv = NULL;
static uchar *pszSrvPort = NULL;
static uchar *pszFrom = NULL;
-static uchar *pszTo = NULL;
static uchar *pszSubject = NULL;
static int bEnableBody = 1; /* should a mail body be generated? (set to 0 eg for SMS gateways) */
@@ -76,7 +84,7 @@ typedef struct _instanceData {
uchar *pszSrv;
uchar *pszSrvPort;
uchar *pszFrom;
- uchar *pszTo;
+ toRcpt_t *lstRcpt;
char RcvBuf[1024]; /* buffer for receiving server responses */
size_t lenRcvBuf;
size_t iRcvBuf; /* current index into the rcvBuf (buf empty if iRcvBuf == lenRcvBuf) */
@@ -85,6 +93,83 @@ typedef struct _instanceData {
} md; /* mode-specific data */
} instanceData;
+/* forward definitions (as few as possible) */
+static rsRetVal Send(int sock, char *msg, size_t len);
+static rsRetVal readResponse(instanceData *pData, int *piState, int iExpected);
+
+
+/* helpers for handling the recipient lists */
+
+/* destroy a complete recipient list */
+static void lstRcptDestruct(toRcpt_t *pRoot)
+{
+ toRcpt_t *pDel;
+
+ while(pRoot != NULL) {
+ pDel = pRoot;
+ pRoot = pRoot->pNext;
+ /* ready to disalloc */
+ free(pDel->pszTo);
+ free(pDel);
+ }
+}
+
+/* This function is called when a new recipient email address is to be
+ * added. rgerhards, 2008-08-04
+ */
+static rsRetVal
+addRcpt(void __attribute__((unused)) *pVal, uchar *pNewVal)
+{
+ DEFiRet;
+ toRcpt_t *pNew = NULL;
+
+ CHKmalloc(pNew = calloc(1, sizeof(toRcpt_t)));
+
+ pNew->pszTo = pNewVal;
+ pNew->pNext = lstRcpt;
+ lstRcpt = pNew;
+
+ dbgprintf("ommail::addRcpt adds recipient %s\n", pNewVal);
+
+finalize_it:
+ if(iRet != RS_RET_OK) {
+ if(pNew != NULL)
+ free(pNew);
+ free(pNewVal); /* in any case, this is no longer needed */
+ }
+
+ RETiRet;
+}
+
+
+/* output the recipient list to the mail server
+ * iStatusToCheck < 0 means no checking should happen
+ */
+static rsRetVal
+WriteRcpts(instanceData *pData, uchar *pszOp, size_t lenOp, int iStatusToCheck)
+{
+ toRcpt_t *pRcpt;
+ int iState;
+ DEFiRet;
+
+ assert(pData != NULL);
+ assert(pszOp != NULL);
+ assert(lenOp != 0);
+
+ for(pRcpt = pData->md.smtp.lstRcpt ; pRcpt != NULL ; pRcpt = pRcpt->pNext) {
+ dbgprintf("Sending '%s: <%s>'\n", pszOp, pRcpt->pszTo);
+ CHKiRet(Send(pData->md.smtp.sock, (char*)pszOp, lenOp));
+ CHKiRet(Send(pData->md.smtp.sock, ": <", sizeof(": <") - 1));
+ CHKiRet(Send(pData->md.smtp.sock, (char*)pRcpt->pszTo, strlen((char*)pRcpt->pszTo)));
+ CHKiRet(Send(pData->md.smtp.sock, ">\r\n", sizeof(">\r\n") - 1));
+ if(iStatusToCheck >= 0)
+ CHKiRet(readResponse(pData, &iState, iStatusToCheck));
+ }
+
+finalize_it:
+ RETiRet;
+}
+/* end helpers for handling the recipient lists */
BEGINcreateInstance
CODESTARTcreateInstance
@@ -107,8 +192,7 @@ CODESTARTfreeInstance
free(pData->md.smtp.pszSrvPort);
if(pData->md.smtp.pszFrom != NULL)
free(pData->md.smtp.pszFrom);
- if(pData->md.smtp.pszTo != NULL)
- free(pData->md.smtp.pszTo);
+ lstRcptDestruct(pData->md.smtp.lstRcpt);
}
ENDfreeInstance
@@ -426,10 +510,7 @@ sendSMTP(instanceData *pData, uchar *body, uchar *subject)
CHKiRet(Send(pData->md.smtp.sock, ">\r\n", sizeof(">\r\n") - 1));
CHKiRet(readResponse(pData, &iState, 250));
- CHKiRet(Send(pData->md.smtp.sock, "RCPT TO: <", sizeof("RCPT TO: <") - 1));
- CHKiRet(Send(pData->md.smtp.sock, (char*)pData->md.smtp.pszTo, strlen((char*)pData->md.smtp.pszTo)));
- CHKiRet(Send(pData->md.smtp.sock, ">\r\n", sizeof(">\r\n") - 1));
- CHKiRet(readResponse(pData, &iState, 250));
+ CHKiRet(WriteRcpts(pData, (uchar*)"RCPT TO", sizeof("RCPT TO") - 1, 250));
CHKiRet(Send(pData->md.smtp.sock, "DATA\r\n", sizeof("DATA\r\n") - 1));
CHKiRet(readResponse(pData, &iState, 354));
@@ -443,9 +524,7 @@ sendSMTP(instanceData *pData, uchar *body, uchar *subject)
CHKiRet(Send(pData->md.smtp.sock, (char*)pData->md.smtp.pszFrom, strlen((char*)pData->md.smtp.pszFrom)));
CHKiRet(Send(pData->md.smtp.sock, ">\r\n", sizeof(">\r\n") - 1));
- CHKiRet(Send(pData->md.smtp.sock, "To: <", sizeof("To: <") - 1));
- CHKiRet(Send(pData->md.smtp.sock, (char*)pData->md.smtp.pszTo, strlen((char*)pData->md.smtp.pszTo)));
- CHKiRet(Send(pData->md.smtp.sock, ">\r\n", sizeof(">\r\n") - 1));
+ CHKiRet(WriteRcpts(pData, (uchar*)"To", sizeof("To") - 1, -1));
CHKiRet(Send(pData->md.smtp.sock, "Subject: ", sizeof("Subject: ") - 1));
CHKiRet(Send(pData->md.smtp.sock, (char*)subject, strlen((char*)subject)));
@@ -531,13 +610,14 @@ CODESTARTparseSelectorAct
errmsg.LogError(0, RS_RET_MAIL_NO_FROM, "no sender address given - specify $ActionMailFrom");
ABORT_FINALIZE(RS_RET_MAIL_NO_FROM);
}
- if(pszTo == NULL) {
+ if(lstRcpt == NULL) {
errmsg.LogError(0, RS_RET_MAIL_NO_TO, "no recipient address given - specify $ActionMailTo");
ABORT_FINALIZE(RS_RET_MAIL_NO_TO);
}
pData->md.smtp.pszFrom = (uchar*) strdup((char*)pszFrom);
- pData->md.smtp.pszTo = (uchar*) strdup((char*)pszTo);
+ pData->md.smtp.lstRcpt = lstRcpt; /* we "hand over" this memory */
+ lstRcpt = NULL; /* note: this is different from pre-3.21.2 versions! */
if(pszSubject == NULL) {
/* if no subject is configured, we need just one template string */
@@ -576,10 +656,8 @@ static rsRetVal freeConfigVariables(void)
free(pszFrom);
pszFrom = NULL;
}
- if(pszTo != NULL) {
- free(pszTo);
- pszTo = NULL;
- }
+ lstRcptDestruct(lstRcpt);
+ lstRcpt = NULL;
RETiRet;
}
@@ -621,10 +699,12 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(glbl, CORE_COMPONENT));
+ dbgprintf("ommail version %s initializing\n", VERSION);
+
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsmtpserver", 0, eCmdHdlrGetWord, NULL, &pszSrv, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsmtpport", 0, eCmdHdlrGetWord, NULL, &pszSrvPort, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailfrom", 0, eCmdHdlrGetWord, NULL, &pszFrom, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailto", 0, eCmdHdlrGetWord, NULL, &pszTo, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailto", 0, eCmdHdlrGetWord, addRcpt, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsubject", 0, eCmdHdlrGetWord, NULL, &pszSubject, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailenablebody", 0, eCmdHdlrBinary, NULL, &bEnableBody, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/ommysql/Makefile.am b/plugins/ommysql/Makefile.am
index d5433a4..e253b9d 100644
--- a/plugins/ommysql/Makefile.am
+++ b/plugins/ommysql/Makefile.am
@@ -1,8 +1,8 @@
pkglib_LTLIBRARIES = ommysql.la
ommysql_la_SOURCES = ommysql.c ommysql.h
-ommysql_la_CPPFLAGS = $(rsrt_cflags) $(mysql_cflags) $(pthreads_cflags)
+ommysql_la_CPPFLAGS = $(RSRT_CFLAGS) $(MYSQL_CFLAGS) $(PTHREADS_CFLAGS)
ommysql_la_LDFLAGS = -module -avoid-version
-ommysql_la_LIBADD = $(mysql_libs)
+ommysql_la_LIBADD = $(MYSQL_LIBS)
EXTRA_DIST = createDB.sql contrib/delete_mysql
diff --git a/plugins/ommysql/Makefile.in b/plugins/ommysql/Makefile.in
index 797d67c..f15d029 100644
--- a/plugins/ommysql/Makefile.in
+++ b/plugins/ommysql/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/ommysql
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,44 +190,31 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = ommysql.la
ommysql_la_SOURCES = ommysql.c ommysql.h
-ommysql_la_CPPFLAGS = $(rsrt_cflags) $(mysql_cflags) $(pthreads_cflags)
+ommysql_la_CPPFLAGS = $(RSRT_CFLAGS) $(MYSQL_CFLAGS) $(PTHREADS_CFLAGS)
ommysql_la_LDFLAGS = -module -avoid-version
-ommysql_la_LIBADD = $(mysql_libs)
+ommysql_la_LIBADD = $(MYSQL_LIBS)
EXTRA_DIST = createDB.sql contrib/delete_mysql
all: all-am
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index 22abb1d..ecf738a 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -35,8 +35,7 @@
#include <signal.h>
#include <errno.h>
#include <time.h>
-#include <mysql/mysql.h>
-#include <mysql/errmsg.h>
+#include <mysql.h>
#include "dirty.h"
#include "syslogd-types.h"
#include "srUtils.h"
diff --git a/plugins/ompgsql/Makefile.am b/plugins/ompgsql/Makefile.am
index cc1c5f4..607239c 100644
--- a/plugins/ompgsql/Makefile.am
+++ b/plugins/ompgsql/Makefile.am
@@ -1,8 +1,8 @@
pkglib_LTLIBRARIES = ompgsql.la
ompgsql_la_SOURCES = ompgsql.c ompgsql.h
-ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(pgsql_cflags) $(rsrt_cflags)
+ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(PGSQL_CFLAGS) $(RSRT_CFLAGS)
ompgsql_la_LDFLAGS = -module -avoid-version
-ompgsql_la_LIBADD = $(pgsql_libs)
+ompgsql_la_LIBADD = $(PGSQL_LIBS)
EXTRA_DIST = createDB.sql
diff --git a/plugins/ompgsql/Makefile.in b/plugins/ompgsql/Makefile.in
index 65e8b1b..5f318f2 100644
--- a/plugins/ompgsql/Makefile.in
+++ b/plugins/ompgsql/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/ompgsql
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,44 +190,31 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = ompgsql.la
ompgsql_la_SOURCES = ompgsql.c ompgsql.h
-ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(pgsql_cflags) $(rsrt_cflags)
+ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(PGSQL_CFLAGS) $(RSRT_CFLAGS)
ompgsql_la_LDFLAGS = -module -avoid-version
-ompgsql_la_LIBADD = $(pgsql_libs)
+ompgsql_la_LIBADD = $(PGSQL_LIBS)
EXTRA_DIST = createDB.sql
all: all-am
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 7658f03..6daac1c 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -6,7 +6,11 @@
*
* File begun on 2007-10-18 by sur5r (converted from ommysql.c)
*
- * Copyright 2007 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2007, 2009 Rainer Gerhards and Adiscon GmbH.
+ *
+ * The following link my be useful for the not-so-postgres literate
+ * when setting up a test environment (on Fedora):
+ * http://www.jboss.org/community/wiki/InstallPostgreSQLonFedora
*
* This file is part of rsyslog.
*
@@ -154,26 +158,55 @@ static rsRetVal initPgSQL(instanceData *pData, int bSilent)
}
+/* try the insert into postgres and return if that failed or not
+ * (1 = had error, 0=ok). We do not use the standard IRET calling convention
+ * rgerhards, 2009-04-17
+ */
+static inline int
+tryExec(uchar *pszCmd, instanceData *pData)
+{
+ PGresult *pgRet;
+ ExecStatusType execState;
+ int bHadError = 0;
+
+ /* try insert */
+ pgRet = PQexec(pData->f_hpgsql, (char*)pszCmd);
+ execState = PQresultStatus(pgRet);
+ if(execState != PGRES_COMMAND_OK && execState != PGRES_TUPLES_OK) {
+ dbgprintf("postgres query execution failed: %s\n", PQresStatus(PQresultStatus(pgRet)));
+ bHadError = 1;
+ }
+ PQclear(pgRet);
+
+ return(bHadError);
+}
+
+
/* The following function writes the current log entry
* to an established PgSQL session.
+ * Enhanced function to take care of the returned error
+ * value (if there is such). Note that this may happen due to
+ * a sql format error - connection aborts were properly handled
+ * before my patch. -- rgerhards, 2009-04-17
*/
rsRetVal writePgSQL(uchar *psz, instanceData *pData)
{
+ int bHadError = 0;
DEFiRet;
assert(psz != NULL);
assert(pData != NULL);
- dbgprintf("writePgSQL: %s", psz);
+ dbgprintf("writePgSQL: %s\n", psz);
- /* try insert */
- PQclear(PQexec(pData->f_hpgsql, (char*)psz));
- if(PQstatus(pData->f_hpgsql) != CONNECTION_OK) {
+ bHadError = tryExec(psz, pData); /* try insert */
+
+ if(bHadError || (PQstatus(pData->f_hpgsql) != CONNECTION_OK)) {
/* error occured, try to re-init connection and retry */
closePgSQL(pData); /* close the current handle */
CHKiRet(initPgSQL(pData, 0)); /* try to re-open */
- PQclear(PQexec(pData->f_hpgsql, (char*)psz));
- if(PQstatus(pData->f_hpgsql) != CONNECTION_OK) { /* re-try insert */
+ bHadError = tryExec(psz, pData); /* retry */
+ if(bHadError || (PQstatus(pData->f_hpgsql) != CONNECTION_OK)) {
/* we failed, giving up for now */
reportDBError(pData, 0);
closePgSQL(pData); /* free ressources */
@@ -290,6 +323,5 @@ CODESTARTmodInit
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
ENDmodInit
-/*
- * vi:set ai:
+/* vi:set ai:
*/
diff --git a/plugins/omrelp/Makefile.am b/plugins/omrelp/Makefile.am
index f8384f4..906aab4 100644
--- a/plugins/omrelp/Makefile.am
+++ b/plugins/omrelp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omrelp.la
omrelp_la_SOURCES = omrelp.c
-omrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS) $(rsrt_cflags)
+omrelp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RELP_CFLAGS) $(RSRT_CFLAGS)
omrelp_la_LDFLAGS = -module -avoid-version
omrelp_la_LIBADD = $(RELP_LIBS)
diff --git a/plugins/omrelp/Makefile.in b/plugins/omrelp/Makefile.in
index e13fab7..fd76107 100644
--- a/plugins/omrelp/Makefile.in
+++ b/plugins/omrelp/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/omrelp
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,42 +190,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = omrelp.la
omrelp_la_SOURCES = omrelp.c
-omrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS) $(rsrt_cflags)
+omrelp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RELP_CFLAGS) $(RSRT_CFLAGS)
omrelp_la_LDFLAGS = -module -avoid-version
omrelp_la_LIBADD = $(RELP_LIBS)
all: all-am
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index 71d6e79..8d74c82 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -159,8 +159,8 @@ CODESTARTdoAction
lenMsg = strlen((char*) pMsg); /* TODO: don't we get this? */
/* TODO: think about handling oversize messages! */
- if(lenMsg > MAXLINE)
- lenMsg = MAXLINE;
+ if((int) lenMsg > glbl.GetMaxLine())
+ lenMsg = glbl.GetMaxLine();
/* forward */
ret = relpCltSendSyslog(pData->pRelpClt, (uchar*) pMsg, lenMsg);
diff --git a/plugins/omsnmp/Makefile.am b/plugins/omsnmp/Makefile.am
index d784fac..f75fb09 100644
--- a/plugins/omsnmp/Makefile.am
+++ b/plugins/omsnmp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omsnmp.la
omsnmp_la_SOURCES = omsnmp.c omsnmp.h
-omsnmp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+omsnmp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omsnmp_la_LDFLAGS = -module -avoid-version
-omsnmp_la_LIBADD = $(snmp_libs)
+omsnmp_la_LIBADD = $(SNMP_LIBS)
diff --git a/plugins/omsnmp/Makefile.in b/plugins/omsnmp/Makefile.in
index 461ba32..0507049 100644
--- a/plugins/omsnmp/Makefile.in
+++ b/plugins/omsnmp/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/omsnmp
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -93,6 +94,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -102,8 +104,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -112,6 +116,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -121,6 +127,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -130,15 +138,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -160,13 +178,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -176,44 +190,31 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = omsnmp.la
omsnmp_la_SOURCES = omsnmp.c omsnmp.h
-omsnmp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+omsnmp_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omsnmp_la_LDFLAGS = -module -avoid-version
-omsnmp_la_LIBADD = $(snmp_libs)
+omsnmp_la_LIBADD = $(SNMP_LIBS)
all: all-am
.SUFFIXES:
diff --git a/plugins/omtesting/Makefile.am b/plugins/omtesting/Makefile.am
index 8e98ca6..4700e1e 100644
--- a/plugins/omtesting/Makefile.am
+++ b/plugins/omtesting/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omtesting.la
omtesting_la_SOURCES = omtesting.c
-omtesting_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+omtesting_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omtesting_la_LDFLAGS = -module -avoid-version
omtesting_la_LIBADD =
diff --git a/plugins/omtesting/Makefile.in b/plugins/omtesting/Makefile.in
index 37516e7..157434e 100644
--- a/plugins/omtesting/Makefile.in
+++ b/plugins/omtesting/Makefile.in
@@ -35,7 +35,8 @@ host_triplet = @host@
subdir = plugins/omtesting
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -92,6 +93,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -101,8 +103,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -111,6 +115,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -120,6 +126,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -129,15 +137,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -159,13 +177,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -175,42 +189,29 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = omtesting.la
omtesting_la_SOURCES = omtesting.c
-omtesting_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
+omtesting_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
omtesting_la_LDFLAGS = -module -avoid-version
omtesting_la_LIBADD =
all: all-am
diff --git a/rsyslog.conf b/rsyslog.conf
index ce7d131..47fc440 100644
--- a/rsyslog.conf
+++ b/rsyslog.conf
@@ -5,9 +5,9 @@
# If you do not load inputs, nothing happens!
# You may need to set the module load path if modules are not found.
-$ModLoad immark.so # provides --MARK-- message capability
-$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command)
-$ModLoad imklog.so # kernel logging (formerly provided by rklogd)
+$ModLoad immark # provides --MARK-- message capability
+$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
+$ModLoad imklog # kernel logging (formerly provided by rklogd)
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
diff --git a/runtime/Makefile.am b/runtime/Makefile.am
index 81a9d5b..2e6c404 100644
--- a/runtime/Makefile.am
+++ b/runtime/Makefile.am
@@ -83,9 +83,13 @@ librsyslog_la_SOURCES = \
# the files with ../ we need to work on - so that they either become part of the
# runtime or will no longer be needed. -- rgerhards, 2008-06-13
-librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(pthreads_cflags)
+if WITH_MODDIRS
+librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS)
+else
+librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS)
+endif
#librsyslog_la_LDFLAGS = -module -avoid-version
-librsyslog_la_LIBADD = $(dl_libs) $(rt_libs)
+librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS)
#
# regular expression support
@@ -93,7 +97,7 @@ librsyslog_la_LIBADD = $(dl_libs) $(rt_libs)
if ENABLE_REGEXP
pkglib_LTLIBRARIES += lmregexp.la
lmregexp_la_SOURCES = regexp.c regexp.h
-lmregexp_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmregexp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmregexp_la_LDFLAGS = -module -avoid-version
lmregexp_la_LIBADD =
endif
@@ -104,13 +108,13 @@ pkglib_LTLIBRARIES += lmnet.la lmnetstrms.la
# network support
#
lmnet_la_SOURCES = net.c net.h
-lmnet_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmnet_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmnet_la_LDFLAGS = -module -avoid-version
lmnet_la_LIBADD =
# network stream master class and stream factory
lmnetstrms_la_SOURCES = netstrms.c netstrms.h netstrm.c netstrm.h nssel.c nssel.h
-lmnetstrms_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmnetstrms_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmnetstrms_la_LDFLAGS = -module -avoid-version
lmnetstrms_la_LIBADD =
@@ -119,7 +123,7 @@ lmnetstrms_la_LIBADD =
# plain tcp driver - main driver
pkglib_LTLIBRARIES += lmnsd_ptcp.la
lmnsd_ptcp_la_SOURCES = nsd_ptcp.c nsd_ptcp.h nsdsel_ptcp.c nsdsel_ptcp.h
-lmnsd_ptcp_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+lmnsd_ptcp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
lmnsd_ptcp_la_LDFLAGS = -module -avoid-version
lmnsd_ptcp_la_LIBADD =
endif # if ENABLE_INET
@@ -130,8 +134,8 @@ endif # if ENABLE_INET
if ENABLE_GNUTLS
pkglib_LTLIBRARIES += lmnsd_gtls.la
lmnsd_gtls_la_SOURCES = nsd_gtls.c nsd_gtls.h nsdsel_gtls.c nsdsel_gtls.h
-lmnsd_gtls_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) $(gnutls_cflags)
+lmnsd_gtls_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) $(GNUTLS_CFLAGS)
lmnsd_gtls_la_LDFLAGS = -module -avoid-version
-lmnsd_gtls_la_LIBADD = $(gnutls_libs)
+lmnsd_gtls_la_LIBADD = $(GNUTLS_LIBS)
endif
diff --git a/runtime/Makefile.in b/runtime/Makefile.in
index b7a22f9..631cf83 100644
--- a/runtime/Makefile.in
+++ b/runtime/Makefile.in
@@ -52,7 +52,8 @@ sbin_PROGRAMS =
subdir = runtime
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -183,6 +184,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -192,8 +194,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -202,6 +206,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -211,6 +217,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -220,15 +228,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -250,13 +268,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -266,39 +280,26 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
man_MANS =
noinst_LTLIBRARIES = librsyslog.la
pkglib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3)
@@ -380,36 +381,37 @@ librsyslog_la_SOURCES = \
../template.c \
../template.h
+@WITH_MODDIRS_FALSE@librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(PTHREADS_CFLAGS)
# the files with ../ we need to work on - so that they either become part of the
# runtime or will no longer be needed. -- rgerhards, 2008-06-13
-librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" -I$(top_srcdir) $(pthreads_cflags)
+@WITH_MODDIRS_TRUE@librsyslog_la_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" $(PTHREADS_CFLAGS)
#librsyslog_la_LDFLAGS = -module -avoid-version
-librsyslog_la_LIBADD = $(dl_libs) $(rt_libs)
+librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS)
@ENABLE_REGEXP_TRUE@lmregexp_la_SOURCES = regexp.c regexp.h
-@ENABLE_REGEXP_TRUE@lmregexp_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_REGEXP_TRUE@lmregexp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_REGEXP_TRUE@lmregexp_la_LDFLAGS = -module -avoid-version
@ENABLE_REGEXP_TRUE@lmregexp_la_LIBADD =
#
# network support
#
@ENABLE_INET_TRUE@lmnet_la_SOURCES = net.c net.h
-@ENABLE_INET_TRUE@lmnet_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_INET_TRUE@lmnet_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_INET_TRUE@lmnet_la_LDFLAGS = -module -avoid-version
@ENABLE_INET_TRUE@lmnet_la_LIBADD =
# network stream master class and stream factory
@ENABLE_INET_TRUE@lmnetstrms_la_SOURCES = netstrms.c netstrms.h netstrm.c netstrm.h nssel.c nssel.h
-@ENABLE_INET_TRUE@lmnetstrms_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_INET_TRUE@lmnetstrms_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_INET_TRUE@lmnetstrms_la_LDFLAGS = -module -avoid-version
@ENABLE_INET_TRUE@lmnetstrms_la_LIBADD =
@ENABLE_INET_TRUE@lmnsd_ptcp_la_SOURCES = nsd_ptcp.c nsd_ptcp.h nsdsel_ptcp.c nsdsel_ptcp.h
-@ENABLE_INET_TRUE@lmnsd_ptcp_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
+@ENABLE_INET_TRUE@lmnsd_ptcp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
@ENABLE_INET_TRUE@lmnsd_ptcp_la_LDFLAGS = -module -avoid-version
@ENABLE_INET_TRUE@lmnsd_ptcp_la_LIBADD =
@ENABLE_GNUTLS_TRUE@lmnsd_gtls_la_SOURCES = nsd_gtls.c nsd_gtls.h nsdsel_gtls.c nsdsel_gtls.h
-@ENABLE_GNUTLS_TRUE@lmnsd_gtls_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) $(gnutls_cflags)
+@ENABLE_GNUTLS_TRUE@lmnsd_gtls_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) $(GNUTLS_CFLAGS)
@ENABLE_GNUTLS_TRUE@lmnsd_gtls_la_LDFLAGS = -module -avoid-version
-@ENABLE_GNUTLS_TRUE@lmnsd_gtls_la_LIBADD = $(gnutls_libs)
+@ENABLE_GNUTLS_TRUE@lmnsd_gtls_la_LIBADD = $(GNUTLS_LIBS)
all: all-am
.SUFFIXES:
diff --git a/runtime/atomic.h b/runtime/atomic.h
index 430ae7f..10dbac9 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -1,6 +1,6 @@
/* This header supplies atomic operations. So far, we rely on GCC's
- * atomic builtins. I have no idea if we can check them via autotools,
- * but I am making the necessary provisioning to live without them if
+ * atomic builtins. During configure, we check if atomic operatons are
+ * available. If they are not, I am making the necessary provisioning to live without them if
* they are not available. Please note that you should only use the macros
* here if you think you can actually live WITHOUT an explicit atomic operation,
* because in the non-presence of them, we simply do it without atomicitiy.
@@ -36,16 +36,28 @@
#ifndef INCLUDED_ATOMIC_H
#define INCLUDED_ATOMIC_H
-/* set the following to 1 if we have atomic operations (and #undef it otherwise) */
-/* #define DO_HAVE_ATOMICS 1 */
/* for this release, we disable atomic calls because there seem to be some
* portability problems and we can not fix that without destabilizing the build.
* They simply came in too late. -- rgerhards, 2008-04-02
*/
-/* make sure they are not used!
-#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
-#define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
-*/
-#define ATOMIC_INC(data) (++(data))
+#ifdef HAVE_ATOMIC_BUILTINS
+# define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&(data), 1))
+# define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&(data), 1)
+# define ATOMIC_FETCH_32BIT(data) ((unsigned) __sync_fetch_and_and(&(data), 0xffffffff))
+# define ATOMIC_STORE_1_TO_32BIT(data) __sync_lock_test_and_set(&(data), 1)
+#else
+ /* note that we gained parctical proof that theoretical problems DO occur
+ * if we do not properly address them. See this blog post for details:
+ * http://blog.gerhards.net/2009/01/rsyslog-data-race-analysis.html
+ * The bottom line is that if there are no atomics available, we should NOT
+ * simply go ahead and do without them - use mutexes or other things. The
+ * code needs to be checked against all those cases. -- rgerhards, 2009-01-30
+ */
+# warning "atomic builtins not available, using nul operations - rsyslogd will probably be racy!"
+# define ATOMIC_INC(data) (++(data))
+# define ATOMIC_DEC_AND_FETCH(data) (--(data))
+# define ATOMIC_FETCH_32BIT(data) (data)
+# define ATOMIC_STORE_1_TO_32BIT(data) (data) = 1
+#endif
#endif /* #ifndef INCLUDED_ATOMIC_H */
diff --git a/runtime/conf.c b/runtime/conf.c
index 75276a0..f71d566 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -83,6 +83,8 @@ DEFobjCurrIf(module)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(net)
+static int iNbrActions; /* number of actions the running config has. Needs to be init on ReInitConf() */
+
/* The following global variables are used for building
* tag and host selector lines during startup and config reload.
* This is stored as a global variable pool because of its ease. It is
@@ -188,6 +190,7 @@ doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal)
char pattern[MAXFNAME];
uchar *cfgFile;
glob_t cfgFiles;
+ int result;
size_t i = 0;
struct stat fileInfo;
@@ -195,14 +198,21 @@ doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal)
ASSERT(*pp != NULL);
if(getSubString(pp, (char*) pattern, sizeof(pattern) / sizeof(char), ' ') != 0) {
- errmsg.LogError(0, RS_RET_NOT_FOUND, "could not extract group name");
+ errmsg.LogError(0, RS_RET_NOT_FOUND, "could not parse config file name");
ABORT_FINALIZE(RS_RET_NOT_FOUND);
}
/* Use GLOB_MARK to append a trailing slash for directories.
* Required by doIncludeDirectory().
*/
- glob(pattern, GLOB_MARK, NULL, &cfgFiles);
+ result = glob(pattern, GLOB_MARK, NULL, &cfgFiles);
+ if(result != 0) {
+ char errStr[1024];
+ rs_strerror_r(errno, errStr, sizeof(errStr));
+ errmsg.LogError(0, RS_RET_FILE_NOT_FOUND, "error accessing config file or directory '%s': %s",
+ pattern, errStr);
+ ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND);
+ }
for(i = 0; i < cfgFiles.gl_pathc; i++) {
cfgFile = (uchar*) cfgFiles.gl_pathv[i];
@@ -560,8 +570,7 @@ cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int
}
-/*
- * Helper to cfline(). This function takes the filter part of a traditional, PRI
+/* Helper to cfline(). This function takes the filter part of a traditional, PRI
* based line and decodes the PRIs given in the selector line. It processed the
* line up to the beginning of the action part. A pointer to that beginnig is
* passed back to the caller.
@@ -577,8 +586,9 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
int pri;
int singlpri = 0;
int ignorepri = 0;
- uchar buf[MAXLINE];
+ uchar buf[2048]; /* buffer for facility and priority names */
uchar xbuf[200];
+ DEFiRet;
ASSERT(pline != NULL);
ASSERT(*pline != NULL);
@@ -603,7 +613,7 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
continue;
/* collect priority name */
- for (bp = buf; *q && !strchr("\t ,;", *q); )
+ for (bp = buf; *q && !strchr("\t ,;", *q) && bp < buf+sizeof(buf)-1 ; )
*bp++ = *q++;
*bp = '\0';
@@ -614,6 +624,7 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
/* decode priority name */
if ( *buf == '!' ) {
ignorepri = 1;
+ /* copy below is ok, we can NOT go off the allocated area */
for (bp=buf; *(bp+1); bp++)
*bp=*(bp+1);
*bp='\0';
@@ -639,7 +650,7 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
/* scan facilities */
while (*p && !strchr("\t .;", *p)) {
- for (bp = buf; *p && !strchr("\t ,;.", *p); )
+ for (bp = buf; *p && !strchr("\t ,;.", *p) && bp < buf+sizeof(buf)-1 ; )
*bp++ = *p++;
*bp = '\0';
if (*buf == '*') {
@@ -722,7 +733,7 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
p++;
*pline = p;
- return RS_RET_OK;
+ RETiRet;
}
@@ -1060,6 +1071,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
pAction->f_ReduceRepeated = 0;
}
pAction->bEnabled = 1; /* action is enabled */
+ iNbrActions++; /* one more active action! */
}
break;
}
@@ -1159,6 +1171,34 @@ cfline(uchar *line, selector_t **pfCurr)
}
+/* Reinitialize the configuration subsystem. This is a "work-around" to the fact
+ * that we do not yet have actual config objects. This method is to be called
+ * whenever a totally new config is started (which means on startup and HUP).
+ * Note that it MUST NOT be called for an included config file.
+ * rgerhards, 2008-07-28
+ */
+static rsRetVal
+ReInitConf(void)
+{
+ DEFiRet;
+ iNbrActions = 0; /* this is what we created the function for ;) - action count is reset */
+ RETiRet;
+}
+
+
+/* return the current number of active actions
+ * rgerhards, 2008-07-28
+ */
+static rsRetVal
+GetNbrActActions(int *piNbrActions)
+{
+ DEFiRet;
+ assert(piNbrActions != NULL);
+ *piNbrActions = iNbrActions;
+ RETiRet;
+}
+
+
/* queryInterface function
* rgerhards, 2008-02-29
*/
@@ -1179,6 +1219,8 @@ CODESTARTobjQueryInterface(conf)
pIf->doIncludeLine = doIncludeLine;
pIf->cfline = cfline;
pIf->processConfFile = processConfFile;
+ pIf->ReInitConf = ReInitConf;
+ pIf->GetNbrActActions = GetNbrActActions;
finalize_it:
ENDobjQueryInterface(conf)
diff --git a/runtime/conf.h b/runtime/conf.h
index 31ca27b..2494d4d 100644
--- a/runtime/conf.h
+++ b/runtime/conf.h
@@ -37,8 +37,10 @@ BEGINinterface(conf) /* name must also be changed in ENDinterface macro! */
rsRetVal (*doIncludeLine)(uchar **pp, __attribute__((unused)) void* pVal);
rsRetVal (*cfline)(uchar *line, selector_t **pfCurr);
rsRetVal (*processConfFile)(uchar *pConfFile);
+ rsRetVal (*ReInitConf)(void);
+ rsRetVal (*GetNbrActActions)(int *);
ENDinterface(conf)
-#define confCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
+#define confCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */
/* prototypes */
diff --git a/runtime/datetime.c b/runtime/datetime.c
index aeb5fac..20ca619 100644
--- a/runtime/datetime.c
+++ b/runtime/datetime.c
@@ -159,18 +159,34 @@ static int srSLMGParseInt32(char** ppsz)
/**
* Parse a TIMESTAMP-3339.
- * updates the parse pointer position.
+ * updates the parse pointer position. The pTime parameter
+ * is guranteed to be updated only if a new valid timestamp
+ * could be obtained (restriction added 2008-09-16 by rgerhards).
*/
-static int
+static rsRetVal
ParseTIMESTAMP3339(struct syslogTime *pTime, char** ppszTS)
{
char *pszTS = *ppszTS;
+ /* variables to temporarily hold time information while we parse */
+ int year;
+ int month;
+ int day;
+ int hour; /* 24 hour clock */
+ int minute;
+ int second;
+ int secfrac; /* fractional seconds (must be 32 bit!) */
+ int secfracPrecision;
+ char OffsetMode; /* UTC offset + or - */
+ char OffsetHour; /* UTC offset in hours */
+ int OffsetMinute; /* UTC offset in minutes */
+ /* end variables to temporarily hold time information while we parse */
+ DEFiRet;
assert(pTime != NULL);
assert(ppszTS != NULL);
assert(pszTS != NULL);
- pTime->year = srSLMGParseInt32(&pszTS);
+ year = srSLMGParseInt32(&pszTS);
/* We take the liberty to accept slightly malformed timestamps e.g. in
* the format of 2003-9-1T1:0:0. This doesn't hurt on receiving. Of course,
@@ -178,105 +194,128 @@ ParseTIMESTAMP3339(struct syslogTime *pTime, char** ppszTS)
* here because at postion 11, there is no "T" in such cases ;)
*/
if(*pszTS++ != '-')
- return FALSE;
- pTime->month = srSLMGParseInt32(&pszTS);
- if(pTime->month < 1 || pTime->month > 12)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ month = srSLMGParseInt32(&pszTS);
+ if(month < 1 || month > 12)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != '-')
- return FALSE;
- pTime->day = srSLMGParseInt32(&pszTS);
- if(pTime->day < 1 || pTime->day > 31)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ day = srSLMGParseInt32(&pszTS);
+ if(day < 1 || day > 31)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != 'T')
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
- pTime->hour = srSLMGParseInt32(&pszTS);
- if(pTime->hour < 0 || pTime->hour > 23)
- return FALSE;
+ hour = srSLMGParseInt32(&pszTS);
+ if(hour < 0 || hour > 23)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != ':')
- return FALSE;
- pTime->minute = srSLMGParseInt32(&pszTS);
- if(pTime->minute < 0 || pTime->minute > 59)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ minute = srSLMGParseInt32(&pszTS);
+ if(minute < 0 || minute > 59)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != ':')
- return FALSE;
- pTime->second = srSLMGParseInt32(&pszTS);
- if(pTime->second < 0 || pTime->second > 60)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ second = srSLMGParseInt32(&pszTS);
+ if(second < 0 || second > 60)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
/* Now let's see if we have secfrac */
- if(*pszTS == '.')
- {
+ if(*pszTS == '.') {
char *pszStart = ++pszTS;
- pTime->secfrac = srSLMGParseInt32(&pszTS);
- pTime->secfracPrecision = (int) (pszTS - pszStart);
- }
- else
- {
- pTime->secfracPrecision = 0;
- pTime->secfrac = 0;
+ secfrac = srSLMGParseInt32(&pszTS);
+ secfracPrecision = (int) (pszTS - pszStart);
+ } else {
+ secfracPrecision = 0;
+ secfrac = 0;
}
/* check the timezone */
if(*pszTS == 'Z')
{
pszTS++; /* eat Z */
- pTime->OffsetMode = 'Z';
- pTime->OffsetHour = 0;
- pTime->OffsetMinute = 0;
- }
- else if((*pszTS == '+') || (*pszTS == '-'))
- {
- pTime->OffsetMode = *pszTS;
+ OffsetMode = 'Z';
+ OffsetHour = 0;
+ OffsetMinute = 0;
+ } else if((*pszTS == '+') || (*pszTS == '-')) {
+ OffsetMode = *pszTS;
pszTS++;
- pTime->OffsetHour = srSLMGParseInt32(&pszTS);
- if(pTime->OffsetHour < 0 || pTime->OffsetHour > 23)
- return FALSE;
+ OffsetHour = srSLMGParseInt32(&pszTS);
+ if(OffsetHour < 0 || OffsetHour > 23)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != ':')
- return FALSE;
- pTime->OffsetMinute = srSLMGParseInt32(&pszTS);
- if(pTime->OffsetMinute < 0 || pTime->OffsetMinute > 59)
- return FALSE;
- }
- else
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ OffsetMinute = srSLMGParseInt32(&pszTS);
+ if(OffsetMinute < 0 || OffsetMinute > 59)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ } else {
/* there MUST be TZ information */
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ }
/* OK, we actually have a 3339 timestamp, so let's indicated this */
if(*pszTS == ' ')
++pszTS;
else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
- /* update parse pointer */
+ /* we had success, so update parse pointer and caller-provided timestamp */
*ppszTS = pszTS;
+ pTime->timeType = 2;
+ pTime->year = year;
+ pTime->month = month;
+ pTime->day = day;
+ pTime->hour = hour;
+ pTime->minute = minute;
+ pTime->second = second;
+ pTime->secfrac = secfrac;
+ pTime->secfracPrecision = secfracPrecision;
+ pTime->OffsetMode = OffsetMode;
+ pTime->OffsetHour = OffsetHour;
+ pTime->OffsetMinute = OffsetMinute;
- return TRUE;
+finalize_it:
+ RETiRet;
}
/**
- * Parse a TIMESTAMP-3164.
- * Returns TRUE on parse OK, FALSE on parse error.
+ * Parse a TIMESTAMP-3164. The pTime parameter
+ * is guranteed to be updated only if a new valid timestamp
+ * could be obtained (restriction added 2008-09-16 by rgerhards). This
+ * also means the caller *must* provide a valid (probably current)
+ * timstamp in pTime when calling this function. a 3164 timestamp contains
+ * only partial information and only that partial information is updated.
+ * So the "output timestamp" is a valid timestamp only if the "input
+ * timestamp" was valid, too. The is actually an optimization, as it
+ * permits us to use a pre-aquired timestamp and thus avoids to do
+ * a (costly) time() call. Thanks to David Lang for insisting on
+ * time() call reduction ;).
*/
-static int
+static rsRetVal
ParseTIMESTAMP3164(struct syslogTime *pTime, char** ppszTS)
{
+ /* variables to temporarily hold time information while we parse */
+ int month;
+ int day;
+ int hour; /* 24 hour clock */
+ int minute;
+ int second;
+ /* end variables to temporarily hold time information while we parse */
char *pszTS;
+ DEFiRet;
assert(ppszTS != NULL);
pszTS = *ppszTS;
assert(pszTS != NULL);
assert(pTime != NULL);
- getCurrTime(pTime); /* obtain the current year and UTC offsets! */
-
/* If we look at the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec),
* we may see the following character sequences occur:
*
@@ -301,117 +340,117 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, char** ppszTS)
++pszTS;
if(*pszTS == 'n') {
++pszTS;
- pTime->month = 1;
+ month = 1;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else if(*pszTS == 'u') {
++pszTS;
if(*pszTS == 'n') {
++pszTS;
- pTime->month = 6;
+ month = 6;
} else if(*pszTS == 'l') {
++pszTS;
- pTime->month = 7;
+ month = 7;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'F':
if(*pszTS == 'e') {
++pszTS;
if(*pszTS == 'b') {
++pszTS;
- pTime->month = 2;
+ month = 2;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'M':
if(*pszTS == 'a') {
++pszTS;
if(*pszTS == 'r') {
++pszTS;
- pTime->month = 3;
+ month = 3;
} else if(*pszTS == 'y') {
++pszTS;
- pTime->month = 5;
+ month = 5;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'A':
if(*pszTS == 'p') {
++pszTS;
if(*pszTS == 'r') {
++pszTS;
- pTime->month = 4;
+ month = 4;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else if(*pszTS == 'u') {
++pszTS;
if(*pszTS == 'g') {
++pszTS;
- pTime->month = 8;
+ month = 8;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'S':
if(*pszTS == 'e') {
++pszTS;
if(*pszTS == 'p') {
++pszTS;
- pTime->month = 9;
+ month = 9;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'O':
if(*pszTS == 'c') {
++pszTS;
if(*pszTS == 't') {
++pszTS;
- pTime->month = 10;
+ month = 10;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'N':
if(*pszTS == 'o') {
++pszTS;
if(*pszTS == 'v') {
++pszTS;
- pTime->month = 11;
+ month = 11;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
case 'D':
if(*pszTS == 'e') {
++pszTS;
if(*pszTS == 'c') {
++pszTS;
- pTime->month = 12;
+ month = 12;
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
} else
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
break;
default:
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
}
/* done month */
if(*pszTS++ != ' ')
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
/* we accept a slightly malformed timestamp when receiving. This is
* we accept one-digit days
@@ -419,42 +458,51 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, char** ppszTS)
if(*pszTS == ' ')
++pszTS;
- pTime->day = srSLMGParseInt32(&pszTS);
- if(pTime->day < 1 || pTime->day > 31)
- return FALSE;
+ day = srSLMGParseInt32(&pszTS);
+ if(day < 1 || day > 31)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != ' ')
- return FALSE;
- pTime->hour = srSLMGParseInt32(&pszTS);
- if(pTime->hour < 0 || pTime->hour > 23)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ hour = srSLMGParseInt32(&pszTS);
+ if(hour < 0 || hour > 23)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != ':')
- return FALSE;
- pTime->minute = srSLMGParseInt32(&pszTS);
- if(pTime->minute < 0 || pTime->minute > 59)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ minute = srSLMGParseInt32(&pszTS);
+ if(minute < 0 || minute > 59)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
if(*pszTS++ != ':')
- return FALSE;
- pTime->second = srSLMGParseInt32(&pszTS);
- if(pTime->second < 0 || pTime->second > 60)
- return FALSE;
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ second = srSLMGParseInt32(&pszTS);
+ if(second < 0 || second > 60)
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
- /* we provide support for an exter ":" after the date. While this is an
+ /* we provide support for an extra ":" 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;
+ ++pszTS; /* just skip past it */
- /* OK, we actually have a 3164 timestamp, so let's indicate this
- * and fill the rest of the properties. */
+ /* we had success, so update parse pointer and caller-provided timestamp
+ * fields we do not have are not updated in the caller's timestamp. This
+ * is the reason why the caller must pass in a correct timestamp.
+ */
+ *ppszTS = pszTS; /* provide updated parse position back to caller */
pTime->timeType = 1;
+ pTime->month = month;
+ pTime->day = day;
+ pTime->hour = hour;
+ pTime->minute = minute;
+ pTime->second = second;
pTime->secfracPrecision = 0;
pTime->secfrac = 0;
- *ppszTS = pszTS; /* provide updated parse position back to caller */
- return TRUE;
+
+finalize_it:
+ RETiRet;
}
/*******************************************************************
diff --git a/runtime/datetime.h b/runtime/datetime.h
index 755cc0e..2210af0 100644
--- a/runtime/datetime.h
+++ b/runtime/datetime.h
@@ -36,8 +36,8 @@ typedef struct datetime_s {
/* interfaces */
BEGINinterface(datetime) /* name must also be changed in ENDinterface macro! */
void (*getCurrTime)(struct syslogTime *t);
- int (*ParseTIMESTAMP3339)(struct syslogTime *pTime, char** ppszTS);
- int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char** pszTS);
+ rsRetVal (*ParseTIMESTAMP3339)(struct syslogTime *pTime, char** ppszTS);
+ rsRetVal (*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);
diff --git a/runtime/debug.c b/runtime/debug.c
index 9d45c73..62e2a68 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -43,6 +43,9 @@
#include <pthread.h>
#include <ctype.h>
#include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
#include "rsyslog.h"
#include "debug.h"
@@ -62,8 +65,8 @@ static int bPrintTime = 1; /* print a timestamp together with debug message */
static int bPrintAllDebugOnExit = 0;
static int bAbortTrace = 1; /* print a trace after SIGABRT or SIGSEGV */
static char *pszAltDbgFileName = NULL; /* if set, debug output is *also* sent to here */
-static FILE *altdbg = NULL; /* and the handle for alternate debug output */
-static FILE *stddbg;
+static int altdbg = -1; /* and the handle for alternate debug output */
+static int stddbg;
/* list of files/objects that should be printed */
typedef struct dbgPrintName_s {
@@ -113,8 +116,7 @@ static dbgThrdInfo_t *dbgCallStackListRoot = NULL;
static dbgThrdInfo_t *dbgCallStackListLast = NULL;
static pthread_mutex_t mutCallStack;
-static pthread_mutex_t mutdbgprintf;
-static pthread_mutex_t mutdbgoprint;
+static pthread_mutex_t mutdbgprint;
static pthread_key_t keyCallStack;
@@ -529,7 +531,23 @@ static inline void dbgMutexUnlockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB
pthread_mutex_lock(&mutMutLog);
pLog = dbgMutLogFindSpecific(pmut, MUTOP_LOCK, NULL);
+#if 0 /* toggle for testing */
assert(pLog != NULL);
+#else
+/* the change below seems not to work - the problem seems to be a real race... I keep this code in just in case
+ * I need to re-use it. It should be removed once we are finished analyzing this problem. -- rgerhards, 2008-09-17
+ */
+if(pLog == NULL) {
+ /* this may happen due to some races. We do not try to avoid
+ * this, as it would complicate the "real" code. This is not justified
+ * just to keep the debug info system up. -- rgerhards, 2008-09-17
+ */
+ pthread_mutex_unlock(&mutMutLog);
+ dbgprintf("%s:%d:%s: mutex %p UNlocked [but we did not yet know this mutex!]\n",
+ pFuncDB->file, unlockLn, pFuncDB->func, (void*)pmut);
+ return; /* if we don't know it yet, we can not clean up... */
+}
+#endif
/* we found the last lock entry. We now need to see from which FuncDB we need to
* remove it. This is recorded inside the mutex log entry.
@@ -801,8 +819,6 @@ sigsegvHdlr(int signum)
}
dbgprintf("\n\nTo submit bug reports, visit http://www.rsyslog.com/bugs\n\n");
- if(stddbg != NULL) fflush(stddbg);
- if(altdbg != NULL) fflush(altdbg);
/* and finally abort... */
/* TODO: think about restarting rsyslog in this case: may be a good idea,
@@ -811,56 +827,47 @@ sigsegvHdlr(int signum)
abort();
}
-
+#if 1
#pragma GCC diagnostic ignored "-Wempty-body"
-/* print some debug output when an object is given
- * This is mostly a copy of dbgprintf, but I do not know how to combine it
- * into a single function as we have variable arguments and I don't know how to call
- * from one vararg function into another. I don't dig in this, it is OK for the
- * time being. -- rgerhards, 2008-01-29
+/* write the debug message. This is a helper to dbgprintf and dbgoprint which
+ * contains common code. added 2008-09-26 rgerhards
*/
-void
-dbgoprint(obj_t *pObj, char *fmt, ...)
+static void
+dbgprint(obj_t *pObj, char *pszMsg, size_t lenMsg)
{
static pthread_t ptLastThrdID = 0;
static int bWasNL = 0;
- va_list ap;
- static char pszThrdName[64]; /* 64 is to be on the safe side, anything over 20 is bad... */
- static char pszWriteBuf[1024];
+ char pszThrdName[64]; /* 64 is to be on the safe side, anything over 20 is bad... */
+ char pszWriteBuf[1024];
size_t lenWriteBuf;
struct timespec t;
+ uchar *pszObjName = NULL;
- if(!(Debug && debugging_on))
- return;
-
- /* a quick and very dirty hack to enable us to display just from those objects
- * that we are interested in. So far, this must be changed at compile time (and
- * chances are great it is commented out while you read it. Later, this shall
- * be selectable via the environment. -- rgerhards, 2008-02-20
+ /* we must get the object name before we lock the mutex, because the object
+ * potentially calls back into us. If we locked the mutex, we would deadlock
+ * ourselfs. On the other hand, the GetName call needs not to be protected, as
+ * this thread has a valid reference. If such an object is deleted by another
+ * thread, we are in much more trouble than just for dbgprint(). -- rgerhards, 2008-09-26
*/
-#if 0
- if(objGetObjID(pObj) != OBJexpr)
- return;
-#endif
-
+ if(pObj != NULL) {
+ pszObjName = obj.GetName(pObj);
+ }
- pthread_mutex_lock(&mutdbgoprint);
- pthread_cleanup_push(dbgMutexCancelCleanupHdlr, &mutdbgoprint);
+ pthread_mutex_lock(&mutdbgprint);
+ pthread_cleanup_push(dbgMutexCancelCleanupHdlr, &mutdbgprint);
/* The bWasNL handler does not really work. It works if no thread
* switching occurs during non-NL messages. Else, things are messed
* up. Anyhow, it works well enough to provide useful help during
* getting this up and running. It is questionable if the extra effort
- * is worth fixing it, giving the limited appliability.
- * rgerhards, 2005-10-25
+ * is worth fixing it, giving the limited appliability. -- rgerhards, 2005-10-25
* I have decided that it is not worth fixing it - especially as it works
- * pretty well.
- * rgerhards, 2007-06-15
+ * pretty well. -- rgerhards, 2007-06-15
*/
if(ptLastThrdID != pthread_self()) {
if(!bWasNL) {
- if(stddbg != NULL) fprintf(stddbg, "\n");
- if(altdbg != NULL) fprintf(altdbg, "\n");
+ if(stddbg != -1) write(stddbg, "\n", 1);
+ if(altdbg != -1) write(altdbg, "\n", 1);
bWasNL = 1;
}
ptLastThrdID = pthread_self();
@@ -874,113 +881,82 @@ dbgoprint(obj_t *pObj, char *fmt, ...)
if(bWasNL) {
if(bPrintTime) {
clock_gettime(CLOCK_REALTIME, &t);
- if(stddbg != NULL) fprintf(stddbg, "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
- if(altdbg != NULL) fprintf(altdbg, "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
+ lenWriteBuf = snprintf(pszWriteBuf, sizeof(pszWriteBuf),
+ "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
+ if(stddbg != -1) write(stddbg, pszWriteBuf, lenWriteBuf);
+ if(altdbg != -1) write(altdbg, pszWriteBuf, lenWriteBuf);
}
- if(stddbg != NULL) fprintf(stddbg, "%s: ", pszThrdName);
- if(altdbg != NULL) fprintf(altdbg, "%s: ", pszThrdName);
+ lenWriteBuf = snprintf(pszWriteBuf, sizeof(pszWriteBuf), "%s: ", pszThrdName);
+ if(stddbg != -1) write(stddbg, pszWriteBuf, lenWriteBuf);
+ if(altdbg != -1) write(altdbg, pszWriteBuf, lenWriteBuf);
/* print object name header if we have an object */
- if(pObj != NULL) {
- if(stddbg != NULL) fprintf(stddbg, "%s: ", obj.GetName(pObj));
- if(altdbg != NULL) fprintf(altdbg, "%s: ", obj.GetName(pObj));
+ if(pszObjName != NULL) {
+ lenWriteBuf = snprintf(pszWriteBuf, sizeof(pszWriteBuf), "%s: ", pszObjName);
+ if(stddbg != -1) write(stddbg, pszWriteBuf, lenWriteBuf);
+ if(altdbg != -1) write(altdbg, pszWriteBuf, lenWriteBuf);
}
}
- bWasNL = (*(fmt + strlen(fmt) - 1) == '\n') ? 1 : 0;
+ if(stddbg != -1) write(stddbg, pszMsg, lenMsg);
+ if(altdbg != -1) write(altdbg, pszMsg, lenMsg);
+
+ bWasNL = (pszMsg[lenMsg - 1] == '\n') ? 1 : 0;
+
+ pthread_cleanup_pop(1);
+}
+#pragma GCC diagnostic warning "-Wempty-body"
+#endif
+
+/* print some debug output when an object is given
+ * This is mostly a copy of dbgprintf, but I do not know how to combine it
+ * into a single function as we have variable arguments and I don't know how to call
+ * from one vararg function into another. I don't dig in this, it is OK for the
+ * time being. -- rgerhards, 2008-01-29
+ */
+void
+dbgoprint(obj_t *pObj, char *fmt, ...)
+{
+ va_list ap;
+ char pszWriteBuf[1024];
+ size_t lenWriteBuf;
+
+ if(!(Debug && debugging_on))
+ return;
+
+ /* a quick and very dirty hack to enable us to display just from those objects
+ * that we are interested in. So far, this must be changed at compile time (and
+ * chances are great it is commented out while you read it. Later, this shall
+ * be selectable via the environment. -- rgerhards, 2008-02-20
+ */
+#if 0
+ if(objGetObjID(pObj) != OBJexpr)
+ return;
+#endif
+
va_start(ap, fmt);
lenWriteBuf = vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap);
- if(lenWriteBuf >= sizeof(pszWriteBuf)) {
- /* if our buffer was too small, we simply truncate. TODO: maybe something better? */
- lenWriteBuf = sizeof(pszWriteBuf) - 1;
- }
va_end(ap);
- /*
- if(stddbg != NULL) fprintf(stddbg, "%s", pszWriteBuf);
- if(altdbg != NULL) fprintf(altdbg, "%s", pszWriteBuf);
- */
- if(stddbg != NULL) fwrite(pszWriteBuf, lenWriteBuf, 1, stddbg);
- if(altdbg != NULL) fwrite(pszWriteBuf, lenWriteBuf, 1, altdbg);
-
- if(stddbg != NULL) fflush(stddbg);
- if(altdbg != NULL) fflush(altdbg);
- pthread_cleanup_pop(1);
+ dbgprint(pObj, pszWriteBuf, lenWriteBuf);
}
-#pragma GCC diagnostic warning "-Wempty-body"
-#pragma GCC diagnostic ignored "-Wempty-body"
/* print some debug output when no object is given
* WARNING: duplicate code, see dbgoprin above!
*/
void
dbgprintf(char *fmt, ...)
{
- static pthread_t ptLastThrdID = 0;
- static int bWasNL = 0;
va_list ap;
- static char pszThrdName[64]; /* 64 is to be on the safe side, anything over 20 is bad... */
- static char pszWriteBuf[1024];
+ char pszWriteBuf[1024];
size_t lenWriteBuf;
- struct timespec t;
if(!(Debug && debugging_on))
return;
- pthread_mutex_lock(&mutdbgprintf);
- pthread_cleanup_push(dbgMutexCancelCleanupHdlr, &mutdbgprintf);
-
- /* The bWasNL handler does not really work. It works if no thread
- * switching occurs during non-NL messages. Else, things are messed
- * up. Anyhow, it works well enough to provide useful help during
- * getting this up and running. It is questionable if the extra effort
- * is worth fixing it, giving the limited appliability.
- * rgerhards, 2005-10-25
- * I have decided that it is not worth fixing it - especially as it works
- * pretty well.
- * rgerhards, 2007-06-15
- */
- if(ptLastThrdID != pthread_self()) {
- if(!bWasNL) {
- if(stddbg != NULL) fprintf(stddbg, "\n");
- if(altdbg != NULL) fprintf(altdbg, "\n");
- bWasNL = 1;
- }
- ptLastThrdID = pthread_self();
- }
-
- /* do not cache the thread name, as the caller might have changed it
- * TODO: optimized, invalidate cache when new name is set
- */
- dbgGetThrdName(pszThrdName, sizeof(pszThrdName), ptLastThrdID, 0);
-
- if(bWasNL) {
- if(bPrintTime) {
- clock_gettime(CLOCK_REALTIME, &t);
- if(stddbg != NULL) fprintf(stddbg, "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
- if(altdbg != NULL) fprintf(altdbg, "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
- }
- if(stddbg != NULL) fprintf(stddbg, "%s: ", pszThrdName);
- if(altdbg != NULL) fprintf(altdbg, "%s: ", pszThrdName);
- }
- bWasNL = (*(fmt + strlen(fmt) - 1) == '\n') ? 1 : 0;
va_start(ap, fmt);
lenWriteBuf = vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap);
- if(lenWriteBuf >= sizeof(pszWriteBuf)) {
- /* if our buffer was too small, we simply truncate. TODO: maybe something better? */
- lenWriteBuf = sizeof(pszWriteBuf) - 1;
- }
va_end(ap);
- /*
- if(stddbg != NULL) fprintf(stddbg, "%s", pszWriteBuf);
- if(altdbg != NULL) fprintf(altdbg, "%s", pszWriteBuf);
- */
- if(stddbg != NULL) fwrite(pszWriteBuf, lenWriteBuf, 1, stddbg);
- if(altdbg != NULL) fwrite(pszWriteBuf, lenWriteBuf, 1, altdbg);
-
- if(stddbg != NULL) fflush(stddbg);
- if(altdbg != NULL) fflush(altdbg);
- pthread_cleanup_pop(1);
+ dbgprint(NULL, pszWriteBuf, lenWriteBuf);
}
-#pragma GCC diagnostic warning "-Wempty-body"
void tester(void)
{
@@ -994,7 +970,7 @@ ENDfunc
int dbgEntrFunc(dbgFuncDB_t **ppFuncDB, const char *file, const char *func, int line)
{
int iStackPtr = 0; /* TODO: find some better default, this one hurts the least, but it is not clean */
- dbgThrdInfo_t *pThrd = dbgGetThrdInfo();
+ dbgThrdInfo_t *pThrd;
dbgFuncDBListEntry_t *pFuncDBListEntry;
unsigned int i;
dbgFuncDB_t *pFuncDB;
@@ -1005,6 +981,8 @@ int dbgEntrFunc(dbgFuncDB_t **ppFuncDB, const char *file, const char *func, int
pFuncDB = *ppFuncDB;
assert((pFuncDB == NULL) || (pFuncDB->magic == dbgFUNCDB_MAGIC));
+ pThrd = dbgGetThrdInfo(); /* we must do this AFTER the mutexes are initialized! */
+
if(pFuncDB == NULL) {
/* we do not yet have a funcDB and need to create a new one. We also add it
* to the linked list of funcDBs. Please note that when a module is unloaded and
@@ -1259,7 +1237,7 @@ dbgGetRuntimeOptions(void)
uchar *optname;
/* set some defaults */
- stddbg = stdout;
+ stddbg = 1;
if((pszOpts = (uchar*) getenv("RSYSLOG_DEBUG")) != NULL) {
/* we have options set, so let's process them */
@@ -1301,7 +1279,7 @@ dbgGetRuntimeOptions(void)
} else if(!strcasecmp((char*)optname, "nologtimestamp")) {
bPrintTime = 0;
} else if(!strcasecmp((char*)optname, "nostdout")) {
- stddbg = NULL;
+ stddbg = -1;
} else if(!strcasecmp((char*)optname, "noaborttrace")) {
bAbortTrace = 0;
} else if(!strcasecmp((char*)optname, "filetrace")) {
@@ -1326,7 +1304,7 @@ dbgGetRuntimeOptions(void)
rsRetVal dbgClassInit(void)
{
- DEFiRet;
+ rsRetVal iRet; /* do not use DEFiRet, as this makes calls into the debug system! */
struct sigaction sigAct;
sigset_t sigSet;
@@ -1340,8 +1318,7 @@ rsRetVal dbgClassInit(void)
pthread_mutex_init(&mutFuncDBList, NULL);
pthread_mutex_init(&mutMutLog, NULL);
pthread_mutex_init(&mutCallStack, NULL);
- pthread_mutex_init(&mutdbgprintf, NULL);
- pthread_mutex_init(&mutdbgoprint, NULL);
+ pthread_mutex_init(&mutdbgprint, NULL);
/* while we try not to use any of the real rsyslog code (to avoid infinite loops), we
* need to have the ability to query object names. Thus, we need to obtain a pointer to
@@ -1363,7 +1340,7 @@ rsRetVal dbgClassInit(void)
if(pszAltDbgFileName != NULL) {
/* we have a secondary file, so let's open it) */
- if((altdbg = fopen(pszAltDbgFileName, "w")) == NULL) {
+ if((altdbg = open(pszAltDbgFileName, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, S_IRUSR|S_IWUSR)) == -1) {
fprintf(stderr, "alternate debug file could not be opened, ignoring. Error: %s\n", strerror(errno));
}
}
@@ -1371,7 +1348,7 @@ rsRetVal dbgClassInit(void)
dbgSetThrdName((uchar*)"main thread");
finalize_it:
- RETiRet;
+ return(iRet);
}
@@ -1383,8 +1360,8 @@ rsRetVal dbgClassExit(void)
if(bPrintAllDebugOnExit)
dbgPrintAllDebugInfo();
- if(altdbg != NULL)
- fclose(altdbg);
+ if(altdbg != -1)
+ close(altdbg);
/* now free all of our memory to make the memory debugger happy... */
pFuncDBListEtry = pFuncDBListRoot;
diff --git a/runtime/debug.h b/runtime/debug.h
index ed91467..4383602 100644
--- a/runtime/debug.h
+++ b/runtime/debug.h
@@ -132,7 +132,8 @@ void dbgPrintAllDebugInfo(void);
/* debug aides */
-#ifdef RTINST
+//#ifdef RTINST
+#if 0 // temporarily removed for helgrind
#define d_pthread_mutex_lock(x) dbgMutexLock(x, pdbgFuncDB, __LINE__, dbgCALLStaCK_POP_POINT )
#define d_pthread_mutex_trylock(x) dbgMutexTryLock(x, pdbgFuncDB, __LINE__, dbgCALLStaCK_POP_POINT )
#define d_pthread_mutex_unlock(x) dbgMutexUnlock(x, pdbgFuncDB, __LINE__, dbgCALLStaCK_POP_POINT )
diff --git a/runtime/glbl.c b/runtime/glbl.c
index 11a664f..1114fcd 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -51,6 +51,7 @@ DEFobjStaticHelpers
* class...
*/
static uchar *pszWorkDir = NULL;
+static int iMaxLine = 2048; /* maximum length of a syslog message */
static int iDefPFFamily = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
static int bDropMalPTRMsgs = 0;/* Drop messages which have malicious PTR records during DNS lookup */
static int option_DisallowWarning = 1; /* complain if message from disallowed sender is received */
@@ -84,6 +85,7 @@ static dataType Get##nameFunc(void) \
return(nameVar); \
}
+SIMP_PROP(MaxLine, iMaxLine, int)
SIMP_PROP(DefPFFamily, iDefPFFamily, int) /* note that in the future we may check the family argument */
SIMP_PROP(DropMalPTRMsgs, bDropMalPTRMsgs, int)
SIMP_PROP(Option_DisallowWarning, option_DisallowWarning, int)
@@ -170,6 +172,7 @@ CODESTARTobjQueryInterface(glbl)
#define SIMP_PROP(name) \
pIf->Get##name = Get##name; \
pIf->Set##name = Set##name;
+ SIMP_PROP(MaxLine);
SIMP_PROP(DefPFFamily);
SIMP_PROP(DropMalPTRMsgs);
SIMP_PROP(Option_DisallowWarning);
diff --git a/runtime/glbl.h b/runtime/glbl.h
index 9043631..0c83bdd 100644
--- a/runtime/glbl.h
+++ b/runtime/glbl.h
@@ -40,6 +40,7 @@ BEGINinterface(glbl) /* name must also be changed in ENDinterface macro! */
#define SIMP_PROP(name, dataType) \
dataType (*Get##name)(void); \
rsRetVal (*Set##name)(dataType);
+ SIMP_PROP(MaxLine, int)
SIMP_PROP(DefPFFamily, int)
SIMP_PROP(DropMalPTRMsgs, int)
SIMP_PROP(Option_DisallowWarning, int)
diff --git a/runtime/modules.c b/runtime/modules.c
index ceb4768..d5730ed 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -570,6 +570,8 @@ Load(uchar *pModName)
int bHasExtension;
void *pModHdlr, *pModInit;
modInfo_t *pModInfo;
+ uchar *pModDirCurr, *pModDirNext;
+ int iLoadCnt;
assert(pModName != NULL);
dbgprintf("Requested to load module '%s'\n", pModName);
@@ -591,48 +593,84 @@ Load(uchar *pModName)
pModInfo = GetNxt(pModInfo);
}
- /* now build our load module name */
- if(*pModName == '/') {
- *szPath = '\0'; /* we do not need to append the path - its already in the module name */
- iPathLen = 0;
- } else {
- *szPath = '\0';
- strncat((char *) szPath, (pModDir == NULL) ? _PATH_MODDIR : (char*) pModDir, sizeof(szPath) - 1);
- iPathLen = strlen((char*) szPath);
- if((szPath[iPathLen - 1] != '/')) {
- if((iPathLen <= sizeof(szPath) - 2)) {
- szPath[iPathLen++] = '/';
- szPath[iPathLen] = '\0';
- } else {
- errmsg.LogError(0, RS_RET_MODULE_LOAD_ERR_PATHLEN, "could not load module '%s', path too long\n", pModName);
+ pModDirCurr = (uchar *)((pModDir == NULL) ? _PATH_MODDIR : (char *)pModDir);
+ pModDirNext = NULL;
+ pModHdlr = NULL;
+ iLoadCnt = 0;
+ do {
+ /* now build our load module name */
+ if(*pModName == '/') {
+ *szPath = '\0'; /* we do not need to append the path - its already in the module name */
+ iPathLen = 0;
+ } else {
+ *szPath = '\0';
+
+ iPathLen = strlen((char *)pModDirCurr);
+ pModDirNext = (uchar *)strchr((char *)pModDirCurr, ':');
+ if(pModDirNext)
+ iPathLen = (size_t)(pModDirNext - pModDirCurr);
+
+ if(iPathLen == 0) {
+ if(pModDirNext) {
+ pModDirCurr = pModDirNext + 1;
+ continue;
+ }
+ break;
+ } else if(iPathLen > sizeof(szPath) - 1) {
+ errmsg.LogError(0, NO_ERRCODE, "could not load module '%s', module path too long\n", pModName);
ABORT_FINALIZE(RS_RET_MODULE_LOAD_ERR_PATHLEN);
}
+
+ strncat((char *) szPath, (char *)pModDirCurr, iPathLen);
+ iPathLen = strlen((char*) szPath);
+
+ if(pModDirNext)
+ pModDirCurr = pModDirNext + 1;
+
+ if((szPath[iPathLen - 1] != '/')) {
+ if((iPathLen <= sizeof(szPath) - 2)) {
+ szPath[iPathLen++] = '/';
+ szPath[iPathLen] = '\0';
+ } else {
+ errmsg.LogError(0, RS_RET_MODULE_LOAD_ERR_PATHLEN, "could not load module '%s', path too long\n", pModName);
+ ABORT_FINALIZE(RS_RET_MODULE_LOAD_ERR_PATHLEN);
+ }
+ }
}
- }
- /* ... add actual name ... */
- strncat((char *) szPath, (char *) pModName, sizeof(szPath) - iPathLen - 1);
+ /* ... add actual name ... */
+ strncat((char *) szPath, (char *) pModName, sizeof(szPath) - iPathLen - 1);
+
+ /* now see if we have an extension and, if not, append ".so" */
+ if(!bHasExtension) {
+ /* we do not have an extension and so need to add ".so"
+ * TODO: I guess this is highly importable, so we should change the
+ * algo over time... -- rgerhards, 2008-03-05
+ */
+ /* ... so now add the extension */
+ strncat((char *) szPath, ".so", sizeof(szPath) - strlen((char*) szPath) - 1);
+ iPathLen += 3;
+ }
- /* now see if we have an extension and, if not, append ".so" */
- if(!bHasExtension) {
- /* we do not have an extension and so need to add ".so"
- * TODO: I guess this is highly importable, so we should change the
- * algo over time... -- rgerhards, 2008-03-05
- */
- /* ... so now add the extension */
- strncat((char *) szPath, ".so", sizeof(szPath) - strlen((char*) szPath) - 1);
- iPathLen += 3;
- }
+ if(iPathLen + strlen((char*) pModName) >= sizeof(szPath)) {
+ errmsg.LogError(0, RS_RET_MODULE_LOAD_ERR_PATHLEN, "could not load module '%s', path too long\n", pModName);
+ ABORT_FINALIZE(RS_RET_MODULE_LOAD_ERR_PATHLEN);
+ }
- if(iPathLen + strlen((char*) pModName) >= sizeof(szPath)) {
- errmsg.LogError(0, RS_RET_MODULE_LOAD_ERR_PATHLEN, "could not load module '%s', path too long\n", pModName);
- ABORT_FINALIZE(RS_RET_MODULE_LOAD_ERR_PATHLEN);
- }
+ /* complete load path constructed, so ... GO! */
+ dbgprintf("loading module '%s'\n", szPath);
+ pModHdlr = dlopen((char *) szPath, RTLD_NOW);
+ iLoadCnt++;
+
+ } while(pModHdlr == NULL && *pModName != '/' && pModDirNext);
- /* complete load path constructed, so ... GO! */
- dbgprintf("loading module '%s'\n", szPath);
- if(!(pModHdlr = dlopen((char *) szPath, RTLD_NOW))) {
- errmsg.LogError(0, RS_RET_MODULE_LOAD_ERR_DLOPEN, "could not load module '%s', dlopen: %s\n", szPath, dlerror());
+ if(!pModHdlr) {
+ if(iLoadCnt) {
+ errmsg.LogError(0, RS_RET_MODULE_LOAD_ERR_DLOPEN, "could not load module '%s', dlopen: %s\n", szPath, dlerror());
+ } else {
+ errmsg.LogError(0, NO_ERRCODE, "could not load module '%s', ModDir was '%s'\n", szPath,
+ ((pModDir == NULL) ? _PATH_MODDIR : (char *)pModDir));
+ }
ABORT_FINALIZE(RS_RET_MODULE_LOAD_ERR_DLOPEN);
}
if(!(pModInit = dlsym(pModHdlr, "modInit"))) {
diff --git a/runtime/msg.c b/runtime/msg.c
index d02b0a0..2b58eb8 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -42,6 +42,7 @@
#include "msg.h"
#include "var.h"
#include "datetime.h"
+#include "glbl.h"
#include "regexp.h"
#include "atomic.h"
@@ -49,6 +50,7 @@
DEFobjStaticHelpers
DEFobjCurrIf(var)
DEFobjCurrIf(datetime)
+DEFobjCurrIf(glbl)
DEFobjCurrIf(regexp)
static syslogCODE rs_prioritynames[] =
@@ -258,7 +260,16 @@ rsRetVal msgConstruct(msg_t **ppThis)
pM->iRefCount = 1;
pM->iSeverity = -1;
pM->iFacility = -1;
+
+ /* we initialize both timestamps to contain the current time, so that they
+ * are consistent. Also, this saves us from doing any further time calls just
+ * to obtain a timestamp. The memcpy() should not really make a difference,
+ * especially as I think there is no codepath currently where it would not be
+ * required (after I have cleaned up the pathes ;)). -- rgerhards, 2008-10-02
+ */
datetime.getCurrTime(&(pM->tRcvdAt));
+ memcpy(&pM->tTIMESTAMP, &pM->tRcvdAt, sizeof(struct syslogTime));
+
objConstructSetObjInfo(pM);
/* DEV debugging only! dbgprintf("msgConstruct\t0x%x, ref 1\n", (int)pM);*/
@@ -273,9 +284,13 @@ finalize_it:
BEGINobjDestruct(msg) /* be sure to specify the object type also in END and CODESTART macros! */
int currRefCount;
CODESTARTobjDestruct(msg)
- /* DEV Debugging only ! dbgprintf("msgDestruct\t0x%lx, Ref now: %d\n", (unsigned long)pM, pM->iRefCount - 1); */
- MsgLock(pThis);
- currRefCount = --pThis->iRefCount;
+ /* DEV Debugging only ! dbgprintf("msgDestruct\t0x%lx, Ref now: %d\n", (unsigned long)pThis, pThis->iRefCount - 1); */
+# ifdef HAVE_ATOMIC_BUILTINS
+ currRefCount = ATOMIC_DEC_AND_FETCH(pThis->iRefCount);
+# else
+ MsgLock(pThis);
+ currRefCount = --pThis->iRefCount;
+# endif
if(currRefCount == 0)
{
/* DEV Debugging Only! dbgprintf("msgDestruct\t0x%lx, RefCount now 0, doing DESTROY\n", (unsigned long)pThis); */
@@ -287,6 +302,8 @@ CODESTARTobjDestruct(msg)
free(pThis->pszTAG);
if(pThis->pszHOSTNAME != NULL)
free(pThis->pszHOSTNAME);
+ if(pThis->pszInputName != NULL)
+ free(pThis->pszInputName);
if(pThis->pszRcvFrom != NULL)
free(pThis->pszRcvFrom);
if(pThis->pszRcvFromIP != NULL)
@@ -333,7 +350,9 @@ CODESTARTobjDestruct(msg)
rsCStrDestruct(&pThis->pCSPROCID);
if(pThis->pCSMSGID != NULL)
rsCStrDestruct(&pThis->pCSMSGID);
+# ifndef HAVE_ATOMIC_BUILTINS
MsgUnlock(pThis);
+# endif
funcDeleteMutex(pThis);
} else {
MsgUnlock(pThis);
@@ -455,6 +474,7 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm)
objSerializePTR(pStrm, pszUxTradMsg, PSZ);
objSerializePTR(pStrm, pszTAG, PSZ);
objSerializePTR(pStrm, pszHOSTNAME, PSZ);
+ objSerializePTR(pStrm, pszInputName, PSZ);
objSerializePTR(pStrm, pszRcvFrom, PSZ);
objSerializePTR(pStrm, pszRcvFromIP, PSZ);
@@ -480,9 +500,13 @@ finalize_it:
msg_t *MsgAddRef(msg_t *pM)
{
assert(pM != NULL);
- MsgLock(pM);
- pM->iRefCount++;
- MsgUnlock(pM);
+# ifdef HAVE_ATOMIC_BUILTINS
+ ATOMIC_INC(pM->iRefCount);
+# else
+ MsgLock(pM);
+ pM->iRefCount++;
+ MsgUnlock(pM);
+# endif
/* DEV debugging only! dbgprintf("MsgAddRef\t0x%x done, Ref now: %d\n", (int)pM, pM->iRefCount);*/
return(pM);
}
@@ -1217,6 +1241,18 @@ char *getHOSTNAME(msg_t *pM)
}
+uchar *getInputName(msg_t *pM)
+{
+ if(pM == NULL)
+ return (uchar*) "";
+ else
+ if(pM->pszInputName == NULL)
+ return (uchar*) "";
+ else
+ return pM->pszInputName;
+}
+
+
char *getRcvFrom(msg_t *pM)
{
if(pM == NULL)
@@ -1397,6 +1433,19 @@ static int getAPPNAMELen(msg_t *pM)
return (pM->pCSAPPNAME == NULL) ? 0 : rsCStrLen(pM->pCSAPPNAME);
}
+/* rgerhards 2008-09-10: set pszInputName in msg object
+ */
+void MsgSetInputName(msg_t *pMsg, char* pszInputName)
+{
+ assert(pMsg != NULL);
+ if(pMsg->pszInputName != NULL)
+ free(pMsg->pszInputName);
+
+ pMsg->iLenInputName = strlen(pszInputName);
+ if((pMsg->pszInputName = malloc(pMsg->iLenInputName + 1)) != NULL) {
+ memcpy(pMsg->pszInputName, pszInputName, pMsg->iLenInputName + 1);
+ }
+}
/* rgerhards 2004-11-16: set pszRcvFrom in msg object
*/
@@ -1440,6 +1489,8 @@ void MsgAssignHOSTNAME(msg_t *pMsg, char *pBuf)
{
assert(pMsg != NULL);
assert(pBuf != NULL);
+ if(pMsg->pszHOSTNAME != NULL)
+ free(pMsg->pszHOSTNAME);
pMsg->iLenHOSTNAME = strlen(pBuf);
pMsg->pszHOSTNAME = (uchar*) pBuf;
}
@@ -1683,6 +1734,8 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
pRes = getRawMsg(pMsg);
} else if(!strcmp((char*) pName, "uxtradmsg")) {
pRes = getUxTradMsg(pMsg);
+ } else if(!strcmp((char*) pName, "inputname")) {
+ pRes = (char*) getInputName(pMsg);
} else if(!strcmp((char*) pName, "fromhost")) {
pRes = getRcvFrom(pMsg);
} else if(!strcmp((char*) pName, "fromhost-ip")) {
@@ -1770,6 +1823,8 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
return "***OUT OF MEMORY***";
} else
*pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else if(!strcmp((char*) pName, "$myhostname")) {
+ pRes = (char*) glbl.GetLocalHostName();
} else {
/* there is no point in continuing, we may even otherwise render the
* error message unreadable. rgerhards, 2007-07-10
@@ -1807,6 +1862,11 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
++pFld; /* skip to field terminator */
if(*pFld == pTpe->data.field.field_delim) {
++pFld; /* eat it */
+ if (pTpe->data.field.field_expand != 0) {
+ while (*pFld == pTpe->data.field.field_delim) {
+ ++pFld;
+ }
+ }
++iCurrFld;
}
}
@@ -2369,6 +2429,8 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp)
MsgSetUxTradMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszTAG")) {
MsgSetTAG(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
+ } else if(isProp("pszInputName")) {
+ MsgSetInputName(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszRcvFromIP")) {
MsgSetRcvFromIP(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszRcvFrom")) {
@@ -2431,6 +2493,7 @@ BEGINObjClassInit(msg, 1, OBJ_IS_CORE_MODULE)
/* request objects we use */
CHKiRet(objUse(var, CORE_COMPONENT));
CHKiRet(objUse(datetime, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
/* set our own handlers */
OBJSetMethodHandler(objMethod_SERIALIZE, MsgSerialize);
diff --git a/runtime/msg.h b/runtime/msg.h
index fadbb48..1bad9c6 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -92,9 +92,11 @@ short bDoLock; /* use the mutex? */
int iLenRcvFrom; /* Length of pszRcvFrom */
uchar *pszRcvFromIP; /* IP of system message was received from */
int iLenRcvFromIP; /* Length of pszRcvFromIP */
+ uchar *pszInputName; /* name of the input module that submitted this message */
+ int iLenInputName; /* Length of pszInputName */
short iProtocolVersion;/* protocol version of message received 0 - legacy, 1 syslog-protocol) */
cstr_t *pCSProgName; /* the (BSD) program name */
- cstr_t *pCSStrucData;/* STRUCTURED-DATA */
+ cstr_t *pCSStrucData; /* STRUCTURED-DATA */
cstr_t *pCSAPPNAME; /* APP-NAME */
cstr_t *pCSPROCID; /* PROCID */
cstr_t *pCSMSGID; /* MSGID */
@@ -136,6 +138,7 @@ char *getSeverity(msg_t *pM);
char *getSeverityStr(msg_t *pM);
char *getFacility(msg_t *pM);
char *getFacilityStr(msg_t *pM);
+void MsgSetInputName(msg_t *pMsg, char*);
rsRetVal MsgSetAPPNAME(msg_t *pMsg, char* pszAPPNAME);
char *getAPPNAME(msg_t *pM);
rsRetVal MsgSetPROCID(msg_t *pMsg, char* pszPROCID);
diff --git a/runtime/net.c b/runtime/net.c
index c5fa771..f289ecc 100644
--- a/runtime/net.c
+++ b/runtime/net.c
@@ -1041,7 +1041,6 @@ should_use_so_bsdcompat(void)
#define SO_BSDCOMPAT 0
#endif
-
/* get the hostname of the message source. This was originally in cvthname()
* but has been moved out of it because of clarity and fuctional separation.
* It must be provided by the socket we received the message on as well as
diff --git a/runtime/obj.c b/runtime/obj.c
index 082aa69..2a9df9e 100644
--- a/runtime/obj.c
+++ b/runtime/obj.c
@@ -780,7 +780,7 @@ Deserialize(void *ppObj, uchar *pszTypeExpected, strm_t *pStrm, rsRetVal (*fFixu
DEFiRet;
rsRetVal iRetLocal;
obj_t *pObj = NULL;
- int oVers = 0; /* after all, it is totally useless but takes up some execution time... */
+ int oVers = 0; /* keep compiler happy, but it is totally useless but takes up some execution time... */
cstr_t *pstrID = NULL;
objInfo_t *pObjInfo;
diff --git a/runtime/queue.c b/runtime/queue.c
index 9f9943b..93b3396 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -1449,8 +1449,13 @@ queueDequeueConsumable(queue_t *pThis, wti_t *pWti, int iCancelStateSave)
pthread_cond_broadcast(&pThis->belowLightDlyWtrMrk);
}
- d_pthread_mutex_unlock(pThis->mut);
+ /* rgerhards, 2008-09-30: I reversed the order of cond_signal und mutex_unlock
+ * as of the pthreads recommendation on predictable scheduling behaviour. I don't see
+ * any problems caused by this, but I add this comment in case some will be seen
+ * in the next time.
+ */
pthread_cond_signal(&pThis->notFull);
+ d_pthread_mutex_unlock(pThis->mut);
pthread_setcancelstate(iCancelStateSave, NULL);
/* WE ARE NO LONGER PROTECTED BY THE MUTEX */
@@ -2111,7 +2116,6 @@ queueEnqObj(queue_t *pThis, flowControl_t flowCtlType, void *pUsr)
{
DEFiRet;
int iCancelStateSave;
- int i;
struct timespec t;
ISOBJ_TYPE_assert(pThis, queue);
@@ -2134,7 +2138,6 @@ queueEnqObj(queue_t *pThis, flowControl_t flowCtlType, void *pUsr)
if(pThis->bIsDA)
CHKiRet(queueChkStrtDA(pThis));
-
/* handle flow control
* There are two different flow control mechanisms: basic and advanced flow control.
* Basic flow control has always been implemented and protects the queue structures
@@ -2191,17 +2194,14 @@ queueEnqObj(queue_t *pThis, flowControl_t flowCtlType, void *pUsr)
finalize_it:
if(pThis->qType != QUEUETYPE_DIRECT) {
+ /* make sure at least one worker is running. */
+ queueAdviseMaxWorkers(pThis);
+ dbgoprint((obj_t*) pThis, "EnqueueMsg advised worker start\n");
+ /* and release the mutex */
d_pthread_mutex_unlock(pThis->mut);
- i = pthread_cond_signal(&pThis->notEmpty);
- dbgoprint((obj_t*) pThis, "EnqueueMsg signaled condition (%d)\n", i);
pthread_setcancelstate(iCancelStateSave, NULL);
}
- /* make sure at least one worker is running. */
- if(pThis->qType != QUEUETYPE_DIRECT) {
- queueAdviseMaxWorkers(pThis);
- }
-
RETiRet;
}
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index 06ffae8..70af8c4 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -123,6 +123,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_TRUE = -3, /**< to indicate a true state (can be used as TRUE, legacy) */
RS_RET_FALSE = -2, /**< to indicate a false state (can be used as FALSE, legacy) */
RS_RET_NO_IRET = -8, /**< This is a trick for the debuging system - it means no iRet is provided */
+ RS_RET_VALIDATION_RUN = -9, /**< indicates a (config) validation run, processing not carried out */
RS_RET_ERR = -3000, /**< generic failure */
RS_TRUNCAT_TOO_LARGE = -3001, /**< truncation operation where too many chars should be truncated */
RS_RET_FOUND_AT_STRING_END = -3002, /**< some value found, but at the last pos of string */
@@ -246,8 +247,11 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_RETRY = -2100, /**< call should be retried (e.g. EGAIN on recv) */
RS_RET_GSS_ERR = -2101, /**< generic error occured in GSSAPI subsystem */
RS_RET_CERTLESS = -2102, /**< state: we run without machine cert (this may be OK) */
- RS_RET_QUEUE_FULL = -2103, /**< queue is full, operation could not be completed */
- RS_RET_ACCEPT_ERR = -2104, /**< error during accept() system call */
+ RS_RET_NO_ACTIONS = -2103, /**< no active actions are configured (no output will be created) */
+ RS_RET_CONF_FILE_NOT_FOUND = -2104, /**< config file or directory not found */
+ RS_RET_QUEUE_FULL = -2105, /**< queue is full, operation could not be completed */
+ RS_RET_ACCEPT_ERR = -2106, /**< error during accept() system call */
+ RS_RET_INVLD_TIME = -2107, /**< invalid timestamp (e.g. could not be parsed) */
RS_RET_CODE_ERR = -2109, /**< program code (internal) error */
/* RainerScript error messages (range 1000.. 1999) */
diff --git a/runtime/var.c b/runtime/var.c
index f964874..ef7cc8e 100644
--- a/runtime/var.c
+++ b/runtime/var.c
@@ -29,6 +29,7 @@
*/
#include "config.h"
+#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -89,6 +90,44 @@ CODESTARTobjDebugPrint(var)
ENDobjDebugPrint(var)
+/* This function is similar to DebugPrint, but does not send its output to
+ * the debug log but instead to a caller-provided string. The idea here is that
+ * we can use this string to get a textual representation of a variable.
+ * Among others, this is useful for creating testbenches, our first use case for
+ * it. Here, it enables simple comparison of the resulting program to a
+ * reference program by simple string compare.
+ * Note that the caller must initialize the string object. We always add
+ * data to it. So, it can be easily combined into a chain of methods
+ * to generate the final string.
+ * rgerhards, 2008-07-07
+ */
+static rsRetVal
+Obj2Str(var_t *pThis, cstr_t *pstrPrg)
+{
+ DEFiRet;
+ size_t lenBuf;
+ uchar szBuf[2048];
+
+ ISOBJ_TYPE_assert(pThis, var);
+ assert(pstrPrg != NULL);
+ switch(pThis->varType) {
+ case VARTYPE_STR:
+ lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "%s[cstr]", rsCStrGetSzStr(pThis->val.pStr));
+ break;
+ case VARTYPE_NUMBER:
+ lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "%lld[nbr]", pThis->val.num);
+ break;
+ default:
+ lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "**UNKNOWN**[%d]", pThis->varType);
+ break;
+ }
+ CHKiRet(rsCStrAppendStrWithLen(pstrPrg, szBuf, lenBuf));
+
+finalize_it:
+ RETiRet;
+}
+
+
/* duplicates a var instance
* rgerhards, 2008-02-25
*/
@@ -387,6 +426,7 @@ CODESTARTobjQueryInterface(var)
pIf->ConstructFinalize = varConstructFinalize;
pIf->Destruct = varDestruct;
pIf->DebugPrint = varDebugPrint;
+ pIf->Obj2Str = Obj2Str;
pIf->SetNumber = varSetNumber;
pIf->SetString = varSetString;
pIf->ConvForOperation = ConvForOperation;
diff --git a/runtime/var.h b/runtime/var.h
index bbe7ba3..6d890ec 100644
--- a/runtime/var.h
+++ b/runtime/var.h
@@ -59,6 +59,7 @@ BEGINinterface(var) /* name must also be changed in ENDinterface macro! */
rsRetVal (*ConvToNumber)(var_t *pThis);
rsRetVal (*ConvToBool)(var_t *pThis);
rsRetVal (*ConvToString)(var_t *pThis);
+ rsRetVal (*Obj2Str)(var_t *pThis, cstr_t*);
rsRetVal (*Duplicate)(var_t *pThis, var_t **ppNew);
ENDinterface(var)
#define varCURR_IF_VERSION 1 /* increment whenever you change the interface above! */
diff --git a/runtime/vmop.c b/runtime/vmop.c
index 219315c..fcacb15 100644
--- a/runtime/vmop.c
+++ b/runtime/vmop.c
@@ -25,6 +25,7 @@
*/
#include "config.h"
+#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -81,6 +82,39 @@ CODESTARTobjDebugPrint(vmop)
ENDobjDebugPrint(vmop)
+/* This function is similar to DebugPrint, but does not send its output to
+ * the debug log but instead to a caller-provided string. The idea here is that
+ * we can use this string to get a textual representation of an operation.
+ * Among others, this is useful for creating testbenches, our first use case for
+ * it. Here, it enables simple comparison of the resulting program to a
+ * reference program by simple string compare.
+ * Note that the caller must initialize the string object. We always add
+ * data to it. So, it can be easily combined into a chain of methods
+ * to generate the final string.
+ * rgerhards, 2008-07-04
+ */
+static rsRetVal
+Obj2Str(vmop_t *pThis, cstr_t *pstrPrg)
+{
+ uchar *pOpcodeName;
+ uchar szBuf[2048];
+ size_t lenBuf;
+ DEFiRet;
+
+ ISOBJ_TYPE_assert(pThis, vmop);
+ assert(pstrPrg != NULL);
+ vmopOpcode2Str(pThis, &pOpcodeName);
+ lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "%s\t", pOpcodeName);
+ CHKiRet(rsCStrAppendStrWithLen(pstrPrg, szBuf, lenBuf));
+ if(pThis->operand.pVar != NULL)
+ CHKiRet(var.Obj2Str(pThis->operand.pVar, pstrPrg));
+ CHKiRet(rsCStrAppendChar(pstrPrg, '\n'));
+
+finalize_it:
+ RETiRet;
+}
+
+
/* set operand (variant case)
* rgerhards, 2008-02-20
*/
@@ -206,8 +240,6 @@ CODESTARTobjQueryInterface(vmop)
* work here (if we can support an older interface version - that,
* of course, also affects the "if" above).
*/
- //xxxpIf->oID = OBJvmop;
-
pIf->Construct = vmopConstruct;
pIf->ConstructFinalize = vmopConstructFinalize;
pIf->Destruct = vmopDestruct;
@@ -215,6 +247,7 @@ CODESTARTobjQueryInterface(vmop)
pIf->SetOpcode = vmopSetOpcode;
pIf->SetVar = vmopSetVar;
pIf->Opcode2Str = vmopOpcode2Str;
+ pIf->Obj2Str = Obj2Str;
finalize_it:
ENDobjQueryInterface(vmop)
diff --git a/runtime/vmop.h b/runtime/vmop.h
index 97f924d..c3d5d5f 100644
--- a/runtime/vmop.h
+++ b/runtime/vmop.h
@@ -26,6 +26,7 @@
#define INCLUDED_VMOP_H
#include "ctok_token.h"
+#include "stringbuf.h"
/* machine instructions types */
typedef enum { /* do NOT start at 0 to detect uninitialized types after calloc() */
@@ -83,6 +84,7 @@ BEGINinterface(vmop) /* name must also be changed in ENDinterface macro! */
rsRetVal (*SetOpcode)(vmop_t *pThis, opcode_t opcode);
rsRetVal (*SetVar)(vmop_t *pThis, var_t *pVar);
rsRetVal (*Opcode2Str)(vmop_t *pThis, uchar **ppName);
+ rsRetVal (*Obj2Str)(vmop_t *pThis, cstr_t *pstr);
ENDinterface(vmop)
#define vmopCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
diff --git a/runtime/vmprg.c b/runtime/vmprg.c
index a2b744d..705e694 100644
--- a/runtime/vmprg.c
+++ b/runtime/vmprg.c
@@ -24,12 +24,14 @@
*/
#include "config.h"
+#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "rsyslog.h"
#include "obj.h"
#include "vmprg.h"
+#include "stringbuf.h"
/* static data */
DEFobjStaticHelpers
@@ -79,6 +81,40 @@ CODESTARTobjDebugPrint(vmprg)
ENDobjDebugPrint(vmprg)
+/* This function is similar to DebugPrint, but does not send its output to
+ * the debug log but instead to a caller-provided string. The idea here is that
+ * we can use this string to get a textual representation of a bytecode program.
+ * Among others, this is useful for creating testbenches, our first use case for
+ * it. Here, it enables simple comparison of the resulting program to a
+ * reference program by simple string compare.
+ * Note that the caller must initialize the string object. We always add
+ * data to it. So, it can be easily combined into a chain of methods
+ * to generate the final string.
+ * rgerhards, 2008-07-04
+ */
+static rsRetVal
+Obj2Str(vmprg_t *pThis, cstr_t *pstrPrg)
+{
+ uchar szAddr[12];
+ vmop_t *pOp;
+ int i;
+ int lenAddr;
+ DEFiRet;
+
+ ISOBJ_TYPE_assert(pThis, vmprg);
+ assert(pstrPrg != NULL);
+ i = 0; /* "program counter" */
+ for(pOp = pThis->vmopRoot ; pOp != NULL ; pOp = pOp->pNext) {
+ lenAddr = snprintf((char*)szAddr, sizeof(szAddr), "%8.8d: ", i++);
+ CHKiRet(rsCStrAppendStrWithLen(pstrPrg, szAddr, lenAddr));
+ vmop.Obj2Str(pOp, pstrPrg);
+ }
+
+finalize_it:
+ RETiRet;
+}
+
+
/* add an operation (instruction) to the end of the current program. This
* function is expected to be called while creating the program, but never
* again after this is done and it is being executed. Results are undefined if
@@ -146,12 +182,11 @@ CODESTARTobjQueryInterface(vmprg)
* work here (if we can support an older interface version - that,
* of course, also affects the "if" above).
*/
- //xxxpIf->oID = OBJvmprg;
-
pIf->Construct = vmprgConstruct;
pIf->ConstructFinalize = vmprgConstructFinalize;
pIf->Destruct = vmprgDestruct;
pIf->DebugPrint = vmprgDebugPrint;
+ pIf->Obj2Str = Obj2Str;
pIf->AddOperation = vmprgAddOperation;
pIf->AddVarOperation = vmprgAddVarOperation;
finalize_it:
diff --git a/runtime/vmprg.h b/runtime/vmprg.h
index db1f62f..c1042f7 100644
--- a/runtime/vmprg.h
+++ b/runtime/vmprg.h
@@ -38,7 +38,7 @@
#define INCLUDED_VMPRG_H
#include "vmop.h"
-
+#include "stringbuf.h"
/* the vmprg object */
typedef struct vmprg_s {
@@ -56,6 +56,7 @@ BEGINinterface(vmprg) /* name must also be changed in ENDinterface macro! */
rsRetVal (*Destruct)(vmprg_t **ppThis);
rsRetVal (*AddOperation)(vmprg_t *pThis, vmop_t *pOp);
rsRetVal (*AddVarOperation)(vmprg_t *pThis, opcode_t opcode, var_t *pVar);
+ rsRetVal (*Obj2Str)(vmprg_t *pThis, cstr_t *pstr);
ENDinterface(vmprg)
#define vmprgCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
diff --git a/runtime/wti.c b/runtime/wti.c
index a253149..343a722 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -113,6 +113,9 @@ wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bActiveOnly, int bLockMutex)
wtiGetDbgHdr(pThis), tCmd, pThis->tCurrCmd);
} else {
dbgprintf("%s: receiving command %d\n", wtiGetDbgHdr(pThis), tCmd);
+ /* we could replace this with a simple if, but we leave the switch in in case we need
+ * to add something at a later stage. -- rgerhards, 2008-09-30
+ */
switch(tCmd) {
case eWRKTHRD_TERMINATING:
/* TODO: re-enable meaningful debug msg! (via function callback?)
@@ -123,10 +126,8 @@ wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bActiveOnly, int bLockMutex)
pthread_cond_signal(&pThis->condExitDone);
dbgprintf("%s: worker terminating\n", wtiGetDbgHdr(pThis));
break;
- case eWRKTHRD_RUNNING:
- pthread_cond_signal(&pThis->condInitDone);
- break;
/* these cases just to satisfy the compiler, we do (yet) not act an them: */
+ case eWRKTHRD_RUNNING:
case eWRKTHRD_STOPPED:
case eWRKTHRD_RUN_CREATED:
case eWRKTHRD_RUN_INIT:
@@ -190,7 +191,6 @@ CODESTARTobjDestruct(wti)
d_pthread_mutex_unlock(&pThis->mut);
/* actual destruction */
- pthread_cond_destroy(&pThis->condInitDone);
pthread_cond_destroy(&pThis->condExitDone);
pthread_mutex_destroy(&pThis->mut);
@@ -202,7 +202,6 @@ ENDobjDestruct(wti)
/* Standard-Constructor for the wti object
*/
BEGINobjConstruct(wti) /* be sure to specify the object type also in END macro! */
- pthread_cond_init(&pThis->condInitDone, NULL);
pthread_cond_init(&pThis->condExitDone, NULL);
pthread_mutex_init(&pThis->mut, NULL);
ENDobjConstruct(wti)
diff --git a/runtime/wti.h b/runtime/wti.h
index b3d9247..0cd6744 100644
--- a/runtime/wti.h
+++ b/runtime/wti.h
@@ -35,7 +35,6 @@ typedef struct wti_s {
qWrkCmd_t tCurrCmd; /* current command to be carried out by worker */
obj_t *pUsrp; /* pointer to an object meaningful for current user pointer (e.g. queue pUsr data elemt) */
wtp_t *pWtp; /* my worker thread pool (important if only the work thread instance is passed! */
- pthread_cond_t condInitDone; /* signaled when the thread startup is done (once per thread existance) */
pthread_cond_t condExitDone; /* signaled when the thread exit is done (once per thread existance) */
pthread_mutex_t mut;
int bShutdownRqtd; /* shutdown for this thread requested? 0 - no , 1 - yes */
diff --git a/runtime/wtp.c b/runtime/wtp.c
index 3e3ff09..3beae27 100644
--- a/runtime/wtp.c
+++ b/runtime/wtp.c
@@ -171,7 +171,9 @@ wtpWakeupAllWrkr(wtp_t *pThis)
DEFiRet;
ISOBJ_TYPE_assert(pThis, wtp);
+ d_pthread_mutex_lock(pThis->pmutUsr);
pthread_cond_broadcast(pThis->pcondBusy);
+ d_pthread_mutex_unlock(pThis->pmutUsr);
RETiRet;
}
@@ -324,11 +326,12 @@ wtpShutdownAll(wtp_t *pThis, wtpState_t tShutdownCmd, struct timespec *ptTimeout
rsRetVal wtpSignalWrkrTermination(wtp_t *pThis)
{
DEFiRet;
- /* I leave the mutex code here out as it give as deadlocks. I think it is not really
+ /* I leave the mutex code here out as it gives us deadlocks. I think it is not really
* needed and we are on the safe side. I leave this comment in if practice proves us
- * wrong. The whole thing should be removed after half a your or year if we see there
+ * wrong. The whole thing should be removed after half a year or year if we see there
* actually is no issue (or revisit it from a theoretical POV).
* rgerhards, 2008-01-28
+ * revisited 2008-09-30, still a bit unclear, leave in
*/
/*TODO: mutex or not mutex, that's the question ;)DEFVARS_mutexProtection;*/
diff --git a/tcps_sess.c b/tcps_sess.c
index b93bb11..f5420fc 100644
--- a/tcps_sess.c
+++ b/tcps_sess.c
@@ -46,19 +46,24 @@
/* static data */
DEFobjStaticHelpers
+DEFobjCurrIf(glbl)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(netstrm)
+static int iMaxLine; /* maximum size of a single message */
+
/* forward definitions */
static rsRetVal Close(tcps_sess_t *pThis);
-/* Standard-Constructor
- */
+/* Standard-Constructor */
BEGINobjConstruct(tcps_sess) /* be sure to specify the object type also in END macro! */
pThis->iMsg = 0; /* just make sure... */
pThis->bAtStrtOfFram = 1; /* indicate frame header expected */
pThis->eFraming = TCP_FRAMING_OCTET_STUFFING; /* just make sure... */
+ /* now allocate the message reception buffer */
+ CHKmalloc(pThis->pMsg = (uchar*) malloc(sizeof(uchar) * iMaxLine + 1));
+finalize_it:
ENDobjConstruct(tcps_sess)
@@ -92,6 +97,8 @@ CODESTARTobjDestruct(tcps_sess)
free(pThis->fromHost);
if(pThis->fromHostIP != NULL)
free(pThis->fromHostIP);
+ if(pThis->pMsg != NULL)
+ free(pThis->pMsg);
ENDobjDestruct(tcps_sess)
@@ -222,7 +229,8 @@ PrepareClose(tcps_sess_t *pThis)
* this case.
*/
dbgprintf("Extra data at end of stream in legacy syslog/tcp message - processing\n");
- parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->msg, pThis->iMsg, MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY);
+ parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->pMsg, pThis->iMsg, MSG_PARSE_HOSTNAME,
+ NOFLAG, eFLOWCTL_LIGHT_DELAY, NULL); /* TODO: add real InputName */
pThis->bAtStrtOfFram = 1;
}
@@ -288,23 +296,24 @@ processDataRcvd(tcps_sess_t *pThis, char c)
dbgprintf("Framing Error: invalid octet count\n");
errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: "
"invalid octet count %d.\n", pThis->iOctetsRemain);
- } else if(pThis->iOctetsRemain > MAXLINE) {
+ } else if(pThis->iOctetsRemain > iMaxLine) {
/* while we can not do anything against it, we can at least log an indication
* that something went wrong) -- rgerhards, 2008-03-14
*/
- dbgprintf("truncating message with %d octets - MAXLINE is %d\n",
- pThis->iOctetsRemain, MAXLINE);
+ dbgprintf("truncating message with %d octets - max msg size is %d\n",
+ pThis->iOctetsRemain, iMaxLine);
errmsg.LogError(0, NO_ERRCODE, "received oversize message: size is %d bytes, "
- "MAXLINE is %d, truncating...\n", pThis->iOctetsRemain, MAXLINE);
+ "max msg size is %d, truncating...\n", pThis->iOctetsRemain, iMaxLine);
}
pThis->inputState = eInMsg;
}
} else {
assert(pThis->inputState == eInMsg);
- if(pThis->iMsg >= MAXLINE) {
+ if(pThis->iMsg >= iMaxLine) {
/* emergency, we now need to flush, no matter if we are at end of message or not... */
- dbgprintf("error: message received is larger than MAXLINE, we split it\n");
- parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->msg, pThis->iMsg, MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY);
+ dbgprintf("error: message received is larger than max msg size, we split it\n");
+ parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->pMsg, pThis->iMsg,
+ MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY, NULL); /* TODO: add real InputName */
pThis->iMsg = 0;
/* we might think if it is better to ignore the rest of the
* message than to treat it as a new one. Maybe this is a good
@@ -314,16 +323,17 @@ processDataRcvd(tcps_sess_t *pThis, char c)
}
if(c == '\n' && pThis->eFraming == TCP_FRAMING_OCTET_STUFFING) { /* record delemiter? */
- parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->msg, pThis->iMsg, MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY);
+ parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->pMsg, pThis->iMsg,
+ MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY, NULL); /* TODO: add real InputName */
pThis->iMsg = 0;
pThis->inputState = eAtStrtFram;
} else {
/* IMPORTANT: here we copy the actual frame content to the message - for BOTH framing modes!
- * If we have a message that is larger than MAXLINE, we truncate it. This is the best
+ * If we have a message that is larger than the max msg size, we truncate it. This is the best
* we can do in light of what the engine supports. -- rgerhards, 2008-03-14
*/
- if(pThis->iMsg < MAXLINE) {
- *(pThis->msg + pThis->iMsg++) = c;
+ if(pThis->iMsg < iMaxLine) {
+ *(pThis->pMsg + pThis->iMsg++) = c;
}
}
@@ -332,7 +342,8 @@ processDataRcvd(tcps_sess_t *pThis, char c)
pThis->iOctetsRemain--;
if(pThis->iOctetsRemain < 1) {
/* we have end of frame! */
- parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->msg, pThis->iMsg, MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY);
+ parseAndSubmitMessage(pThis->fromHost, pThis->fromHostIP, pThis->pMsg, pThis->iMsg,
+ MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_LIGHT_DELAY, NULL); /* TODO: add real InputName */
pThis->iMsg = 0;
pThis->inputState = eAtStrtFram;
}
@@ -430,6 +441,10 @@ BEGINObjClassInit(tcps_sess, 1, OBJ_IS_CORE_MODULE) /* class, version - CHANGE c
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(netstrm, LM_NETSTRMS_FILENAME));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
+ iMaxLine = glbl.GetMaxLine(); /* get maximum size we currently support */
+ objRelease(glbl, CORE_COMPONENT);
+
/* set our own handlers */
OBJSetMethodHandler(objMethod_DEBUGPRINT, tcps_sessDebugPrint);
OBJSetMethodHandler(objMethod_CONSTRUCTION_FINALIZER, tcps_sessConstructFinalize);
diff --git a/tcps_sess.h b/tcps_sess.h
index ff7c167..576466f 100644
--- a/tcps_sess.h
+++ b/tcps_sess.h
@@ -42,7 +42,7 @@ typedef struct tcps_sess_s {
} inputState; /* our current state */
int iOctetsRemain; /* Number of Octets remaining in message */
TCPFRAMINGMODE eFraming;
- uchar msg[MAXLINE+1];
+ uchar *pMsg; /* message (fragment) received */
uchar *fromHost;
uchar *fromHostIP;
void *pUsr; /* a user-pointer */
diff --git a/tcpsrv.c b/tcpsrv.c
index 85b3494..107d03f 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -1,8 +1,7 @@
/* tcpsrv.c
*
* Common code for plain TCP based servers. This is currently being
- * utilized by imtcp and imgssapi. I suspect that when we implement
- * SSL/TLS, that module could also use tcpsrv.
+ * utilized by imtcp and imgssapi.
*
* There are actually two classes within the tcpserver code: one is
* the tcpsrv itself, the other one is its sessions. This is a helper
@@ -456,7 +455,7 @@ Run(tcpsrv_t *pThis)
while(nfds && iTCPSess != -1) {
CHKiRet(nssel.IsReady(pSel, pThis->pSessions[iTCPSess]->pStrm, NSDSEL_RD, &bIsReady, &nfds));
if(bIsReady) {
- char buf[MAXLINE];
+ char buf[8*1024]; /* reception buffer - may hold a partial or multiple messages */
dbgprintf("netstream %p with new data\n", pThis->pSessions[iTCPSess]->pStrm);
/* Receive message */
@@ -703,6 +702,20 @@ SetDrvrPermPeers(tcpsrv_t *pThis, permittedPeers_t *pPermPeers)
* -------------------------------------------------------------------------- */
+/* set max number of sessions
+ * this must be called before ConstructFinalize, or it will have no effect!
+ * rgerhards, 2009-04-09
+ */
+static rsRetVal
+SetSessMax(tcpsrv_t *pThis, int iMax)
+{
+ DEFiRet;
+ ISOBJ_TYPE_assert(pThis, tcpsrv);
+ pThis->iSessMax = iMax;
+ RETiRet;
+}
+
+
/* queryInterface function
* rgerhards, 2008-02-29
*/
@@ -728,6 +741,7 @@ CODESTARTobjQueryInterface(tcpsrv)
pIf->Run = Run;
pIf->SetUsrP = SetUsrP;
+ pIf->SetSessMax = SetSessMax;
pIf->SetDrvrMode = SetDrvrMode;
pIf->SetDrvrAuthMode = SetDrvrAuthMode;
pIf->SetDrvrPermPeers = SetDrvrPermPeers;
diff --git a/tcpsrv.h b/tcpsrv.h
index 0111086..280f508 100644
--- a/tcpsrv.h
+++ b/tcpsrv.h
@@ -79,8 +79,10 @@ BEGINinterface(tcpsrv) /* name must also be changed in ENDinterface macro! */
rsRetVal (*SetCBOnSessAccept)(tcpsrv_t*, rsRetVal (*) (tcpsrv_t*, tcps_sess_t*));
rsRetVal (*SetCBOnSessDestruct)(tcpsrv_t*, rsRetVal (*) (void*));
rsRetVal (*SetCBOnSessConstructFinalize)(tcpsrv_t*, rsRetVal (*) (void*));
+ /* added v4 */
+ rsRetVal (*SetSessMax)(tcpsrv_t *pThis, int iMaxSess); /* 2009-04-09 */
ENDinterface(tcpsrv)
-#define tcpsrvCURR_IF_VERSION 3 /* increment whenever you change the interface structure! */
+#define tcpsrvCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */
/* prototypes */
diff --git a/template.c b/template.c
index 936ccd0..6fb7ba2 100644
--- a/template.c
+++ b/template.c
@@ -607,6 +607,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* now we fall through the "regular" FromPos code */
#endif /* #ifdef FEATURE_REGEXP */
if(*p == 'F') {
+ pTpe->data.field.field_expand = 0;
/* we have a field counter, so indicate it in the template */
++p; /* eat 'F' */
if (*p == ':') {
@@ -634,7 +635,11 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
pTpe->data.field.field_delim = 9;
} else {
pTpe->data.field.field_delim = iNum;
+ if (*p == '+') {
+ pTpe->data.field.field_expand = 1;
+ p ++;
}
+ }
}
} else {
/* invalid character after F, so we need to reject
diff --git a/template.h b/template.h
index 318f3f3..04137b0 100644
--- a/template.h
+++ b/template.h
@@ -85,6 +85,8 @@ struct templateEntry {
#endif
unsigned has_fields; /* support for field-counting: field to extract */
unsigned char field_delim; /* support for field-counting: field delemiter char */
+ int field_expand; /* use multiple instances of the field delimiter as a single one? */
+
enum tplFormatTypes eDateFormat;
enum tplFormatCaseConvTypes eCaseConv;
struct { /* bit fields! */
diff --git a/tests/1.rstest b/tests/1.rstest
new file mode 100644
index 0000000..5c15258
--- /dev/null
+++ b/tests/1.rstest
@@ -0,0 +1,26 @@
+# a simple RainerScript test
+result: 0
+in:
+'test 1' <> $var or /* some comment */($SEVERITY == -4 +5 -(3 * - 2) and $fromhost == '127.0.0.1') then
+$$$
+out:
+00000000: PUSHCONSTANT test 1[cstr]
+00000001: PUSHMSGVAR var[cstr]
+00000002: !=
+00000003: PUSHMSGVAR severity[cstr]
+00000004: PUSHCONSTANT 4[nbr]
+00000005: UNARY_MINUS
+00000006: PUSHCONSTANT 5[nbr]
+00000007: +
+00000008: PUSHCONSTANT 3[nbr]
+00000009: PUSHCONSTANT 2[nbr]
+00000010: UNARY_MINUS
+00000011: *
+00000012: -
+00000013: ==
+00000014: PUSHMSGVAR fromhost[cstr]
+00000015: PUSHCONSTANT 127.0.0.1[cstr]
+00000016: ==
+00000017: and
+00000018: or
+$$$
diff --git a/tests/2.rstest b/tests/2.rstest
new file mode 100644
index 0000000..7fb5b79
--- /dev/null
+++ b/tests/2.rstest
@@ -0,0 +1,10 @@
+# a simple RainerScript test
+result: 0
+in:
+$msg contains 'test' then
+$$$
+out:
+00000000: PUSHMSGVAR msg[cstr]
+00000001: PUSHCONSTANT test[cstr]
+00000002: contains
+$$$
diff --git a/tests/DevNull.cfgtest b/tests/DevNull.cfgtest
new file mode 100644
index 0000000..d30d936
--- /dev/null
+++ b/tests/DevNull.cfgtest
@@ -0,0 +1,3 @@
+rsyslogd: CONFIG ERROR: there are no active actions configured. Inputs will run, but no output whatsoever is created. [try http://www.rsyslog.com/e/2103 ]
+rsyslogd: EMERGENCY CONFIGURATION ACTIVATED - fix rsyslog config file!
+rsyslogd: End of config validation run. Bye.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d85a56f..14e7c19 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,14 +1,29 @@
-check_PROGRAMS = rt_init rscript_parse
-TESTS = $(check_PROGRAMS)
+check_PROGRAMS = rt_init rscript
+TESTS = $(check_PROGRAMS) cfg.sh
+TESTS_ENVIRONMENT = RSYSLOG_MODDIR='$(abs_top_builddir)'/runtime/.libs/
+#TESTS = $(check_PROGRAMS)
test_files = testbench.h runtime-dummy.c
+EXTRA_DIST=1.rstest 2.rstest err1.rstest \
+ cfg.sh \
+ cfg1.cfgtest \
+ cfg1.testin \
+ cfg2.cfgtest \
+ cfg2.testin \
+ cfg3.cfgtest \
+ cfg3.testin \
+ cfg4.cfgtest \
+ cfg4.testin \
+ DevNull.cfgtest \
+ err1.rstest \
+ NoExistFile.cfgtest
rt_init_SOURCES = rt-init.c $(test_files)
-rt_init_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
-rt_init_LDADD = $(rsrt_libs) $(zlib_libs) $(pthreads_libs)
+rt_init_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rt_init_LDADD = $(RSRT_LIBS) $(ZLIB_LIBS) $(PTHREADS_LIBS)
rt_init_LDFLAGS = -export-dynamic
-rscript_parse_SOURCES = rscript-parse.c $(test_files)
-rscript_parse_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
-rscript_parse_LDADD = $(rsrt_libs) $(zlib_libs) $(pthreads_libs)
-rscript_parse_LDFLAGS = -export-dynamic
+rscript_SOURCES = rscript.c $(test_files)
+rscript_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rscript_LDADD = $(RSRT_LIBS) $(ZLIB_LIBS) $(PTHREADS_LIBS)
+rscript_LDFLAGS = -export-dynamic
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3f87fd4..77239c5 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -31,26 +31,26 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = rt_init$(EXEEXT) rscript_parse$(EXEEXT)
+check_PROGRAMS = rt_init$(EXEEXT) rscript$(EXEEXT)
subdir = tests
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-am__objects_1 = rscript_parse-runtime-dummy.$(OBJEXT)
-am_rscript_parse_OBJECTS = rscript_parse-rscript-parse.$(OBJEXT) \
- $(am__objects_1)
-rscript_parse_OBJECTS = $(am_rscript_parse_OBJECTS)
+am__objects_1 = rscript-runtime-dummy.$(OBJEXT)
+am_rscript_OBJECTS = rscript-rscript.$(OBJEXT) $(am__objects_1)
+rscript_OBJECTS = $(am_rscript_OBJECTS)
am__DEPENDENCIES_1 =
-rscript_parse_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-rscript_parse_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(rscript_parse_LDFLAGS) $(LDFLAGS) -o $@
+rscript_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+rscript_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(rscript_LDFLAGS) \
+ $(LDFLAGS) -o $@
am__objects_2 = rt_init-runtime-dummy.$(OBJEXT)
am_rt_init_OBJECTS = rt_init-rt-init.$(OBJEXT) $(am__objects_2)
rt_init_OBJECTS = $(am_rt_init_OBJECTS)
@@ -71,8 +71,8 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(rscript_parse_SOURCES) $(rt_init_SOURCES)
-DIST_SOURCES = $(rscript_parse_SOURCES) $(rt_init_SOURCES)
+SOURCES = $(rscript_SOURCES) $(rt_init_SOURCES)
+DIST_SOURCES = $(rscript_SOURCES) $(rt_init_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -95,6 +95,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -104,8 +105,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -114,6 +117,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -123,6 +128,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -132,15 +139,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -162,13 +179,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -178,49 +191,52 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
-TESTS = $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS) cfg.sh
+TESTS_ENVIRONMENT = RSYSLOG_MODDIR='$(abs_top_builddir)'/runtime/.libs/
+#TESTS = $(check_PROGRAMS)
test_files = testbench.h runtime-dummy.c
+EXTRA_DIST = 1.rstest 2.rstest err1.rstest \
+ cfg.sh \
+ cfg1.cfgtest \
+ cfg1.testin \
+ cfg2.cfgtest \
+ cfg2.testin \
+ cfg3.cfgtest \
+ cfg3.testin \
+ cfg4.cfgtest \
+ cfg4.testin \
+ DevNull.cfgtest \
+ err1.rstest \
+ NoExistFile.cfgtest
+
rt_init_SOURCES = rt-init.c $(test_files)
-rt_init_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
-rt_init_LDADD = $(rsrt_libs) $(zlib_libs) $(pthreads_libs)
+rt_init_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rt_init_LDADD = $(RSRT_LIBS) $(ZLIB_LIBS) $(PTHREADS_LIBS)
rt_init_LDFLAGS = -export-dynamic
-rscript_parse_SOURCES = rscript-parse.c $(test_files)
-rscript_parse_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
-rscript_parse_LDADD = $(rsrt_libs) $(zlib_libs) $(pthreads_libs)
-rscript_parse_LDFLAGS = -export-dynamic
+rscript_SOURCES = rscript.c $(test_files)
+rscript_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rscript_LDADD = $(RSRT_LIBS) $(ZLIB_LIBS) $(PTHREADS_LIBS)
+rscript_LDFLAGS = -export-dynamic
all: all-am
.SUFFIXES:
@@ -261,9 +277,9 @@ clean-checkPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-rscript_parse$(EXEEXT): $(rscript_parse_OBJECTS) $(rscript_parse_DEPENDENCIES)
- @rm -f rscript_parse$(EXEEXT)
- $(rscript_parse_LINK) $(rscript_parse_OBJECTS) $(rscript_parse_LDADD) $(LIBS)
+rscript$(EXEEXT): $(rscript_OBJECTS) $(rscript_DEPENDENCIES)
+ @rm -f rscript$(EXEEXT)
+ $(rscript_LINK) $(rscript_OBJECTS) $(rscript_LDADD) $(LIBS)
rt_init$(EXEEXT): $(rt_init_OBJECTS) $(rt_init_DEPENDENCIES)
@rm -f rt_init$(EXEEXT)
$(rt_init_LINK) $(rt_init_OBJECTS) $(rt_init_LDADD) $(LIBS)
@@ -274,8 +290,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rscript_parse-rscript-parse.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rscript_parse-runtime-dummy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rscript-rscript.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rscript-runtime-dummy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_init-rt-init.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_init-runtime-dummy.Po@am__quote@
@@ -300,33 +316,33 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-rscript_parse-rscript-parse.o: rscript-parse.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript_parse-rscript-parse.o -MD -MP -MF $(DEPDIR)/rscript_parse-rscript-parse.Tpo -c -o rscript_parse-rscript-parse.o `test -f 'rscript-parse.c' || echo '$(srcdir)/'`rscript-parse.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript_parse-rscript-parse.Tpo $(DEPDIR)/rscript_parse-rscript-parse.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rscript-parse.c' object='rscript_parse-rscript-parse.o' libtool=no @AMDEPBACKSLASH@
+rscript-rscript.o: rscript.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript-rscript.o -MD -MP -MF $(DEPDIR)/rscript-rscript.Tpo -c -o rscript-rscript.o `test -f 'rscript.c' || echo '$(srcdir)/'`rscript.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript-rscript.Tpo $(DEPDIR)/rscript-rscript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rscript.c' object='rscript-rscript.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript_parse-rscript-parse.o `test -f 'rscript-parse.c' || echo '$(srcdir)/'`rscript-parse.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript-rscript.o `test -f 'rscript.c' || echo '$(srcdir)/'`rscript.c
-rscript_parse-rscript-parse.obj: rscript-parse.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript_parse-rscript-parse.obj -MD -MP -MF $(DEPDIR)/rscript_parse-rscript-parse.Tpo -c -o rscript_parse-rscript-parse.obj `if test -f 'rscript-parse.c'; then $(CYGPATH_W) 'rscript-parse.c'; else $(CYGPATH_W) '$(srcdir)/rscript-parse.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript_parse-rscript-parse.Tpo $(DEPDIR)/rscript_parse-rscript-parse.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rscript-parse.c' object='rscript_parse-rscript-parse.obj' libtool=no @AMDEPBACKSLASH@
+rscript-rscript.obj: rscript.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript-rscript.obj -MD -MP -MF $(DEPDIR)/rscript-rscript.Tpo -c -o rscript-rscript.obj `if test -f 'rscript.c'; then $(CYGPATH_W) 'rscript.c'; else $(CYGPATH_W) '$(srcdir)/rscript.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript-rscript.Tpo $(DEPDIR)/rscript-rscript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rscript.c' object='rscript-rscript.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript_parse-rscript-parse.obj `if test -f 'rscript-parse.c'; then $(CYGPATH_W) 'rscript-parse.c'; else $(CYGPATH_W) '$(srcdir)/rscript-parse.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript-rscript.obj `if test -f 'rscript.c'; then $(CYGPATH_W) 'rscript.c'; else $(CYGPATH_W) '$(srcdir)/rscript.c'; fi`
-rscript_parse-runtime-dummy.o: runtime-dummy.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript_parse-runtime-dummy.o -MD -MP -MF $(DEPDIR)/rscript_parse-runtime-dummy.Tpo -c -o rscript_parse-runtime-dummy.o `test -f 'runtime-dummy.c' || echo '$(srcdir)/'`runtime-dummy.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript_parse-runtime-dummy.Tpo $(DEPDIR)/rscript_parse-runtime-dummy.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime-dummy.c' object='rscript_parse-runtime-dummy.o' libtool=no @AMDEPBACKSLASH@
+rscript-runtime-dummy.o: runtime-dummy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript-runtime-dummy.o -MD -MP -MF $(DEPDIR)/rscript-runtime-dummy.Tpo -c -o rscript-runtime-dummy.o `test -f 'runtime-dummy.c' || echo '$(srcdir)/'`runtime-dummy.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript-runtime-dummy.Tpo $(DEPDIR)/rscript-runtime-dummy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime-dummy.c' object='rscript-runtime-dummy.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript_parse-runtime-dummy.o `test -f 'runtime-dummy.c' || echo '$(srcdir)/'`runtime-dummy.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript-runtime-dummy.o `test -f 'runtime-dummy.c' || echo '$(srcdir)/'`runtime-dummy.c
-rscript_parse-runtime-dummy.obj: runtime-dummy.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript_parse-runtime-dummy.obj -MD -MP -MF $(DEPDIR)/rscript_parse-runtime-dummy.Tpo -c -o rscript_parse-runtime-dummy.obj `if test -f 'runtime-dummy.c'; then $(CYGPATH_W) 'runtime-dummy.c'; else $(CYGPATH_W) '$(srcdir)/runtime-dummy.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript_parse-runtime-dummy.Tpo $(DEPDIR)/rscript_parse-runtime-dummy.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime-dummy.c' object='rscript_parse-runtime-dummy.obj' libtool=no @AMDEPBACKSLASH@
+rscript-runtime-dummy.obj: runtime-dummy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rscript-runtime-dummy.obj -MD -MP -MF $(DEPDIR)/rscript-runtime-dummy.Tpo -c -o rscript-runtime-dummy.obj `if test -f 'runtime-dummy.c'; then $(CYGPATH_W) 'runtime-dummy.c'; else $(CYGPATH_W) '$(srcdir)/runtime-dummy.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rscript-runtime-dummy.Tpo $(DEPDIR)/rscript-runtime-dummy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime-dummy.c' object='rscript-runtime-dummy.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_parse_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript_parse-runtime-dummy.obj `if test -f 'runtime-dummy.c'; then $(CYGPATH_W) 'runtime-dummy.c'; else $(CYGPATH_W) '$(srcdir)/runtime-dummy.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rscript_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rscript-runtime-dummy.obj `if test -f 'runtime-dummy.c'; then $(CYGPATH_W) 'runtime-dummy.c'; else $(CYGPATH_W) '$(srcdir)/runtime-dummy.c'; fi`
rt_init-rt-init.o: rt-init.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(rt_init_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rt_init-rt-init.o -MD -MP -MF $(DEPDIR)/rt_init-rt-init.Tpo -c -o rt_init-rt-init.o `test -f 'rt-init.c' || echo '$(srcdir)/'`rt-init.c
diff --git a/tests/NoExistFile.cfgtest b/tests/NoExistFile.cfgtest
new file mode 100644
index 0000000..4cbcc02
--- /dev/null
+++ b/tests/NoExistFile.cfgtest
@@ -0,0 +1,3 @@
+rsyslogd: CONFIG ERROR: could not interpret master config file '/This/does/not/exist'. [try http://www.rsyslog.com/e/2013 ]
+rsyslogd: EMERGENCY CONFIGURATION ACTIVATED - fix rsyslog config file!
+rsyslogd: End of config validation run. Bye.
diff --git a/tests/cfg.sh b/tests/cfg.sh
new file mode 100755
index 0000000..9972982
--- /dev/null
+++ b/tests/cfg.sh
@@ -0,0 +1,139 @@
+# /bin/bash
+# This is a simple shell script that carries out some checks against
+# configurations we expect from some provided config files. We use
+# rsyslogd's verifcation function. Note that modifications to the
+# config elements, or even simple text changes, cause these checks to
+# fail. However, it should be fairly easy to adapt them to the changed
+# environment. And while nothing changed, they permit is to make sure
+# that everything works well and is not broken by interim changes.
+# Note that we always compare starting with the second output line.
+# This is because the first line contains the rsyslog version ;)
+# rgerhards, 2008-07-29
+#
+# Part of the testbench for rsyslog.
+#
+# Copyright 2008 Rainer Gerhards and Adiscon GmbH.
+#
+# This file is part of rsyslog.
+#
+# Rsyslog is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rsyslog is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+#
+# A copy of the GPL can be found in the file "COPYING" in this distribution.
+#set -x
+rm -f tmp
+echo "local directory"
+#
+# check empty config file
+#
+../tools/rsyslogd -c3 -N1 -f/dev/null 2>&1 |tail --lines=+2 > tmp
+cmp tmp $srcdir/DevNull.cfgtest
+if [ ! $? -eq 0 ]; then
+echo "DevNull.cfgtest failed"
+echo "Expected:"
+cat $srcdir/DevNull.cfgtest
+echo "Received:"
+cat tmp
+exit 1
+else
+echo "DevNull.cfgtest succeeded"
+fi;
+#
+# check missing config file
+#
+../tools/rsyslogd -c3 -N1 -f/This/does/not/exist 2>&1 |tail --lines=+2 > tmp
+cmp tmp $srcdir/NoExistFile.cfgtest
+if [ ! $? -eq 0 ]; then
+echo "NoExistFile.cfgtest failed"
+echo "Expected:"
+cat $srcdir/NoExistFile.cfgtest
+echo "Received:"
+cat tmp
+exit 1
+else
+echo "NoExistFile.cfgtest succeeded"
+fi;
+
+
+# TODO: re-enable the following checks. They need to have support in
+# rsyslogd so that the log file name is NOT contained in the error
+# messages - this prevents proper comparison in make distcheck
+rm -f tmp
+exit 0
+
+#
+# check config with invalid directive
+#
+../tools/rsyslogd -c3 -u2 -N1 -f$srcdir/cfg1.testin 2>&1 |tail --lines=+2 > tmp
+cmp tmp $srcdir/cfg1.cfgtest
+if [ ! $? -eq 0 ]; then
+echo "cfg1.cfgtest failed"
+echo "Expected:"
+cat $srcdir/cfg1.cfgtest
+echo "Received:"
+cat tmp
+exit 1
+else
+echo "cfg1.cfgtest succeeded"
+fi;
+#
+# now check for included config file. We use a sample similar to
+# the one with the invalid config directive, so that we may see
+# an effect of the included config ;)
+#
+../tools/rsyslogd -c3 -u2 -N1 -f$srcdir/cfg2.testin 2>&1 |tail --lines=+2 > tmp
+cmp tmp $srcdir/cfg2.cfgtest
+if [ ! $? -eq 0 ]; then
+echo "cfg2.cfgtest failed"
+echo "Expected:"
+cat $srcdir/cfg2.cfgtest
+echo "Received:"
+cat tmp
+exit 1
+else
+echo "cfg2.cfgtest succeeded"
+fi;
+#
+# check included config file, where included file does not exist
+#
+../tools/rsyslogd -c3 -u2 -N1 -f$srcdir/cfg3.testin 2>&1 |tail --lines=+2 > tmp
+cmp tmp $srcdir/cfg3.cfgtest
+if [ ! $? -eq 0 ]; then
+echo "cfg3.cfgtest failed"
+echo "Expected:"
+cat $srcdir/cfg3.cfgtest
+echo "Received:"
+cat tmp
+exit 1
+else
+echo "cfg3.cfgtest succeeded"
+fi;
+#
+# check a reasonable complex, but correct, log file
+#
+../tools/rsyslogd -c3 -u2 -N1 -f$srcdir/cfg4.testin 2>&1 |tail --lines=+2 > tmp
+cmp tmp $srcdir/cfg4.cfgtest
+if [ ! $? -eq 0 ]; then
+echo "cfg4.cfgtest failed"
+echo "Expected:"
+cat $srcdir/cfg4.cfgtest
+echo "Received:"
+cat tmp
+exit 1
+else
+echo "cfg4.cfgtest succeeded"
+fi;
+#
+# done, some cleanup
+#
+rm -f tmp
diff --git a/tests/cfg1.cfgtest b/tests/cfg1.cfgtest
new file mode 100644
index 0000000..099ba92
--- /dev/null
+++ b/tests/cfg1.cfgtest
@@ -0,0 +1,3 @@
+rsyslogd: invalid or yet-unknown config file command - have you forgotten to load a module? [try http://www.rsyslog.com/e/3003 ]
+rsyslogd: the last error occured in ./cfg1.testin, line 2
+rsyslogd: End of config validation run. Bye.
diff --git a/tests/cfg1.testin b/tests/cfg1.testin
new file mode 100644
index 0000000..7d7b594
--- /dev/null
+++ b/tests/cfg1.testin
@@ -0,0 +1,2 @@
+*.* *
+$invaliddirective test
diff --git a/tests/cfg2.cfgtest b/tests/cfg2.cfgtest
new file mode 100644
index 0000000..b44a487
--- /dev/null
+++ b/tests/cfg2.cfgtest
@@ -0,0 +1,3 @@
+rsyslogd: invalid or yet-unknown config file command - have you forgotten to load a module? [try http://www.rsyslog.com/e/3003 ]
+rsyslogd: the last error occured in cfg1.testin, line 2
+rsyslogd: End of config validation run. Bye.
diff --git a/tests/cfg2.testin b/tests/cfg2.testin
new file mode 100644
index 0000000..b6d98c8
--- /dev/null
+++ b/tests/cfg2.testin
@@ -0,0 +1 @@
+$includeconfig cfg1.testin
diff --git a/tests/cfg3.cfgtest b/tests/cfg3.cfgtest
new file mode 100644
index 0000000..68bc17d
--- /dev/null
+++ b/tests/cfg3.cfgtest
@@ -0,0 +1,5 @@
+rsyslogd: error accessing config file or directory 'file-does-not-exist': No such file or directory [try http://www.rsyslog.com/e/2040 ]
+rsyslogd: the last error occured in ./cfg3.testin, line 1
+rsyslogd: CONFIG ERROR: there are no active actions configured. Inputs will run, but no output whatsoever is created. [try http://www.rsyslog.com/e/2103 ]
+rsyslogd: EMERGENCY CONFIGURATION ACTIVATED - fix rsyslog config file!
+rsyslogd: End of config validation run. Bye.
diff --git a/tests/cfg3.testin b/tests/cfg3.testin
new file mode 100644
index 0000000..9789d93
--- /dev/null
+++ b/tests/cfg3.testin
@@ -0,0 +1 @@
+$includeconfig file-does-not-exist
diff --git a/tests/cfg4.cfgtest b/tests/cfg4.cfgtest
new file mode 100644
index 0000000..04acf84
--- /dev/null
+++ b/tests/cfg4.cfgtest
@@ -0,0 +1 @@
+rsyslogd: End of config validation run. Bye.
diff --git a/tests/cfg4.testin b/tests/cfg4.testin
new file mode 100644
index 0000000..a49c0fb
--- /dev/null
+++ b/tests/cfg4.testin
@@ -0,0 +1,67 @@
+# This is more or less the sample config, but without imklog being
+# active. imklog must not always be present and as such may spoil
+# our testing result. The core point at this test is that a valid
+# config file should not lead to any error messages.
+# It may be a good idea to update this file from time to time, so that
+# it contains a reasonable complex config sample.
+
+# if you experience problems, check
+# http://www.rsyslog.com/troubleshoot for assistance
+
+# rsyslog v3: load input modules
+# If you do not load inputs, nothing happens!
+# You may need to set the module load path if modules are not found.
+
+#$ModLoad immark # provides --MARK-- message capability
+#$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
+#$ModLoad imklog # kernel logging (formerly provided by rklogd)
+
+# Log all kernel messages to the console.
+# Logging much else clutters up the screen.
+#kern.* /dev/console
+
+# Log anything (except mail) of level info or higher.
+# Don't log private authentication messages!
+*.info;mail.none;authpriv.none;cron.none -/var/log/messages
+
+# The authpriv file has restricted access.
+authpriv.* /var/log/secure
+
+# Log all the mail messages in one place.
+mail.* -/var/log/maillog
+
+
+# Log cron stuff
+cron.* -/var/log/cron
+
+# Everybody gets emergency messages
+*.emerg *
+
+# Save news errors of level crit and higher in a special file.
+uucp,news.crit -/var/log/spooler
+
+# Save boot messages also to boot.log
+local7.* /var/log/boot.log
+
+# Remote Logging (we use TCP for reliable delivery)
+# An on-disk queue is created for this action. If the remote host is
+# down, messages are spooled to disk and sent when it is up again.
+#$WorkDirectory /rsyslog/spool # where to place spool files
+#$ActionQueueFileName uniqName # unique name prefix for spool files
+#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
+#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
+#$ActionQueueType LinkedList # run asynchronously
+#$ActionResumeRetryCount -1 # infinite retries if host is down
+# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
+#*.* @@remote-host:514
+
+
+# ######### Receiving Messages from Remote Hosts ##########
+# TCP Syslog Server:
+# provides TCP syslog reception and GSS-API (if compiled to support it)
+#$ModLoad imtcp.so # load module
+#$InputTCPServerRun 514 # start up TCP listener at port 514
+
+# UDP Syslog Server:
+#$ModLoad imudp.so # provides UDP syslog reception
+#$UDPServerRun 514 # start a UDP syslog server at standard port 514
diff --git a/tests/err1.rstest b/tests/err1.rstest
new file mode 100644
index 0000000..8c56887
--- /dev/null
+++ b/tests/err1.rstest
@@ -0,0 +1,7 @@
+# This test case check for an error condition
+result: -2051
+in:
+'test 1' <> == $hostname
+$$$
+out:
+$$$
diff --git a/tests/rscript-parse.c b/tests/rscript-parse.c
deleted file mode 100644
index 176f3f7..0000000
--- a/tests/rscript-parse.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* This test checks runtime initialization and exit. Other than that, it
- * also serves as the most simplistic sample of how a test can be coded.
- *
- * Part of the testbench for rsyslog.
- * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
- *
- * This file is part of rsyslog.
- *
- * Rsyslog is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rsyslog is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
- *
- * A copy of the GPL can be found in the file "COPYING" in this distribution.
- */
-#include <stdio.h>
-
-#include "rsyslog.h"
-#include "testbench.h"
-#include "ctok.h"
-#include "expr.h"
-
-MODULE_TYPE_TESTBENCH
-/* define addtional objects we need for our tests */
-DEFobjCurrIf(expr)
-DEFobjCurrIf(ctok)
-DEFobjCurrIf(ctok_token)
-
-BEGINInit
-CODESTARTInit
- pErrObj = "expr"; CHKiRet(objUse(expr, CORE_COMPONENT));
- pErrObj = "ctok"; CHKiRet(objUse(ctok, CORE_COMPONENT));
- pErrObj = "ctok_token"; CHKiRet(objUse(ctok_token, CORE_COMPONENT));
-ENDInit
-
-BEGINExit
-CODESTARTExit
-ENDExit
-
-BEGINTest
- ctok_t *tok;
- ctok_token_t *pToken;
- expr_t *pExpr;
- /* the string below is an expression as defined up to 3.19.x - note that the
- * then and the space after it MUST be present!
- */
- uchar szExpr[] = " $msg contains 'test' then ";
- /*uchar szSynErr[] = "$msg == 1 and syntaxerror ";*/
-CODESTARTTest
- /* we first need a tokenizer... */
- CHKiRet(ctok.Construct(&tok));
- CHKiRet(ctok.Setpp(tok, szExpr));
- CHKiRet(ctok.ConstructFinalize(tok));
-
- /* now construct our expression */
- CHKiRet(expr.Construct(&pExpr));
- CHKiRet(expr.ConstructFinalize(pExpr));
-
- /* ready to go... */
- CHKiRet(expr.Parse(pExpr, tok));
-
- /* we now need to parse off the "then" - and note an error if it is
- * missing...
- *
- * rgerhards, 2008-07-01: we disable the check below, because I can not
- * find the cause of the misalignment. The problem is that pToken structure has
- * a different member alignment inside the runtime library then inside of
- * this program. I checked compiler options, but could not find the cause.
- * Should anyone have any insight, I'd really appreciate if you drop me
- * a line.
- */
-#if 0
- CHKiRet(ctok.GetToken(tok, &pToken));
- if(pToken->tok != ctok_THEN) {
-//printf("invalid token, probably due to invalid alignment between runtime lib and this program\n");
- ctok_token.Destruct(&pToken);
- ABORT_FINALIZE(RS_RET_SYNTAX_ERROR);
- }
-
- ctok_token.Destruct(&pToken); /* no longer needed */
-#endif
-
- /* we are done, so we now need to restore things */
- CHKiRet(ctok.Destruct(&tok));
-finalize_it:
- /* here we may do custom error reporting */
- if(iRet != RS_RET_OK) {
- uchar *pp;
- ctok.Getpp(tok, &pp);
- printf("error on or before '%s'\n", pp);
- }
-ENDTest
diff --git a/tests/rscript.c b/tests/rscript.c
new file mode 100644
index 0000000..d4e8cae
--- /dev/null
+++ b/tests/rscript.c
@@ -0,0 +1,259 @@
+/* This test checks runtime initialization and exit. Other than that, it
+ * also serves as the most simplistic sample of how a test can be coded.
+ *
+ * Part of the testbench for rsyslog.
+ *
+ * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+#include "config.h"
+#include <stdio.h>
+#include <glob.h>
+#include <sys/stat.h>
+
+#include "rsyslog.h"
+#include "testbench.h"
+#include "ctok.h"
+#include "expr.h"
+
+MODULE_TYPE_TESTBENCH
+/* define addtional objects we need for our tests */
+DEFobjCurrIf(expr)
+DEFobjCurrIf(ctok)
+DEFobjCurrIf(ctok_token)
+DEFobjCurrIf(vmprg)
+
+BEGINInit
+CODESTARTInit
+ pErrObj = "expr"; CHKiRet(objUse(expr, CORE_COMPONENT));
+ pErrObj = "ctok"; CHKiRet(objUse(ctok, CORE_COMPONENT));
+ pErrObj = "ctok_token"; CHKiRet(objUse(ctok_token, CORE_COMPONENT));
+ pErrObj = "vmprg"; CHKiRet(objUse(vmprg, CORE_COMPONENT));
+ENDInit
+
+BEGINExit
+CODESTARTExit
+ENDExit
+
+
+/* perform a single test. This involves compiling the test script,
+ * checking the result of the compilation (iRet) and a check of the
+ * generated program (via a simple strcmp). The resulting program
+ * check is only done if the test should not detect a syntax error
+ * (for obvious reasons, there is no point in checking the result of
+ * a failed compilation).
+ * rgerhards, 2008-07--07
+ */
+static rsRetVal
+PerformTest(cstr_t *pstrIn, rsRetVal iRetExpected, cstr_t *pstrOut)
+{
+ cstr_t *pstrPrg = NULL;
+ ctok_t *tok = NULL;
+ ctok_token_t *pToken = NULL;
+ expr_t *pExpr;
+ rsRetVal localRet;
+ DEFiRet;
+
+ /* we first need a tokenizer... */
+ CHKiRet(ctok.Construct(&tok));
+ CHKiRet(ctok.Setpp(tok, rsCStrGetSzStr(pstrIn)));
+ CHKiRet(ctok.ConstructFinalize(tok));
+
+ /* now construct our expression */
+ CHKiRet(expr.Construct(&pExpr));
+ CHKiRet(expr.ConstructFinalize(pExpr));
+
+ /* ready to go... */
+ localRet = expr.Parse(pExpr, tok);
+
+ /* check if we expected an error */
+ if(localRet != iRetExpected) {
+ printf("Error in compile return code. Expected %d, received %d\n",
+ iRetExpected, localRet);
+ CHKiRet(rsCStrConstruct(&pstrPrg));
+ CHKiRet(vmprg.Obj2Str(pExpr->pVmprg, pstrPrg));
+ printf("generated vmprg:\n%s\n", rsCStrGetSzStr(pstrPrg));
+ ABORT_FINALIZE(iRetExpected == RS_RET_OK ? localRet : RS_RET_ERR);
+ }
+
+ if(iRetExpected != RS_RET_OK)
+ FINALIZE; /* if we tested an error case, we are done */
+
+ /* OK, we got a compiled program, so now let's compare that */
+
+ CHKiRet(rsCStrConstruct(&pstrPrg));
+ CHKiRet(vmprg.Obj2Str(pExpr->pVmprg, pstrPrg));
+
+ if(strcmp((char*)rsCStrGetSzStr(pstrPrg), (char*)rsCStrGetSzStr(pstrOut))) {
+ printf("error: compiled program different from expected result!\n");
+ printf("generated vmprg:\n%s\n", rsCStrGetSzStr(pstrPrg));
+ printf("expected:\n%s\n", rsCStrGetSzStr(pstrOut));
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
+finalize_it:
+ /* we are done, so we now need to restore things */
+ if(pToken != NULL)
+ ctok_token.Destruct(&pToken); /* no longer needed */
+ if(pstrPrg != NULL)
+ rsCStrDestruct(&pstrPrg);
+ if(tok != NULL)
+ ctok.Destruct(&tok);
+ RETiRet;
+}
+
+
+/* a helper macro to generate some often-used code... */
+#define CHKEOF \
+ if(feof(fp)) { \
+ printf("error: unexpected end of control file %s\n", pszFileName); \
+ ABORT_FINALIZE(RS_RET_ERR); \
+ }
+/* process a single test file
+ * Note that we do not do a real parser here. The effort is not
+ * justified by what we need to do. So it is a quick shot.
+ * rgerhards, 2008-07-07
+ */
+static rsRetVal
+ProcessTestFile(uchar *pszFileName)
+{
+ FILE *fp;
+ char *lnptr = NULL;
+ size_t lenLn;
+ cstr_t *pstrIn = NULL;
+ cstr_t *pstrOut = NULL;
+ rsRetVal iRetExpected;
+ DEFiRet;
+
+ if((fp = fopen((char*)pszFileName, "r")) == NULL) {
+ perror((char*)pszFileName);
+ ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND);
+ }
+
+ /* skip comments at start of file */
+
+ getline(&lnptr, &lenLn, fp);
+ while(!feof(fp)) {
+ if(*lnptr == '#')
+ getline(&lnptr, &lenLn, fp);
+ else
+ break; /* first non-comment */
+ }
+ CHKEOF;
+
+ /* once we had a comment, the next line MUST be "result: <nbr>". Anything
+ * after nbr is simply ignored.
+ */
+ if(sscanf(lnptr, "result: %d", &iRetExpected) != 1) {
+ printf("error in result line, scanf failed, line: '%s'\n", lnptr);
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+ getline(&lnptr, &lenLn, fp); CHKEOF;
+
+ /* and now we look for "in:" (and again ignore the rest...) */
+ if(strncmp(lnptr, "in:", 3)) {
+ printf("error: expected 'in:'-line, but got: '%s'\n", lnptr);
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+ /* if we reach this point, we need to read in the input script. It is
+ * terminated by a line with three sole $ ($$$\n)
+ */
+ CHKiRet(rsCStrConstruct(&pstrIn));
+ getline(&lnptr, &lenLn, fp); CHKEOF;
+ while(strncmp(lnptr, "$$$\n", 4)) {
+ CHKiRet(rsCStrAppendStr(pstrIn, (uchar*)lnptr));
+ getline(&lnptr, &lenLn, fp); CHKEOF;
+ }
+ getline(&lnptr, &lenLn, fp); CHKEOF; /* skip $$$-line */
+
+ /* and now we look for "out:" (and again ignore the rest...) */
+ if(strncmp(lnptr, "out:", 4)) {
+ printf("error: expected 'out:'-line, but got: '%s'\n", lnptr);
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+ /* if we reach this point, we need to read in the expected program code. It is
+ * terminated by a line with three sole $ ($$$\n)
+ */
+ CHKiRet(rsCStrConstruct(&pstrOut));
+ getline(&lnptr, &lenLn, fp); CHKEOF;
+ while(strncmp(lnptr, "$$$\n", 4)) {
+ CHKiRet(rsCStrAppendStr(pstrOut, (uchar*)lnptr));
+ getline(&lnptr, &lenLn, fp); CHKEOF;
+ }
+
+ /* un-comment for testing:
+ * printf("iRet: %d, script: %s\n, out: %s\n", iRetExpected, rsCStrGetSzStr(pstrIn),rsCStrGetSzStr(pstrOut));
+ */
+ if(rsCStrGetSzStr(pstrIn) == NULL) {
+ printf("error: input script is empty!\n");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+ if(rsCStrGetSzStr(pstrOut) == NULL && iRetExpected == RS_RET_OK) {
+ printf("error: output script is empty!\n");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
+ CHKiRet(PerformTest(pstrIn, iRetExpected, pstrOut));
+
+finalize_it:
+ if(pstrIn != NULL)
+ rsCStrDestruct(&pstrIn);
+ if(pstrOut != NULL)
+ rsCStrDestruct(&pstrOut);
+ RETiRet;
+}
+
+
+/* This test is parameterized. It search for test control files and
+ * loads all that it finds. To add tests, simply create new .rstest
+ * files.
+ * rgerhards, 2008-07-07
+ */
+BEGINTest
+ uchar *testFile;
+ glob_t testFiles;
+ size_t i = 0;
+ struct stat fileInfo;
+CODESTARTTest
+ glob("*.rstest", GLOB_MARK, NULL, &testFiles);
+
+ for(i = 0; i < testFiles.gl_pathc; i++) {
+ testFile = (uchar*) testFiles.gl_pathv[i];
+
+ if(stat((char*) testFile, &fileInfo) != 0)
+ continue; /* continue with the next file if we can't stat() the file */
+
+ /* all regular files are run through the test logic. Symlinks don't work. */
+ if(S_ISREG(fileInfo.st_mode)) { /* config file */
+ printf("processing RainerScript test file '%s'...\n", testFile);
+ iRet = ProcessTestFile((uchar*) testFile);
+ if(iRet != RS_RET_OK) {
+ /* in this case, re-run with debugging on */
+ printf("processing test case failed with %d, re-running with debug messages:\n",
+ iRet);
+ Debug = 1; /* these two are dirty, but we need them today... */
+ debugging_on = 1;
+ CHKiRet(ProcessTestFile((uchar*) testFile));
+ }
+ }
+ }
+ globfree(&testFiles);
+
+finalize_it:
+ENDTest
diff --git a/tests/testbench.h b/tests/testbench.h
index 6f26724..1268774 100644
--- a/tests/testbench.h
+++ b/tests/testbench.h
@@ -40,7 +40,8 @@ int main(int __attribute__((unused)) argc, char __attribute__((unused)) *argv[])
CHKiRet(doTest()); \
CHKiRet(doExit()); \
finalize_it: \
- printf("test returns iRet %d\n", iRet); \
+ if(iRet != RS_RET_OK) \
+ printf("test returns iRet %d\n", iRet); \
RETiRet; \
}
diff --git a/tools/Makefile.am b/tools/Makefile.am
index b2b7a8c..582ad9e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -21,9 +21,13 @@ rsyslogd_SOURCES = \
pidfile.h \
\
../dirty.h
-
-rsyslogd_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
-rsyslogd_LDADD = $(zlib_libs) $(pthreads_libs) $(rsrt_libs)
+rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rsyslogd_LDADD = $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS)
rsyslogd_LDFLAGS = -export-dynamic
+if ENABLE_DIAGTOOLS
+sbin_PROGRAMS += rsyslog_diag_hostname
+rsyslog_diag_hostname_SOURCES = gethostn.c
+endif
+
EXTRA_DIST = $(man_MANS)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 2634a53..6eda1f9 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -32,20 +32,28 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-sbin_PROGRAMS = rsyslogd$(EXEEXT)
+sbin_PROGRAMS = rsyslogd$(EXEEXT) $(am__EXEEXT_1)
+@ENABLE_DIAGTOOLS_TRUE@am__append_1 = rsyslog_diag_hostname
subdir = tools
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+@ENABLE_DIAGTOOLS_TRUE@am__EXEEXT_1 = rsyslog_diag_hostname$(EXEEXT)
am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" \
"$(DESTDIR)$(man8dir)"
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(sbin_PROGRAMS)
+am__rsyslog_diag_hostname_SOURCES_DIST = gethostn.c
+@ENABLE_DIAGTOOLS_TRUE@am_rsyslog_diag_hostname_OBJECTS = \
+@ENABLE_DIAGTOOLS_TRUE@ gethostn.$(OBJEXT)
+rsyslog_diag_hostname_OBJECTS = $(am_rsyslog_diag_hostname_OBJECTS)
+rsyslog_diag_hostname_LDADD = $(LDADD)
am_rsyslogd_OBJECTS = rsyslogd-syslogd.$(OBJEXT) \
rsyslogd-omshell.$(OBJEXT) rsyslogd-omusrmsg.$(OBJEXT) \
rsyslogd-omfwd.$(OBJEXT) rsyslogd-omfile.$(OBJEXT) \
@@ -70,8 +78,9 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(rsyslogd_SOURCES)
-DIST_SOURCES = $(rsyslogd_SOURCES)
+SOURCES = $(rsyslog_diag_hostname_SOURCES) $(rsyslogd_SOURCES)
+DIST_SOURCES = $(am__rsyslog_diag_hostname_SOURCES_DIST) \
+ $(rsyslogd_SOURCES)
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
NROFF = nroff
@@ -98,6 +107,7 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
@@ -107,8 +117,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
-HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@
+GSS_LIBS = @GSS_LIBS@
HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
INSTALL = @INSTALL@
@@ -117,6 +129,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
+LIBDBI_LIBS = @LIBDBI_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
LIBOBJS = @LIBOBJS@
@@ -126,6 +140,8 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -135,15 +151,25 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
+PTHREADS_LIBS = @PTHREADS_LIBS@
RANLIB = @RANLIB@
RELP_CFLAGS = @RELP_CFLAGS@
RELP_LIBS = @RELP_LIBS@
+RSRT_CFLAGS = @RSRT_CFLAGS@
+RSRT_LIBS = @RSRT_LIBS@
+RT_LIBS = @RT_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
STRIP = @STRIP@
VERSION = @VERSION@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -165,13 +191,9 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-dl_libs = @dl_libs@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-gnutls_cflags = @gnutls_cflags@
-gnutls_libs = @gnutls_libs@
-gss_libs = @gss_libs@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -181,39 +203,26 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-libdbi_cflags = @libdbi_cflags@
-libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-mysql_cflags = @mysql_cflags@
-mysql_libs = @mysql_libs@
+moddirs = @moddirs@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-pgsql_cflags = @pgsql_cflags@
-pgsql_libs = @pgsql_libs@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-pthreads_cflags = @pthreads_cflags@
-pthreads_libs = @pthreads_libs@
-rsrt_cflags = @rsrt_cflags@
-rsrt_libs = @rsrt_libs@
-rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-snmp_cflags = @snmp_cflags@
-snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-zlib_libs = @zlib_libs@
man_MANS = rsyslogd.8 rsyslog.conf.5
rsyslogd_SOURCES = \
syslogd.c \
@@ -235,9 +244,10 @@ rsyslogd_SOURCES = \
\
../dirty.h
-rsyslogd_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags)
-rsyslogd_LDADD = $(zlib_libs) $(pthreads_libs) $(rsrt_libs)
+rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rsyslogd_LDADD = $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS)
rsyslogd_LDFLAGS = -export-dynamic
+@ENABLE_DIAGTOOLS_TRUE@rsyslog_diag_hostname_SOURCES = gethostn.c
EXTRA_DIST = $(man_MANS)
all: all-am
@@ -300,6 +310,9 @@ clean-sbinPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
+rsyslog_diag_hostname$(EXEEXT): $(rsyslog_diag_hostname_OBJECTS) $(rsyslog_diag_hostname_DEPENDENCIES)
+ @rm -f rsyslog_diag_hostname$(EXEEXT)
+ $(LINK) $(rsyslog_diag_hostname_OBJECTS) $(rsyslog_diag_hostname_LDADD) $(LIBS)
rsyslogd$(EXEEXT): $(rsyslogd_OBJECTS) $(rsyslogd_DEPENDENCIES)
@rm -f rsyslogd$(EXEEXT)
$(rsyslogd_LINK) $(rsyslogd_OBJECTS) $(rsyslogd_LDADD) $(LIBS)
@@ -310,6 +323,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gethostn.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsyslogd-iminternal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsyslogd-omdiscard.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsyslogd-omfile.Po@am__quote@
diff --git a/tools/gethostn.c b/tools/gethostn.c
new file mode 100644
index 0000000..df7ce38
--- /dev/null
+++ b/tools/gethostn.c
@@ -0,0 +1,47 @@
+/* gethostn - a small diagnostic utility to show what the
+ * gethostname() API returns. Of course, this tool duplicates
+ * functionality already found in other tools. But the point is
+ * that the API shall be called by a program that is compiled like
+ * rsyslogd and does exactly what rsyslog does.
+ *
+ * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int __attribute__((unused)) argc, char __attribute__((unused)) *argv[])
+{
+ char hostname[4096]; /* this should always be sufficient ;) */
+ int err;
+
+ err = gethostname(hostname, sizeof(hostname));
+
+ if(err) {
+ perror("gethostname failed");
+ exit(1);
+ }
+
+ printf("hostname of this system is '%s'.\n", hostname);
+
+ return 0;
+}
diff --git a/tools/iminternal.c b/tools/iminternal.c
index 60460a9..0ceff3d 100644
--- a/tools/iminternal.c
+++ b/tools/iminternal.c
@@ -185,6 +185,5 @@ rsRetVal modExitIminternal(void)
RETiRet;
}
-/*
- * vi:set ai:
+/* vim:set ai:
*/
diff --git a/tools/omfile.c b/tools/omfile.c
index d76e24a..5e0f849 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -74,7 +74,7 @@ typedef struct s_dynaFileCacheEntry dynaFileCacheEntry;
/* globals for default values */
static int iDynaFileCacheSize = 10; /* max cache for dynamic files */
static int fCreateMode = 0644; /* mode to use when creating files */
-static int fDirCreateMode = 0644; /* mode to use when creating files */
+static int fDirCreateMode = 0700; /* mode to use when creating files */
static int bFailOnChown; /* fail if chown fails? */
static uid_t fileUID; /* UID to be used for newly created files */
static uid_t fileGID; /* GID to be used for newly created files */
@@ -803,7 +803,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
bFailOnChown = 1;
iDynaFileCacheSize = 10;
fCreateMode = 0644;
- fDirCreateMode = 0644;
+ fDirCreateMode = 0700;
bCreateDirs = 1;
bEnableSync = 0;
if(pszTplName != NULL) {
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 1b617ee..1dd184e 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -386,16 +386,19 @@ ENDtryResume
BEGINdoAction
char *psz; /* temporary buffering */
register unsigned l;
+ int iMaxLine;
CODESTARTdoAction
CHKiRet(doTryResume(pData));
+ iMaxLine = glbl.GetMaxLine();
+
dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdPt(pData),
pData->protocol == FORW_UDP ? "udp" : "tcp");
psz = (char*) ppString[0];
l = strlen((char*) psz);
- if (l > MAXLINE)
- l = MAXLINE;
+ if((int) l > iMaxLine)
+ l = iMaxLine;
# ifdef USE_NETZIP
/* Check if we should compress and, if so, do it. We also
@@ -407,10 +410,14 @@ CODESTARTdoAction
* rgerhards, 2006-11-30
*/
if(pData->compressionLevel && (l > MIN_SIZE_FOR_COMPRESS)) {
- Bytef out[MAXLINE+MAXLINE/100+12] = "z";
+ Bytef *out;
uLongf destLen = sizeof(out) / sizeof(Bytef);
uLong srcLen = l;
int ret;
+ /* TODO: optimize malloc sequence? -- rgerhards, 2008-09-02 */
+ CHKmalloc(out = (Bytef*) malloc(iMaxLine + iMaxLine/100 + 12));
+ out[0] = 'z';
+ out[1] = '\0';
ret = compress2((Bytef*) out+1, &destLen, (Bytef*) psz,
srcLen, pData->compressionLevel);
dbgprintf("Compressing message, length was %d now %d, return state %d.\n",
@@ -509,6 +516,9 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* applies to TCP-based syslog only and is ignored when specified with UDP).
* That is not yet implemented.
* rgerhards, 2006-12-07
+ * In order to support IPv6 addresses, we must introduce an extension to
+ * the hostname. If it is in square brackets, whatever is in them is treated as
+ * the hostname - without any exceptions ;) -- rgerhards, 2008-08-05
*/
if(*p == '(') {
/* at this position, it *must* be an option indicator */
@@ -555,6 +565,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
*/
errmsg.LogError(0, NO_ERRCODE, "Option block not terminated in forwarding action.");
}
+
/* extract the host first (we do a trick - we replace the ';' or ':' with a '\0')
* now skip to port and then template name. rgerhards 2005-07-06
*/
@@ -604,6 +615,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
} else {
CHKmalloc(pData->f_hname = strdup((char*) q));
}
+dbgprintf("hostname '%s', port '%s'\n", pData->f_hname, pData->port);
/* process template */
CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,
diff --git a/tools/rsyslogd.8 b/tools/rsyslogd.8
index ecf2635..7abcf97 100644
--- a/tools/rsyslogd.8
+++ b/tools/rsyslogd.8
@@ -1,7 +1,7 @@
.\" Copyright 2004-2008 Rainer Gerhards and Adiscon for the rsyslog modifications
.\" May be distributed under the GNU General Public License
.\"
-.TH RSYSLOGD 8 "11 July 2008" "Version 3.18.0" "Linux System Administration"
+.TH RSYSLOGD 8 "29 July 2008" "Version 3.21.1" "Linux System Administration"
.SH NAME
rsyslogd \- reliable and extended syslogd
.SH SYNOPSIS
@@ -21,12 +21,18 @@ rsyslogd \- reliable and extended syslogd
.I hostlist
]
.RB [ " \-n " ]
+.RB [ " \-N "
+.I level
+]
.br
.RB [ " \-q " ]
.RB [ " \-Q " ]
.RB [ " \-s "
.I domainlist
]
+.RB [ " \-u "
+.I userlevel
+]
.RB [ " \-v " ]
.RB [ " \-w " ]
.RB [ " \-x " ]
@@ -166,6 +172,19 @@ Avoid auto-backgrounding. This is needed especially if the
is started and controlled by
.BR init (8).
.TP
+.B "\-N " "level"
+Do a coNfig check. Do NOT run in regular mode, just check configuration
+file correctness.
+This option is meant to verify a config file. To do so, run rsyslogd
+interactively in foreground, specifying -f <config-file> and -N level.
+The level argument modifies behaviour. Currently, 0 is the same as
+not specifying the -N option at all (so this makes limited sense) and
+1 actually activates the code. Later, higher levels will mean more
+verbosity (this is a forward-compatibility option).
+.B rsyslogd
+is started and controlled by
+.BR init (8).
+.TP
.BI "\-q " "add hostname if DNS fails during ACL processing"
During ACL processing, hostnames are resolved to IP addresses for
performance reasons. If DNS fails during that process, the hostname
@@ -186,6 +205,18 @@ is specified and the host logging resolves to satu.infodrom.north.de
no domain would be cut, you will have to specify two domains like:
.BR "\-s north.de:infodrom.north.de" .
.TP
+.BI "\-u " "userlevel"
+This is a "catch all" option for some very seldomly-used user settings.
+The "userlevel" variable selects multiple things. Add the specific values
+to get the combined effect of them.
+A value of 1 prevents rsyslogd from parsing hostnames and tags inside
+messages.
+A value of 2 prevents rsyslogd from changing to the root directory. This
+is almost never a good idea in production use. This option was introduced
+in support of the internal testbed.
+To combine these two features, use a userlevel of 3 (1+2). Whenever you use
+an -u option, make sure you really understand what you do and why you do it.
+.TP
.B "\-v"
Print version and exit.
.TP
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 2c66daa..b0d6fa2 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -58,34 +58,6 @@
#include "config.h"
#include "rsyslog.h"
-/* change the following setting to e.g. 32768 if you would like to
- * support large message sizes for IHE (32k is the current maximum
- * needed for IHE). I was initially tempted to increase it to 32k,
- * but there is a large memory footprint with the current
- * implementation in rsyslog. This will change as the processing
- * changes, but I have re-set it to 1k, because the vast majority
- * of messages is below that and the memory savings is huge, at
- * least compared to the overall memory footprint.
- *
- * If you intend to receive Windows Event Log data (e.g. via
- * EventReporter - www.eventreporter.com), you might want to
- * increase this number to an even higher value, as event
- * log messages can be very lengthy.
- * rgerhards, 2005-07-05
- *
- * during my recent testing, it showed that 4k seems to be
- * the typical maximum for UDP based syslog. This is a IP stack
- * restriction. Not always ... but very often. If you go beyond
- * that value, be sure to test that rsyslogd actually does what
- * you think it should do ;) Also, it is a good idea to check the
- * doc set for anything on IHE - it most probably has information on
- * message sizes.
- * rgerhards, 2005-08-05
- *
- * I have increased the default message size to 2048 to be in sync
- * with recent IETF syslog standardization efforts.
- * rgerhards, 2006-11-30
- */
#define DEFUPRI (LOG_USER|LOG_NOTICE)
#define TIMERINTVL 30 /* interval for checking flush, mark */
@@ -255,6 +227,7 @@ static int bFinished = 0; /* used by termination signal handler, read-only excep
* is either 0 or the number of the signal that requested the
* termination.
*/
+static int iConfigVerify = 0; /* is this just a config verify run? */
/* Intervals at which we flush out "message repeated" messages,
* in seconds after previous message is logged. After each flush,
@@ -285,6 +258,7 @@ static int bDebugPrintCfSysLineHandlerList = 1;/* output cfsyslinehandler list i
static int bDebugPrintModuleList = 1;/* output module list in debug mode? */
static uchar cCCEscapeChar = '\\';/* character to be used to start an escape sequence for control chars */
static int bEscapeCCOnRcv = 1; /* escape control characters on reception: 0 - no, 1 - yes */
+static int bErrMsgToStderr = 1; /* print error messages to stderr (in addition to everything else)? */
int bReduceRepeatMsgs; /* reduce repeated message - 0 - no, 1 - yes */
int bActExecWhenPrevSusp; /* execute action only when previous one was suspended? */
int iActExecOnceInterval = 0; /* execute action once every nn seconds */
@@ -418,7 +392,7 @@ static void processImInternal(void);
static int usage(void)
{
fprintf(stderr, "usage: rsyslogd [-c<version>] [-46AdnqQvwx] [-l<hostlist>] [-s<domainlist>]\n"
- " [-f<conffile>] [-i<pidfile>] [-M<module load path>]\n"
+ " [-f<conffile>] [-i<pidfile>] [-N<level>] [-M<module load path>]\n"
" [-u<number>]\n"
"To run rsyslogd in native mode, use \"rsyslogd -c3 <other options>\"\n\n"
"For further information see http://www.rsyslog.com/doc\n");
@@ -603,8 +577,14 @@ void untty(void)
* rgerhards, 2008-05-16:
* I added an additional calling parameter (hnameIP) to enable specifying the IP
* of a remote host.
+ *
+ * rgerhards, 2008-09-11:
+ * Interface change: added new parameter "InputName", permits the input to provide
+ * a string that identifies it. May be NULL, but must be a valid char* pointer if
+ * non-NULL.
*/
-rsRetVal printline(uchar *hname, uchar *hnameIP, uchar *msg, int bParseHost, int flags, flowControl_t flowCtlType)
+rsRetVal printline(uchar *hname, uchar *hnameIP, uchar *msg, int bParseHost, int flags, flowControl_t flowCtlType,
+ uchar *pszInputName)
{
DEFiRet;
register uchar *p;
@@ -613,6 +593,8 @@ rsRetVal printline(uchar *hname, uchar *hnameIP, uchar *msg, int bParseHost, int
/* Now it is time to create the message object (rgerhards) */
CHKiRet(msgConstruct(&pMsg));
+ if(pszInputName != NULL)
+ MsgSetInputName(pMsg, (char*) pszInputName);
MsgSetFlowControlType(pMsg, flowCtlType);
MsgSetRawMsg(pMsg, (char*)msg);
@@ -698,18 +680,25 @@ finalize_it:
* rgerhards, 2008-05-16:
* I added an additional calling parameter (hnameIP) to enable specifying the IP
* of a remote host.
+ *
+ * rgerhards, 2008-09-11:
+ * Interface change: added new parameter "InputName", permits the input to provide
+ * a string that identifies it. May be NULL, but must be a valid char* pointer if
+ * non-NULL.
*/
rsRetVal
-parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bParseHost, int flags, flowControl_t flowCtlType)
+parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bParseHost, int flags, flowControl_t flowCtlType,
+ uchar *pszInputName)
{
DEFiRet;
register int iMsg;
uchar *pMsg;
uchar *pData;
uchar *pEnd;
- uchar tmpline[MAXLINE + 1];
+ int iMaxLine;
+ uchar *tmpline = NULL;
# ifdef USE_NETZIP
- uchar deflateBuf[MAXLINE + 1];
+ uchar *deflateBuf = NULL;
uLongf iLenDefBuf;
# endif
@@ -718,6 +707,18 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
assert(msg != NULL);
assert(len >= 0);
+ /* we first allocate work buffers large enough to hold the configured maximum
+ * size of a message. Over time, we should change this to a more optimal way, i.e.
+ * by calling the function with the actual length of the message to be parsed.
+ * rgerhards, 2008-09-02
+ *
+ * TODO: optimize buffer handling */
+ iMaxLine = glbl.GetMaxLine();
+ CHKmalloc(tmpline = malloc(sizeof(uchar) * (iMaxLine + 1)));
+# ifdef USE_NETZIP
+ CHKmalloc(deflateBuf = malloc(sizeof(uchar) * (iMaxLine + 1)));
+# endif
+
/* we first check if we have a NUL character at the very end of the
* message. This seems to be a frequent problem with a number of senders.
* So I have now decided to drop these NULs. However, if they are intentional,
@@ -754,14 +755,14 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
*/
if(len > 0 && *msg == 'z') { /* compressed data present? (do NOT change order if conditions!) */
/* we have compressed data, so let's deflate it. We support a maximum
- * message size of MAXLINE. If it is larger, an error message is logged
+ * message size of iMaxLine. If it is larger, an error message is logged
* and the message is dropped. We do NOT try to decompress larger messages
* as such might be used for denial of service. It might happen to later
* builds that such functionality be added as an optional, operator-configurable
* feature.
*/
int ret;
- iLenDefBuf = MAXLINE;
+ iLenDefBuf = iMaxLine;
ret = uncompress((uchar *) deflateBuf, &iLenDefBuf, (uchar *) msg+1, len-1);
dbgprintf("Compressed message uncompressed with status %d, length: new %ld, old %d.\n",
ret, (long) iLenDefBuf, len-1);
@@ -794,13 +795,13 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
# endif /* ifdef USE_NETZIP */
while(pData < pEnd) {
- if(iMsg >= MAXLINE) {
+ if(iMsg >= iMaxLine) {
/* emergency, we now need to flush, no matter if
* we are at end of message or not...
*/
- if(iMsg == MAXLINE) {
+ if(iMsg == iMaxLine) {
*(pMsg + iMsg) = '\0'; /* space *is* reserved for this! */
- printline(hname, hnameIP, tmpline, bParseHost, flags, flowCtlType);
+ printline(hname, hnameIP, tmpline, bParseHost, flags, flowCtlType, pszInputName);
} else {
/* This case in theory never can happen. If it happens, we have
* a logic error. I am checking for it, because if I would not,
@@ -809,7 +810,7 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
* (I couldn't do any more smart things anyway...).
* rgerhards, 2007-9-20
*/
- dbgprintf("internal error: iMsg > MAXLINE in printchopped()\n");
+ dbgprintf("internal error: iMsg > max msg size in printchopped()\n");
}
FINALIZE; /* in this case, we are done... nothing left we can do */
}
@@ -817,7 +818,7 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
/* changed to the sequence (somewhat) proposed in
* draft-ietf-syslog-protocol-19. rgerhards, 2006-11-30
*/
- if(iMsg + 3 < MAXLINE) { /* do we have space? */
+ if(iMsg + 3 < iMaxLine) { /* do we have space? */
*(pMsg + iMsg++) = cCCEscapeChar;
*(pMsg + iMsg++) = '0';
*(pMsg + iMsg++) = '0';
@@ -837,7 +838,7 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
* we known now what's going on.
* rgerhards, 2007-07-17
*/
- if(iMsg + 3 < MAXLINE) { /* do we have space? */
+ if(iMsg + 3 < iMaxLine) { /* do we have space? */
*(pMsg + iMsg++) = cCCEscapeChar;
*(pMsg + iMsg++) = '0' + ((*pData & 0300) >> 6);
*(pMsg + iMsg++) = '0' + ((*pData & 0070) >> 3);
@@ -852,9 +853,15 @@ parseAndSubmitMessage(uchar *hname, uchar *hnameIP, uchar *msg, int len, int bPa
*(pMsg + iMsg) = '\0'; /* space *is* reserved for this! */
/* typically, we should end up here! */
- printline(hname, hnameIP, tmpline, bParseHost, flags, flowCtlType);
+ printline(hname, hnameIP, tmpline, bParseHost, flags, flowCtlType, pszInputName);
finalize_it:
+ if(tmpline != NULL)
+ free(tmpline);
+# ifdef USE_NETZIP
+ if(deflateBuf != NULL)
+ free(deflateBuf);
+# endif
RETiRet;
}
@@ -867,10 +874,11 @@ rsRetVal
submitErrMsg(int iErr, uchar *msg)
{
DEFiRet;
- iRet = logmsgInternal(iErr, LOG_SYSLOG|LOG_ERR, msg, ADDDATE);
+ iRet = logmsgInternal(iErr, LOG_SYSLOG|LOG_ERR, msg, 0);
RETiRet;
}
+
/* rgerhards 2004-11-09: the following is a function that can be used
* to log a message orginating from the syslogd itself. In sysklogd code,
* this is done by simply calling logmsg(). However, logmsg() is changed in
@@ -888,6 +896,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
DEFiRet;
CHKiRet(msgConstruct(&pMsg));
+ MsgSetInputName(pMsg, "rsyslogd");
MsgSetUxTradMsg(pMsg, (char*)msg);
MsgSetRawMsg(pMsg, (char*)msg);
MsgSetHOSTNAME(pMsg, (char*)glbl.GetLocalHostName());
@@ -906,9 +915,20 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
pMsg->iFacility = LOG_FAC(pri);
pMsg->iSeverity = LOG_PRI(pri);
pMsg->bParseHOSTNAME = 0;
- datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
flags |= INTERNAL_MSG;
+ /* we now check if we should print internal messages out to stderr. This was
+ * suggested by HKS as a way to help people troubleshoot rsyslog configuration
+ * (by running it interactively. This makes an awful lot of sense, so I add
+ * it here. -- rgerhards, 2008-07-28
+ * Note that error messages can not be disable during a config verify. This
+ * permits us to process unmodified config files which otherwise contain a
+ * supressor statement.
+ */
+ if(bErrMsgToStderr || iConfigVerify) {
+ fprintf(stderr, "rsyslogd: %s\n", msg);
+ }
+
if(bHaveMainQueue == 0) { /* not yet in queued mode */
iminternalAddMsg(pri, pMsg, flags);
} else {
@@ -1147,9 +1167,6 @@ processMsg(msg_t *pMsg)
/* The consumer of dequeued messages. This function is called by the
* queue engine on dequeueing of a message. It runs on a SEPARATE
* THREAD.
- * NOTE: Having more than one worker requires guarding of some
- * message object structures and potentially others - need to be checked
- * before we support multiple worker threads on the message queue.
* Please note: the message object is destructed by the queue itself!
*/
static rsRetVal
@@ -1311,14 +1328,14 @@ static int parseRFCSyslogMsg(msg_t *pMsg, int flags)
*/
/* TIMESTAMP */
- if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == FALSE) {
+ if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) {
+ if(flags & IGNDATE) {
+ /* we need to ignore the msg data, so simply copy over reception date */
+ memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime));
+ }
+ } else {
dbgprintf("no TIMESTAMP detected!\n");
bContParse = 0;
- flags |= ADDDATE;
- }
-
- if (flags & ADDDATE) {
- datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
}
/* HOSTNAME */
@@ -1385,21 +1402,25 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
cstr_t *pStrB;
int iCnt;
int bTAGCharDetected;
+ BEGINfunc
assert(pMsg != NULL);
assert(pMsg->pszUxTradMsg != NULL);
p2parse = (char*) pMsg->pszUxTradMsg;
- /* Check to see if msg contains a timestamp. We stary trying with a
- * high-precision one...
+ /* Check to see if msg contains a timestamp. We start by assuming
+ * that the message timestamp is the time of reciption (which we
+ * generated ourselfs and then try to actually find one inside the
+ * message. There we go from high-to low precison and are done
+ * when we find a matching one. -- rgerhards, 2008-09-16
*/
- if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) {
+ if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) {
/* we are done - parse pointer is moved by ParseTIMESTAMP3339 */;
- } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) {
+ } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) {
/* 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 */
++p2parse; /* move over space */
- if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) {
+ if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) {
/* indeed, we got it! */
/* we are done - parse pointer is moved by ParseTIMESTAMP3164 */;
} else {
@@ -1407,19 +1428,12 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
* for this try.
*/
--p2parse;
- flags |= ADDDATE;
}
- } else {
- flags |= ADDDATE;
}
- /* here we need to check if the timestamp is valid. If it is not,
- * we can not continue to parse but must treat the rest as the
- * MSG part of the message (as of RFC 3164).
- * rgerhards 2004-12-03
- */
- if(flags & ADDDATE) {
- datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
+ if(flags & IGNDATE) {
+ /* we need to ignore the msg data, so simply copy over reception date */
+ memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime));
}
/* rgerhards, 2006-03-13: next, we parse the hostname and tag. But we
@@ -1555,6 +1569,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
/* The rest is the actual MSG */
MsgSetMSG(pMsg, p2parse);
+ ENDfunc
return 0; /* all ok */
}
@@ -1667,6 +1682,10 @@ DEFFUNC_llExecFunc(flushRptdMsgsActions)
BEGINfunc
LockObj(pAction);
+ /* TODO: time() performance: the call below could be moved to
+ * the beginn of the llExec(). This makes it slightly less correct, but
+ * in an acceptable way. -- rgerhards, 2008-09-16
+ */
if (pAction->f_prevcount && time(NULL) >= REPEATTIME(pAction)) {
dbgprintf("flush %s: repeated %d times, %d sec.\n",
module.GetStateName(pAction->pMod), pAction->f_prevcount,
@@ -1777,7 +1796,7 @@ void legacyOptsParseTCP(char ch, char *arg)
static char conflict = '\0';
if((conflict == 'g' && ch == 't') || (conflict == 't' && ch == 'g')) {
- fprintf(stderr, "rsyslog: If you want to use both -g and -t, use directives instead, -%c ignored.\n", ch);
+ fprintf(stderr, "rsyslogd: If you want to use both -g and -t, use directives instead, -%c ignored.\n", ch);
return;
} else
conflict = ch;
@@ -1850,16 +1869,24 @@ void legacyOptsParseTCP(char ch, char *arg)
* a minimal delay, but it is much cleaner than the approach of doing everything
* inside the signal handler.
* rgerhards, 2005-10-26
+ * Note: we do not call dbgprintf() as this may cause us to block in case something
+ * with the threading is wrong.
*/
static void doDie(int sig)
{
+# define MSG1 "DoDie called.\n"
+# define MSG2 "DoDie called 5 times - unconditional exit\n"
static int iRetries = 0; /* debug aid */
- printf("DoDie called.\n");
+ if(Debug || NoFork)
+ write(1, MSG1, sizeof(MSG1) - 1);
if(iRetries++ == 4) {
- printf("DoDie called 5 times - unconditional exit\n");
+ if(Debug || NoFork)
+ write(1, MSG2, sizeof(MSG2) - 1);
abort();
}
bFinished = sig;
+# undef MSG1
+# undef MSG2
}
@@ -1916,7 +1943,7 @@ die(int sig)
"\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"]" " exiting on signal %d.",
(int) myPid, sig);
errno = 0;
- logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, ADDDATE);
+ logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, 0);
}
/* drain queue (if configured so) and stop main queue worker thread pool */
@@ -1992,16 +2019,21 @@ static void doexit()
}
-/* set the action resume interval
- */
+/* set the maximum message size */
+static rsRetVal setMaxMsgSize(void __attribute__((unused)) *pVal, int iNewVal)
+{
+ return glbl.SetMaxLine(iNewVal);
+}
+
+
+/* set the action resume interval */
static rsRetVal setActionResumeInterval(void __attribute__((unused)) *pVal, int iNewVal)
{
return actionSetGlobalResumeInterval(iNewVal);
}
-/* set the processes umask (upon configuration request)
- */
+/* set the processes umask (upon configuration request) */
static rsRetVal setUmask(void __attribute__((unused)) *pVal, int iUmask)
{
umask(iUmask);
@@ -2196,11 +2228,15 @@ startInputModules(void)
/* INIT -- Initialize syslogd from configuration table
* init() is called at initial startup AND each time syslogd is HUPed
+ * Note that if iConfigVerify is set, only the config file is verified but nothing
+ * else happens. -- rgerhards, 2008-07-28
*/
-static void
+static rsRetVal
init(void)
{
DEFiRet;
+ rsRetVal localRet;
+ int iNbrActions;
char cbuf[BUFSIZ];
char bufStartUpMsg[512];
struct sigaction sigAct;
@@ -2243,22 +2279,42 @@ init(void)
*/
conf.cfsysline((uchar*)"ResetConfigVariables");
+ conf.ReInitConf();
+
/* open the configuration file */
- if((iRet = conf.processConfFile(ConfFile)) != RS_RET_OK) {
+ localRet = conf.processConfFile(ConfFile);
+ CHKiRet(conf.GetNbrActActions(&iNbrActions));
+
+ if(localRet != RS_RET_OK) {
+ errmsg.LogError(0, localRet, "CONFIG ERROR: could not interpret master config file '%s'.", ConfFile);
+ } else if(iNbrActions == 0) {
+ errmsg.LogError(0, RS_RET_NO_ACTIONS, "CONFIG ERROR: there are no active actions configured. Inputs will "
+ "run, but no output whatsoever is created.");
+ }
+
+ if(localRet != RS_RET_OK || iNbrActions == 0) {
/* rgerhards: this code is executed to set defaults when the
* config file could not be opened. We might think about
* abandoning the run in this case - but this, too, is not
* very clever... So we stick with what we have.
* We ignore any errors while doing this - we would be lost anyhow...
*/
+ errmsg.LogError(0, NO_ERRCODE, "EMERGENCY CONFIGURATION ACTIVATED - fix rsyslog config file!");
selector_t *f = NULL;
- char szTTYNameBuf[_POSIX_TTY_NAME_MAX+1]; /* +1 for NULL character */
- dbgprintf("primary config file could not be opened - using emergency definitions.\n");
+
+ /* note: we previously used _POSIY_TTY_NAME_MAX+1, but this turned out to be
+ * too low on linux... :-S -- rgerhards, 2008-07-28
+ */
+ char szTTYNameBuf[128];
conf.cfline((uchar*)"*.ERR\t" _PATH_CONSOLE, &f);
+ conf.cfline((uchar*)"syslog.*\t" _PATH_CONSOLE, &f);
conf.cfline((uchar*)"*.PANIC\t*", &f);
+ conf.cfline((uchar*)"syslog.*\troot", &f);
if(ttyname_r(0, szTTYNameBuf, sizeof(szTTYNameBuf)) == 0) {
snprintf(cbuf,sizeof(cbuf), "*.*\t%s", szTTYNameBuf);
conf.cfline((uchar*)cbuf, &f);
+ } else {
+ dbgprintf("error %d obtaining controlling terminal, not using that emergency rule\n", errno);
}
selectorAddList(f);
}
@@ -2296,6 +2352,12 @@ init(void)
}
}
+ /* we are done checking the config - now validate if we should actually run or not.
+ * If not, terminate. -- rgerhards, 2008-07-25
+ */
+ if(iConfigVerify)
+ ABORT_FINALIZE(RS_RET_VALIDATION_RUN);
+
/* switch the message object to threaded operation, if necessary */
if(MainMsgQueType == QUEUETYPE_DIRECT || iMainMsgQueueNumWorkers > 1) {
MsgEnableThreadSafety();
@@ -2369,7 +2431,7 @@ init(void)
" [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \
"\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"] restart",
(int) myPid);
- logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)bufStartUpMsg, ADDDATE);
+ logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)bufStartUpMsg, 0);
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);
@@ -2377,7 +2439,9 @@ init(void)
sigaction(SIGHUP, &sigAct, NULL);
dbgprintf(" (re)started.\n");
- ENDfunc
+
+finalize_it:
+ RETiRet;
}
@@ -2644,7 +2708,6 @@ static rsRetVal loadBuildInModules(void)
* is that rsyslog will terminate if we can not register our built-in config commands.
* This, I think, is the right thing to do. -- rgerhards, 2007-07-31
*/
-// CHKiRet(regCfSysLineHdlr((uchar *)"workdirectory", 0, eCmdHdlrGetWord, NULL, &pszWorkDir, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionresumeretrycount", 0, eCmdHdlrInt, NULL, &glbliActionResumeRetryCount, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuefilename", 0, eCmdHdlrGetWord, NULL, &pszMainMsgQFName, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuesize", 0, eCmdHdlrInt, NULL, &iMainMsgQueueSize, NULL));
@@ -2685,6 +2748,8 @@ static rsRetVal loadBuildInModules(void)
NULL, &bDebugPrintCfSysLineHandlerList, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"moddir", 0, eCmdHdlrGetWord, NULL, &pModDir, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"errormessagestostderr", 0, eCmdHdlrBinary, NULL, &bErrMsgToStderr, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"maxmessagesize", 0, eCmdHdlrSize, setMaxMsgSize, NULL, NULL));
/* now add other modules handlers (we should work on that to be able to do it in ClassInit(), but so far
* that is not possible). -- rgerhards, 2008-01-28
@@ -2727,6 +2792,11 @@ static void printVersion(void)
#else
printf("\tFEATURE_DEBUG (debug build, slow code):\tNo\n");
#endif
+#ifdef HAVE_ATOMIC_BUILTINS
+ printf("\tAtomic operations supported:\t\tYes\n");
+#else
+ printf("\tAtomic operations supported:\t\tNo\n");
+#endif
#ifdef RTINST
printf("\tRuntime Instrumentation (slow code):\tYes\n");
#else
@@ -2740,9 +2810,9 @@ static void printVersion(void)
* move code out of the too-long main() function.
* rgerhards, 2007-10-17
*/
-static void mainThread()
+static rsRetVal mainThread()
{
- BEGINfunc
+ DEFiRet;
uchar *pTmp;
/* Note: signals MUST be processed by the thread this code is running in. The reason
@@ -2771,10 +2841,10 @@ static void mainThread()
pTmp = template_StdPgSQLFmt;
tplLastStaticInit(tplAddLine(" StdPgSQLFmt", &pTmp));
- init();
- if(Debug) {
+ CHKiRet(init());
+
+ if(Debug && debugging_on) {
dbgprintf("Debugging enabled, SIGUSR1 to turn off debugging.\n");
- debugging_on = 1;
}
/* Send a signal to the parent so it can terminate.
*/
@@ -2790,7 +2860,9 @@ static void mainThread()
dbgprintf("initialization completed, transitioning to regular run mode\n");
mainloop();
- ENDfunc
+
+finalize_it:
+ RETiRet;
}
@@ -2973,6 +3045,98 @@ finalize_it:
}
+/* global initialization, to be done only once and before the mainloop is started.
+ * rgerhards, 2008-07-28 (extracted from realMain())
+ */
+static rsRetVal
+doGlblProcessInit(void)
+{
+ struct sigaction sigAct;
+ int num_fds;
+ int i;
+ DEFiRet;
+
+ checkPermissions();
+ thrdInit();
+
+ if( !(Debug || NoFork) )
+ {
+ dbgprintf("Checking pidfile.\n");
+ if (!check_pid(PidFile))
+ {
+ memset(&sigAct, 0, sizeof (sigAct));
+ sigemptyset(&sigAct.sa_mask);
+ sigAct.sa_handler = doexit;
+ sigaction(SIGTERM, &sigAct, NULL);
+
+ if (fork()) {
+ /* Parent process
+ */
+ sleep(300);
+ /* Not reached unless something major went wrong. 5
+ * minutes should be a fair amount of time to wait.
+ * Please note that this procedure is important since
+ * the father must not exit before syslogd isn't
+ * initialized or the klogd won't be able to flush its
+ * logs. -Joey
+ */
+ exit(1); /* "good" exit - after forking, not diasabling anything */
+ }
+ num_fds = getdtablesize();
+ for (i= 0; i < num_fds; i++)
+ (void) close(i);
+ untty();
+ }
+ else
+ {
+ fputs(" Already running.\n", stderr);
+ exit(1); /* "good" exit, done if syslogd is already running */
+ }
+ } else {
+ debugging_on = 1;
+ }
+
+ /* tuck my process id away */
+ dbgprintf("Writing pidfile %s.\n", PidFile);
+ if (!check_pid(PidFile))
+ {
+ if (!write_pid(PidFile))
+ {
+ fputs("Can't write pid.\n", stderr);
+ exit(1); /* exit during startup - questionable */
+ }
+ }
+ else
+ {
+ fputs("Pidfile (and pid) already exist.\n", stderr);
+ exit(1); /* exit during startup - questionable */
+ }
+ myPid = getpid(); /* save our pid for further testing (also used for messages) */
+
+ memset(&sigAct, 0, sizeof (sigAct));
+ sigemptyset(&sigAct.sa_mask);
+
+ sigAct.sa_handler = sigsegvHdlr;
+ sigaction(SIGSEGV, &sigAct, NULL);
+ sigAct.sa_handler = sigsegvHdlr;
+ sigaction(SIGABRT, &sigAct, NULL);
+ sigAct.sa_handler = doDie;
+ sigaction(SIGTERM, &sigAct, NULL);
+ sigAct.sa_handler = Debug ? doDie : SIG_IGN;
+ sigaction(SIGINT, &sigAct, NULL);
+ sigaction(SIGQUIT, &sigAct, NULL);
+ sigAct.sa_handler = reapchild;
+ sigaction(SIGCHLD, &sigAct, NULL);
+ sigAct.sa_handler = Debug ? debug_switch : SIG_IGN;
+ sigaction(SIGUSR1, &sigAct, NULL);
+ sigAct.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &sigAct, NULL);
+ sigaction(SIGXFSZ, &sigAct, NULL); /* do not abort if 2gig file limit is hit */
+
+ RETiRet;
+}
+
+
/* This is the main entry point into rsyslogd. Over time, we should try to
* modularize it a bit more...
*/
@@ -2980,16 +3144,15 @@ int realMain(int argc, char **argv)
{
DEFiRet;
- register int i;
register uchar *p;
- int num_fds;
int ch;
struct hostent *hent;
extern int optind;
extern char *optarg;
- struct sigaction sigAct;
int bEOptionWasGiven = 0;
int bImUxSockLoaded = 0; /* already generated a $ModLoad imuxsock? */
+ int iHelperUOpt;
+ int bChDirRoot = 1; /* change the current working directory to "/"? */
char *arg; /* for command line option processing */
uchar legacyConfLine[80];
uchar *LocalHostName;
@@ -3009,7 +3172,7 @@ int realMain(int argc, char **argv)
* only when actually neeeded.
* rgerhards, 2008-04-04
*/
- while ((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nop:qQr::s:t:u:vwx")) != EOF) {
+ while((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nN:op:qQr::s:t:u:vwx")) != EOF) {
switch((char)ch) {
case '4':
case '6':
@@ -3021,6 +3184,7 @@ int realMain(int argc, char **argv)
case 'l':
case 'm': /* mark interval */
case 'n': /* don't fork */
+ case 'N': /* enable config verify mode */
case 'o':
case 'p':
case 'q': /* add hostname if DNS resolving has failed */
@@ -3084,9 +3248,6 @@ int realMain(int argc, char **argv)
ppid = getpid();
- if(chdir ("/") != 0)
- fprintf(stderr, "Can not do 'cd /' - still trying to run\n");
-
CHKiRet_Hdlr(InitGlobalClasses()) {
fprintf(stderr, "rsyslogd initializiation failed - global classes could not be initialized.\n"
"Did you do a \"make install\"?\n"
@@ -3219,6 +3380,9 @@ int realMain(int argc, char **argv)
case 'n': /* don't fork */
NoFork = 1;
break;
+ case 'N': /* enable config verify mode */
+ iConfigVerify = atoi(arg);
+ break;
case 'o':
if(iCompatibilityMode < 3) {
if(!bImUxSockLoaded) {
@@ -3269,8 +3433,11 @@ int realMain(int argc, char **argv)
fprintf(stderr, "-t option only supported in compatibility modes 0 to 2 - ignored\n");
break;
case 'u': /* misc user settings */
- if(atoi(arg) == 1)
+ iHelperUOpt = atoi(arg);
+ if(iHelperUOpt & 0x01)
bParseHOSTNAMEandTAG = 0;
+ if(iHelperUOpt & 0x02)
+ bChDirRoot = 0;
break;
case 'w': /* disable disallowed host warnigs */
glbl.SetOption_DisallowWarning(0);
@@ -3287,6 +3454,17 @@ int realMain(int argc, char **argv)
if(iRet != RS_RET_END_OF_LINKEDLIST)
FINALIZE;
+ if(iConfigVerify) {
+ fprintf(stderr, "rsyslogd: version %s, config validation run (level %d), master config %s\n",
+ VERSION, iConfigVerify, ConfFile);
+ }
+
+ if(bChDirRoot) {
+ if(chdir("/") != 0)
+ fprintf(stderr, "Can not do 'cd /' - still trying to run\n");
+ }
+
+
/* process compatibility mode settings */
if(iCompatibilityMode < 3) {
errmsg.LogError(0, NO_ERRCODE, "WARNING: rsyslogd is running in compatibility mode. Automatically "
@@ -3310,86 +3488,10 @@ int realMain(int argc, char **argv)
"more and cast your vote if you want us to keep this feature.");
}
- checkPermissions();
- thrdInit();
+ if(!iConfigVerify)
+ CHKiRet(doGlblProcessInit());
- if( !(Debug || NoFork) )
- {
- dbgprintf("Checking pidfile.\n");
- if (!check_pid(PidFile))
- {
- memset(&sigAct, 0, sizeof (sigAct));
- sigemptyset(&sigAct.sa_mask);
- sigAct.sa_handler = doexit;
- sigaction(SIGTERM, &sigAct, NULL);
-
- if (fork()) {
- /*
- * Parent process
- */
- sleep(300);
- /*
- * Not reached unless something major went wrong. 5
- * minutes should be a fair amount of time to wait.
- * Please note that this procedure is important since
- * the father must not exit before syslogd isn't
- * initialized or the klogd won't be able to flush its
- * logs. -Joey
- */
- exit(1); /* "good" exit - after forking, not diasabling anything */
- }
- num_fds = getdtablesize();
- for (i= 0; i < num_fds; i++)
- (void) close(i);
- untty();
- }
- else
- {
- fputs(" Already running.\n", stderr);
- exit(1); /* "good" exit, done if syslogd is already running */
- }
- }
- else
- debugging_on = 1;
-
- /* tuck my process id away */
- dbgprintf("Writing pidfile %s.\n", PidFile);
- if (!check_pid(PidFile))
- {
- if (!write_pid(PidFile))
- {
- fputs("Can't write pid.\n", stderr);
- exit(1); /* exit during startup - questionable */
- }
- }
- else
- {
- fputs("Pidfile (and pid) already exist.\n", stderr);
- exit(1); /* exit during startup - questionable */
- }
- myPid = getpid(); /* save our pid for further testing (also used for messages) */
-
- memset(&sigAct, 0, sizeof (sigAct));
- sigemptyset(&sigAct.sa_mask);
-
- sigAct.sa_handler = sigsegvHdlr;
- sigaction(SIGSEGV, &sigAct, NULL);
- sigAct.sa_handler = sigsegvHdlr;
- sigaction(SIGABRT, &sigAct, NULL);
- sigAct.sa_handler = doDie;
- sigaction(SIGTERM, &sigAct, NULL);
- sigAct.sa_handler = Debug ? doDie : SIG_IGN;
- sigaction(SIGINT, &sigAct, NULL);
- sigaction(SIGQUIT, &sigAct, NULL);
- sigAct.sa_handler = reapchild;
- sigaction(SIGCHLD, &sigAct, NULL);
- sigAct.sa_handler = Debug ? debug_switch : SIG_IGN;
- sigaction(SIGUSR1, &sigAct, NULL);
- sigAct.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &sigAct, NULL);
- sigaction(SIGXFSZ, &sigAct, NULL); /* do not abort if 2gig file limit is hit */
-
- mainThread();
+ CHKiRet(mainThread());
/* do any de-init's that need to be done AFTER this comment */
@@ -3398,9 +3500,12 @@ int realMain(int argc, char **argv)
thrdExit();
finalize_it:
- if(iRet != RS_RET_OK)
- fprintf(stderr, "rsyslogd run failed with error %d\n(see rsyslog.h "
- "or http://www.rsyslog.com/errcode to learn what that number means)\n", iRet);
+ if(iRet == RS_RET_VALIDATION_RUN) {
+ fprintf(stderr, "rsyslogd: End of config validation run. Bye.\n");
+ } else if(iRet != RS_RET_OK) {
+ fprintf(stderr, "rsyslogd run failed with error %d (see rsyslog.h "
+ "or try http://www.rsyslog.com/e/%d to learn what that number means)\n", iRet, iRet*-1);
+ }
ENDfunc
return 0;