From 6bad782f154b7f838c7371bf99c13f6dc4ec4101 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Feb 2011 17:54:09 +0100 Subject: bugfix: abort if imfile reads file line of more than 64KiB Thanks to Peter Eisentraut for reporting and analysing this problem. bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=221 --- ChangeLog | 3 +++ runtime/stringbuf.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 571c8bcb..3f478e0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,9 @@ Version 4.6.6 [v4-stable] (rgerhards), 2010-11-?? - bugfix: imfile utilizes 32 bit to track offset. Most importantly, this problem can not experienced on Fedora 64 bit OS (which has 64 bit long's!) +- bugfix: abort if imfile reads file line of more than 64KiB + Thanks to Peter Eisentraut for reporting and analysing this problem. + bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=221 - some improvements thanks to clang's static code analyzer o overall cleanup (mostly unnecessary writes and otherwise unused stuff) o bugfix: fixed a very remote problem in msg.c which could occur when diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c index 93995b38..8b2fe455 100644 --- a/runtime/stringbuf.c +++ b/runtime/stringbuf.c @@ -156,7 +156,7 @@ rsRetVal rsCStrExtendBuf(cstr_t *pThis, size_t iMinNeeded) { uchar *pNewBuf; - unsigned short iNewSize; + size_t iNewSize; DEFiRet; /* first compute the new size needed */ -- cgit From d1ae9e393885fb6d9fc69fc1bb08a098a8ac0328 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 11:28:22 +0100 Subject: improved testbench --- ChangeLog | 1 + tests/Makefile.am | 5 +++++ tests/discard-allmark-vg.sh | 13 +++++++++++++ tests/discard-allmark.sh | 10 ++++++++++ tests/testsuites/discard-allmark.conf | 15 +++++++++++++++ 5 files changed, 44 insertions(+) create mode 100755 tests/discard-allmark-vg.sh create mode 100755 tests/discard-allmark.sh create mode 100644 tests/testsuites/discard-allmark.conf diff --git a/ChangeLog b/ChangeLog index a9fb0d34..5be02fca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ --------------------------------------------------------------------------- Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? +- improved testbench - bugfix: (regression) omhdfs did no longer compile --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 diff --git a/tests/Makefile.am b/tests/Makefile.am index a720c0c3..35513614 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -51,6 +51,7 @@ TESTS += \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ + discard-allmark.sh \ discard.sh \ queue-persist.sh \ arrayqueue.sh \ @@ -60,6 +61,7 @@ endif if HAVE_VALGRIND TESTS += \ discard-rptdmsg-vg.sh \ + discard-allmark-vg.sh \ tcp-msgreduc-vg.sh endif @@ -236,6 +238,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ discard-rptdmsg.sh \ discard-rptdmsg-vg.sh \ testsuites/discard-rptdmsg.conf \ + discard-allmark.sh \ + discard-allmark-vg.sh \ + testsuites/discard-allmark.conf \ diag.sh \ testsuites/diag-common.conf \ testsuites/diag-common2.conf \ diff --git a/tests/discard-allmark-vg.sh b/tests/discard-allmark-vg.sh new file mode 100755 index 00000000..57ce8e3e --- /dev/null +++ b/tests/discard-allmark-vg.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-allmark.sh\]: testing discard-allmark functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg discard-allmark.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +# we need to give rsyslog a little time to settle the receiver +./msleep 1500 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/discard-allmark.sh b/tests/discard-allmark.sh new file mode 100755 index 00000000..eb46ae70 --- /dev/null +++ b/tests/discard-allmark.sh @@ -0,0 +1,10 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-allmark.sh\]: testing discard-allmark functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup discard-allmark.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/discard-allmark.conf b/tests/testsuites/discard-allmark.conf new file mode 100644 index 00000000..8a4983c1 --- /dev/null +++ b/tests/testsuites/discard-allmark.conf @@ -0,0 +1,15 @@ +# Test for discard functionality +# rgerhards, 2009-07-30 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$ActionWriteAllMarkMessages on + +:msg, contains, "00000001" ~ + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt -- cgit From 533a5351365cec93f233e0e99d98cedeadc5bd69 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 12:40:58 +0100 Subject: added MySQL life tests for ommysql tests run against a life database instance which must be setup in a specific way. --- ChangeLog | 2 ++ configure.ac | 18 ++++++++++++++++++ tests/Makefile.am | 19 +++++++++++++++++++ tests/mysql-asyn-vg.sh | 14 ++++++++++++++ tests/mysql-asyn.sh | 13 +++++++++++++ tests/mysql-basic-vg.sh | 14 ++++++++++++++ tests/mysql-basic.sh | 13 +++++++++++++ tests/tcp-msgreduc-vg.sh | 2 +- tests/testsuites/mysql-asyn.conf | 5 +++++ tests/testsuites/mysql-basic.conf | 4 ++++ tests/testsuites/mysql-select-msg.sql | 2 ++ tests/testsuites/mysql-truncate.sql | 2 ++ 12 files changed, 107 insertions(+), 1 deletion(-) create mode 100755 tests/mysql-asyn-vg.sh create mode 100755 tests/mysql-asyn.sh create mode 100755 tests/mysql-basic-vg.sh create mode 100755 tests/mysql-basic.sh create mode 100644 tests/testsuites/mysql-asyn.conf create mode 100644 tests/testsuites/mysql-basic.conf create mode 100644 tests/testsuites/mysql-select-msg.sql create mode 100644 tests/testsuites/mysql-truncate.sql diff --git a/ChangeLog b/ChangeLog index 5be02fca..69620435 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ --------------------------------------------------------------------------- Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? - improved testbench + among others, life tests for ommysql (against a test database) have + been added, valgrind-based testing enhanced, ... - bugfix: (regression) omhdfs did no longer compile --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 diff --git a/configure.ac b/configure.ac index b5666d66..58b203ff 100644 --- a/configure.ac +++ b/configure.ac @@ -736,6 +736,23 @@ AC_ARG_ENABLE(extended_tests, AM_CONDITIONAL(ENABLE_EXTENDED_TESTS, test x$enable_extended_tests = xyes) +# capability to enable MySQL testbench tests. This requries that a Syslog database +# with the default schema has been created on the local (127.0.0.1) MySQL server and +# a user "rsyslog" with password "testbench" exists, is able to login with default +# parameters and has sufficient (read: all) privileges on that database. +# rgerhards, 2011-03-09 +AC_ARG_ENABLE(mysql_tests, + [AS_HELP_STRING([--enable-mysql-tests],[enable MySQL specific tests in testbench @<:@default=no@:>@])], + [case "${enableval}" in + yes) enable_mysql_tests="yes" ;; + no) enable_mysql_tests="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mysql-tests) ;; + esac], + [enable_mysql_tests=no] +) +AM_CONDITIONAL(ENABLE_MYSQL_TESTS, test x$enable_mysql_tests = xyes) + + # Mail support (so far we do not need a library, but we need to turn this on and off) AC_ARG_ENABLE(mail, [AS_HELP_STRING([--enable-mail],[Enable mail support @<:@default=no@:>@])], @@ -1221,6 +1238,7 @@ echo echo "---{ debugging support }---" echo " Testbench enabled: $enable_testbench" echo " Extended Testbench enabled: $enable_extended_tests" +echo " MySQL Tests enabled: $enable_mysql_tests" echo " Debug mode enabled: $enable_debug" echo " Runtime Instrumentation enabled: $enable_rtinst" echo " Diagnostic tools enabled: $enable_diagtools" diff --git a/tests/Makefile.am b/tests/Makefile.am index 35513614..acadda04 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -65,6 +65,17 @@ TESTS += \ tcp-msgreduc-vg.sh endif +if ENABLE_MYSQL_TESTS +TESTS += \ + mysql-basic.sh \ + mysql-asyn.sh +if HAVE_VALGRIND +TESTS += \ + mysql-basic-vg.sh \ + mysql-asyn-vg.sh +endif +endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ @@ -354,6 +365,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ imuxsock_ccmiddle_root.sh \ testsuites/imuxsock_ccmiddle_root.conf \ resultdata/imuxsock_ccmiddle.log \ + testsuites\mysql-truncate.sql \ + testsuites\mysql-select-msg.sql \ + mysql-basic.sh \ + mysql-basic-vg.sh \ + testsuites\mysql-basic.sh \ + mysql-asyn.sh \ + mysql-asyn-vg.sh \ + testsuites\mysql-asyn.sh \ cfg.sh ourtail_SOURCES = ourtail.c diff --git a/tests/mysql-asyn-vg.sh b/tests/mysql-asyn-vg.sh new file mode 100755 index 00000000..dfe68665 --- /dev/null +++ b/tests/mysql-asyn-vg.sh @@ -0,0 +1,14 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-asyn.sh\]: asyn test for mysql functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-asyn.sh b/tests/mysql-asyn.sh new file mode 100755 index 00000000..de6d6fde --- /dev/null +++ b/tests/mysql-asyn.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-asyn.sh\]: asyn test for mysql functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-basic-vg.sh b/tests/mysql-basic-vg.sh new file mode 100755 index 00000000..215f41f0 --- /dev/null +++ b/tests/mysql-basic-vg.sh @@ -0,0 +1,14 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-basic-vg.sh\]: basic test for mysql-basic functionality/valgrind +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-basic.sh b/tests/mysql-basic.sh new file mode 100755 index 00000000..ba9d00f2 --- /dev/null +++ b/tests/mysql-basic.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-basic.sh\]: basic test for mysql-basic functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh index 7e388360..cd8534e4 100755 --- a/tests/tcp-msgreduc-vg.sh +++ b/tests/tcp-msgreduc-vg.sh @@ -12,5 +12,5 @@ source $srcdir/diag.sh wait-startup ./msleep 1500 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown-vg -source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg source $srcdir/diag.sh exit diff --git a/tests/testsuites/mysql-asyn.conf b/tests/testsuites/mysql-asyn.conf new file mode 100644 index 00000000..acdf9bbd --- /dev/null +++ b/tests/testsuites/mysql-asyn.conf @@ -0,0 +1,5 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/ommysql/.libs/ommysql +$ActionQueueType LinkedList +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/mysql-basic.conf b/tests/testsuites/mysql-basic.conf new file mode 100644 index 00000000..070094f5 --- /dev/null +++ b/tests/testsuites/mysql-basic.conf @@ -0,0 +1,4 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/ommysql/.libs/ommysql +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/mysql-select-msg.sql b/tests/testsuites/mysql-select-msg.sql new file mode 100644 index 00000000..2d27a331 --- /dev/null +++ b/tests/testsuites/mysql-select-msg.sql @@ -0,0 +1,2 @@ +use Syslog; +select substring(Message,9,8) from SystemEvents; diff --git a/tests/testsuites/mysql-truncate.sql b/tests/testsuites/mysql-truncate.sql new file mode 100644 index 00000000..ca852beb --- /dev/null +++ b/tests/testsuites/mysql-truncate.sql @@ -0,0 +1,2 @@ +use Syslog; +truncate table SystemEvents; -- cgit From c1760db6bbd07086177679b2be4b2d307657ddce Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 13:01:57 +0100 Subject: bugfix: omlibdbi did not use password from rsyslog.con closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 --- ChangeLog | 2 ++ plugins/omlibdbi/omlibdbi.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3f478e0d..917ce51f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ Version 4.6.6 [v4-stable] (rgerhards), 2010-11-?? - bugfix: abort if imfile reads file line of more than 64KiB Thanks to Peter Eisentraut for reporting and analysing this problem. bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=221 +- bugfix: omlibdbi did not use password from rsyslog.con + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 - some improvements thanks to clang's static code analyzer o overall cleanup (mostly unnecessary writes and otherwise unused stuff) o bugfix: fixed a very remote problem in msg.c which could occur when diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index 6f130f54..67b1edf9 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -287,7 +287,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) if(dbName != NULL) if((pData->dbName = (uchar*) strdup((char*)dbName)) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); if(pwd != NULL) - if((pData->pwd = (uchar*) strdup((char*)"")) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + if((pData->pwd = (uchar*) strdup((char*)pwd)) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_RQD_TPL_OPT_SQL, (uchar*) " StdDBFmt")); -- cgit From dffb2bab8cb52599626b82587da09df39b16e7aa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 13:08:32 +0100 Subject: adding bugfix info to ChangLog (imported fix) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index c7096d2b..74fd299f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 5.6.5 [V5-STABLE] (rgerhards), 2011-03-?? +- bugfix: omlibdbi did not use password from rsyslog.con + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 - bugfix(kind of): tell users that config graph can currently not be generated closes: http://bugzilla.adiscon.com/show_bug.cgi?id=232 -- cgit From 8d79906d500c5760f093123b3ef3c43508ffce58 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 13:18:37 +0100 Subject: cosmetic: added bug info --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index c4bcadc2..784a8787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? among others, life tests for ommysql (against a test database) have been added, valgrind-based testing enhanced, ... - bugfix: (regression) omhdfs did no longer compile +- bugfix: omlibdbi did not use password from rsyslog.con + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 - systemd support somewhat improved (can now take over existing log sockt) -- cgit