diff -Nru rsyslog-8.2001.0/ChangeLog rsyslog-8.2006.0/ChangeLog --- rsyslog-8.2001.0/ChangeLog 2020-01-14 12:58:45.000000000 +0000 +++ rsyslog-8.2006.0/ChangeLog 2020-06-22 12:57:45.000000000 +0000 @@ -1,4 +1,279 @@ ---------------------------------------------------------------------------------------- +Scheduled Release 8.2006.0 (aka 2020.06) 2020-06-23 +- 2020-06-22: queue: permit ability to double size at shutdown + This prevents message loss due to "queue full" when re-enqueueing data + under quite exotic settings. + see also https://github.com/rsyslog/rsyslog/issues/3941#issuecomment-549765813 + closes https://github.com/rsyslog/rsyslog/issues/4020 +- 2020-06-22:Fixing imfile segfaulting on selinux denial + If imfile is denied access to file watched trough symlink there is + unchecked condition resulting in access to not initialized memory. +- 2020-06-22: openssl: Fixed memory leak when tls handshake failed. + closes: https://github.com/rsyslog/rsyslog/issues/4319 +- 2020-06-22: change systemd service file to wait for network + now that rsyslog is usually only installed for real syslog servers, + we should assume that some network listening or forwarding happens + on start. As such we need to start a bit later, after the network. + This poses no problem as systemd nowadays comes with journal which + is in almost all cases configured to buffer log data while + rsyslog is not yet running. + see also https://github.com/rsyslog/rsyslog-pkg-rhel-centos/issues/72 +- 2020-06-22: NEW INPUT MODULE:: impcap, network packets input parser + Thanks to github user frikilax for the contribution. +- 2020-06-22: ksi bugfix: Optimized code in KSI module initialization fixed. + KSI module initialization will not stuck in infinite loop when code is + built with optimization -O2. +- 2020-06-05: operatingstatefile bugfix: month was given too low + The month was printed with the range 0 (January) to 11 (December). + This has now been corrected. + closes https://github.com/rsyslog/rsyslog/issues/4292 +- 2020-06-05: build system: add "optional" build functionality to some components + Nameley: + --enable-libdbi=optional + --enable-mmdblookup=optional + --enable-imkafka=optional + --enable-omkafka=optional + If used, builds a dummy module which just emits a "module not supported + on this platform" error message when loaded. + Primary use case for this system is Debian-ish builds on SUSE OBS, + where we prefer to have a single package definition for all versions + (else things get much more complicated). +- 2020-05-23: config system bugfix: backticks cat segfault if file cannot be opened + when a `cat ` construct is used in rsyslog.conf and can not + be accessed (does not exist, no permissions, ...), rsyslog segfaults. + Thanks to Michael Skeffington for notifying us and providing root cause analysis. + closes https://github.com/rsyslog/rsyslog/issues/4290 +- 2020-05-15: imtcp bugfix: octet framing/stuffing problem with discardTruncatedMsg on + When "discardTruncatedMsg" was enabled in imtcp, messages were incorrectly + skipped if the last character before the truncation was the LFdelimiter. + Also adds two testbench tests for this case. + closes: https://github.com/rsyslog/rsyslog/issues/4281 +- 2020-05-12: ompipe bugfix: race during HUP + When HUP was received, the write mutex was not aquired. This could + lead to unexpected invalidation of the output file descriptor. + Thanks to Julien Thomas for alerting us on this issue. + see also https://github.com/rsyslog/rsyslog/pull/4136#issuecomment-578326278 +- 2020-05-12: ompipe: add action parameter tryResumeReopen + Sometimes we need to reopen a pipe after an ompipe action gets + suspended. Sending an HUP signal to rsyslog does the job but requires + an interraction with rsyslog. The patch adds support for a new boolean + option, tryResumeReopen, for the ompipe action. It mimics what an HUP + signal would do. + Thanks to Julien Thomas for the patch. +- 2020-05-12: imjournal: remove strcat call + Thanks to Jeff Marckel for the patch. +- 2020-05-12: build system: libzcmq version requirement needs to be bumped + Thanks to Thomas Deutschmann for pointing this out. + closes https://github.com/rsyslog/rsyslog/issues/3957 +- 2020-05-12: testbench: download ElasticSearch binaries from rsyslog.com + The official ElasticSearch download site sometimes denies the download. +- 2020-05-11: openssl netstream driver bugfix: context leak + The context object was not properly freed. + Thanks to Michael Zimmermann for the fix. +- 2020-05-11: omhttp: Add support for multiple http headers + Allows the inclusion of multiple http headers on the REST call. + Thanks to callmegar for the patch. +- 2020-04-29: core bugfix: group id could not be obtained for very large groups + Thanks to github user emilbart for the patch. +- 2020-04-29: testbench additions (relp broken connection test) +- 2020-04-29: omudpspoof bugfix: issues with oversized messages + First issue was an incorrect packet length in UDP Header. It has to be the FULL UDP Packet + regardless of the MTU Setting. As a result regardless of IP fragmentation, the MTU setting + also limited the siizmax size of the UDP message. + The second issue was incorrect calculation of the UDP Checksum with libnet if + IP fragmentation was used (Based on MTU Setting). As a result, the network packets were + dropped by the tcp stack before they even could reach there target. The workarround for this + problem is, that we set the UDP Checksum to 0x0000 which allows skipping of the checksum + test. Fixing the problem by calculating the correct UDP Checksum would require some + code changes in the libnet. + Also fixed the omudpspoof bigmsg test and increased the testing size to 16KB. +- 2020-04-29: omprog: fix assert failed on HUP with output flag + If the 'output' setting of omprog was used and rsyslog received a HUP + signal just after starting (and before the omprog action received the + first log to process), an internal assertion could fail, causing + rsyslog to terminate. The failure message was "rsyslogd: omprog.c:660: + closeOutputFile: Assertion `pCtx->bIsRunning' failed." + The failure could also occur if rsyslog received a HUP signal during + the shutdown sequence. + This bug was introduced in v8.2004 by PR https://github.com/rsyslog/rsyslog/pull/4255 + Although a test already existed that checked the interaction of HUPs + with the 'output' setting, it didn't always fail in this particular case + due to timing conditions. The test has been improved to cover this case + more reliably. + Thanks to Joan Sala Isern for the patch. +---------------------------------------------------------------------------------------- +Scheduled Release 8.2004.0 (aka 2020.04) 2020-04-28 +- 2020-04-28: ksi bugfix: When KSI module is suddenly closed, files are finalized + In async. mode all pending signature requests are closed immediately and + unsigned block marker is attached with message about sudden closure. + Similar approach is used for blocks that already contain some records. + Empty blocks are just closed without any metadata. + Thanks to Taavi Väljaots for the patch. +- 2020-04-28: ksi bugfix: Signer thread initialization is verified before usage. + When signer thread is created in rsksiInitModule thread successful + initialization is verified before returning the function. This will + prevent adding records to not initialized module and in case of an + error signature files opened will contain only magic bytes. + Thread flags replaced with thread state. + When init module fails, module is disabled. + Thanks to Taavi Väljaots for the patch. +- 2020-04-28: ksi bugfix: Hardcoded default hash algorithm replaced with 'default' + Instead of hardcoded SHA-256 KSI_getHashAlgorithmByName("default") + is used to get default hash function. + Function rsksiSetHashFunction and SetCnfParam updated. + Thanks to Taavi Väljaots for the patch. +- 2020-04-28: imfile bugfix: poential segfault in stream object on file read + - if cstrLen(pThis->prevMsgSegment) > maxMsgSize then len calculation + become negative if cstrLen(thisLine) < cstrLen(pThis->prevMsgSegment) + This causes illegal access to memory location and thus causing segfault. + - assigning len = 0 if cstrLen(pThis->prevMsgSegment) > maxMsgSize so that + it access the correct memory location. + Thanks to github user jaankit +- 2020-04-28: openssl TLS drivers: made more reliable for older openssl versions + OpenSSL can retry some failed operations, but older versions need an explicit + opt-in to do so. This is now done. +- 2020-04-28: omprog: fix bad fd errors in daemon mode + When omprog was used with the 'forceSingleInstance=on' option, and/or + the 'output' setting, "bad file descriptor" errors occurred, which + prevented the external program to be executed and/or the program output + to be correctly captured. The bug could also manifest as "resource + temporarily unavailable" errors, or other errors related to the use of + invalid/reassigned file descriptors. These errors only happened when + rsyslog ran in daemon mode (i.e. they didn't happen if rsyslogd was + run with the '-n' option). + The cause of the bug was that omprog opened the pipe fds needed by + these flags during the configuration load phase (in the 'newActInst' + module entrypoint). This is a bad place since the fork of the daemon + occurs after this phase, and all fds are closed when the daemon process + is started (see 'initAll' in rsyslogd.c), hence invalidating the + previously opened fds. + To correct this, the single child process and the output capture thread + are now started later, when the first log message is received by the + first worker thread. (Note: the 'activateCnf' module entrypoint, despite + being invoked after the fork, cannot be used for this purpose, since it + is invoked per module, not per action instance.) + Currently no automated test exists for this use case since the testbench + always runs rsyslog in non-daemon mode. + Affected versions: v8.38 and later + closes: https://github.com/rsyslog/rsyslog/issues/4247 + Thanks to Joan Sala Isern for the patch. +- 2020-04-28: omfile bugfix: $outchannel split log lines at rotation time +- 2020-04-17: openssl: add support for libreSSL + Disable use of "@SECLEVEL" in default cipher string and + avoid SSL_CONF_CTX_set_flags() API when LIBRESSL is used. + This means tlscommands will not work. + closes: https://github.com/rsyslog/rsyslog/issues/4210 +- 2020-03-04: imudp bugfix: build problems on some Linux kernel versions + Thanks to Wen Yang for the patch. +- 2020-03-02: conf output bugfix: -o produces missing space between call and rulename + Thanks to Tetiana Ohnieva for the patch. + closes https://github.com/rsyslog/rsyslog/issues/3761 +---------------------------------------------------------------------------------------- +Scheduled Release 8.2002.0 (aka 2020.02) 2020-02-25 +- 2020-02-25: imfile: add per minute rate limiting + Add MaxBytesPerMinute and MaxLinesPerMinute options. + These take integer values and, respectively, limit the number + of bytes or lines that may be sent in a minute. + This can be used to put a limit on the count or volume of logs + that may be sent for an imfile. + Thanks to Greg Farrell for the patch. +- 2020-02-24: core: add global parameter "security.abortOnIDResolutionFail" + This parameter controls whether or not rsyslog aborts when a name ID + lookup fails (for user and group names). This is necessary as a security + measure, as otherwise the wrong permissions can be assigned or privileges + are not dropped. + CHANGE OF BEHAVIOR + The default for this parameter is "on". In previous versions, the default + was "off" (by virtue of this parameter not existing). As such, existing + configurations may now error out. + We have decided to accept this change of behavior because of the potential + security implications. + closes https://github.com/rsyslog/rsyslog/issues/4164 +- 2020-02-24: openssl TLS driver bugfix: chained certificates were not accepted + This was supported since always inside GnuTLS driver, but was missing for openssl one. +- 2020-02-24: core bugfix: too early parsing of incoming messages + In theory, rsyslog should call parsers on the queue worker threads whenever + possible. This enables the parsers to be executed in parallel. There are + some cases where parsers needs to be called earlier, namely when parsed + data is needed for rate-limiting. + The logic to do this previously did not work correctly and was fixed six + years ago (!) by b51dd22. Unfortunately, b51dd22 was overly agressive: + it actually makes the early parser call now mandatory, effectively moving + parsing to the input side where there is no to little concurrency. + We still do not need to call the parser when all messages, regardless of + severity, need to be rate-limited. This is the default and very frequent + case. This patch introduces support for this and as such makes parsers + able to run in parallel in the frequent case again. + closes https://github.com/rsyslog/rsyslog/issues/4187 +- 2020-02-20: testbench bugfix: two minor issues in omkafkadynakey.sh test + lead to false positives during test runs (depending on circumstances) + closes: https://github.com/rsyslog/rsyslog/issues/4134 +- 2020-02-20: testbench: set max extra data length for tcpflood from 200 to 512KiB + Added a imrelp test for big messages (256KB). + closes: https://github.com/rsyslog/rsyslog/issues/4158 +- 2020-02-20: config system bugfix: 'config.enabled' directive oddities + Previously the directive was processed way too late which caused false + errors whenever it was set to 'off' and possibly other problems. + Thanks to Jiri Vymazal for the patch. +- 2020-02-09: imfile bugfix: timeout did not work on very busy system + The timeout feature was soley based on timeouts of the poll() + system call. On a very busy system, this would probably happen + very seldomly. Moreover, the timeout could occur later than + expected on any system with high load. + The issue was not reported from practice but discovered during + CI system improvements. +- 2020-01-30: build system: change --enable-imfile-tests default to "yes" + This was accidentally set to "no" some time ago (actual commit unknown). Tests for + imfile should by default run when imfile is enabled. + see also https://github.com/rsyslog/rsyslog/issues/4120 +- 2020-01-27: build system: add option --enable-gnutls-tests + This enables us to build GNUtls support but not necessarily + test it in CI. This is useful for some specialised subcomponent + test. The default is enabled if gnutls is enabled and disabled if not. +- 2020-01-26: testbench: new test for loadbalancing via global vars + This is a popular functionality which had not been routinely tested + in the past. +- 2020-01-26: mmdblookup bugfix: invalid data returned when no entry found + Since the upgrade of the package libmaxminddb on FreeBSD (1.3.2_2 -> 1.4.2), + the module mmdblookup returns the first entry of the mmdb database even if the entry + is not found. After some debug, I found the solution in the official maxminddb + repository : to check if the entry is in database, we must check the found_entry + attribute, otherwise the function MMDB_get_entry_data_list will return the first + entry of the database if the entry is not found in it. + Thanks to Kevin Guillemot for the patch. +- 2020-01-23: oversize message log bugfix: do not close fd -1 + The oversize message log fd is always closed on HUP, even if it never + was opened (and thus has -1 value). This patch corrects the issue. + The bug had no know-bad effect in practice other than getting an + (ignored) error status from close(). However, it introduced warnings + in test runs (e.g. when running under valgrind). +- 2020-01-22: imfile bugfix: saving of old file_id for statefiles + Previously we saved old file_id unconditionally, which led to not + deleting old statefiles if files changes without rsyslog running. + Now it should work correctly. + Thanks to Jiri Vymazal for the patch. +- 2020-01-22: imfile bugfix: misadressing and potential segfault + Commit 3f72e8c introduced an invalid memory allocation size. This lead to + too-short alloc and thus to overwrite of non-owned memory. That in turn + could lead to segfaults or other hard to find problems. + The issue was detected by our upgraded CI system. We did not receive + any problem reports in practice. Nevertheless, the problem is real and + people should update affected versions to patched ones. + The bug was present in scheduled stable release 8.1911.0 and 8.2001.0. + see also: https://github.com/rsyslog/rsyslog/issues/4120 + see also: https://github.com/rsyslog/rsyslog/pull/4141 +- 2020-01-20: core bugfix: potential race during HUP + when rsyslog is HUPed immediately after startup and before it is fully + initialized, there is a potential race with the list of loaded modules. + This patch ensures no bad things can happen in that case. + Detected by LLVM TSAN, not seen in practice. +- 2020-01-20: testbench improvements and fixes + modernize tests, reduce robustness against slow machines, provide some + test framework functional enhancements, and optimize some tests. + Also includes some code changes to C testing components. Among others, + tests have slightly been speeded up by reducing the wait time at queue + shutdown. This is possible because of better overall completion checks. +---------------------------------------------------------------------------------------- Scheduled Release 8.2001.0 (aka 2020.01) 2020-01-14 - 2020-01-12: core bugfix: race condition related to libfastjson when using DA queue Rsyslogd aborts when writing to disk queue from multiple workers simultaneously. diff -Nru rsyslog-8.2001.0/config.h.in rsyslog-8.2006.0/config.h.in --- rsyslog-8.2001.0/config.h.in 2020-01-14 12:59:30.000000000 +0000 +++ rsyslog-8.2006.0/config.h.in 2020-06-22 12:58:09.000000000 +0000 @@ -12,9 +12,18 @@ /* Indicator that IMDIAG is present */ #undef ENABLE_IMDIAG +/* Indicator that we need to build a dummy imkafka module */ +#undef ENABLE_IMKAFKA_DUMMY + /* Indicator that LIBGCRYPT is present */ #undef ENABLE_LIBGCRYPT +/* Indicator that we need to build a dummy module */ +#undef ENABLE_MMBDLOOKUP_DUMMY + +/* Indicator that we need to build a dummy omkafka module */ +#undef ENABLE_OMKAFKA_DUMMY + /* Indicator that openssl is present */ #undef ENABLE_OPENSSL @@ -207,6 +216,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PCAP_H + /* Define to 1 if you have the `port_create' function. */ #undef HAVE_PORT_CREATE diff -Nru rsyslog-8.2001.0/configure rsyslog-8.2006.0/configure --- rsyslog-8.2001.0/configure 2020-01-14 12:59:29.000000000 +0000 +++ rsyslog-8.2006.0/configure 2020-06-22 12:58:08.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for rsyslog 8.2001.0. +# Generated by GNU Autoconf 2.69 for rsyslog 8.2006.0. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='rsyslog' PACKAGE_TARNAME='rsyslog' -PACKAGE_VERSION='8.2001.0' -PACKAGE_STRING='rsyslog 8.2001.0' +PACKAGE_VERSION='8.2006.0' +PACKAGE_STRING='rsyslog 8.2006.0' PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com' PACKAGE_URL='' @@ -690,8 +690,12 @@ WGET JAVA JAVAC +IMKAFKA_USE_DUMMY_FALSE +IMKAFKA_USE_DUMMY_TRUE LIBLZ4_LIBS LIBLZ4_CFLAGS +OMKAFKA_USE_DUMMY_FALSE +OMKAFKA_USE_DUMMY_TRUE LIBRDKAFKA_LIBS LIBRDKAFKA_CFLAGS ENABLE_KAFKA_STATIC_FALSE @@ -736,6 +740,8 @@ ENABLE_OMUDPSPOOF_TRUE ENABLE_OMPROG_FALSE ENABLE_OMPROG_TRUE +ENABLE_IMPCAP_FALSE +ENABLE_IMPCAP_TRUE ENABLE_IMPSTATS_FALSE ENABLE_IMPSTATS_TRUE ENABLE_IMPTCP_FALSE @@ -798,6 +804,8 @@ ENABLE_MMFIELDS_TRUE ENABLE_MMDARWIN_FALSE ENABLE_MMDARWIN_TRUE +MMDBLOOKUP_USE_DUMMY_FALSE +MMDBLOOKUP_USE_DUMMY_TRUE ENABLE_MMDBLOOKUP_FALSE ENABLE_MMDBLOOKUP_TRUE ENABLE_MMSEQUENCE_FALSE @@ -849,6 +857,8 @@ ENABLE_LIBGCRYPT_FALSE ENABLE_LIBGCRYPT_TRUE LIBGCRYPT_CONFIG +ENABLE_GNUTLS_TESTS_FALSE +ENABLE_GNUTLS_TESTS_TRUE ENABLE_GNUTLS_FALSE ENABLE_GNUTLS_TRUE GNUTLS_LIBS @@ -886,6 +896,8 @@ LIBDBI_CFLAGS ENABLE_OMLIBDBI_FALSE ENABLE_OMLIBDBI_TRUE +LIBDBI_USE_DUMMY_FALSE +LIBDBI_USE_DUMMY_TRUE ENABLE_PGSQL_FALSE ENABLE_PGSQL_TRUE PG_CONFIG @@ -1146,6 +1158,7 @@ enable_clickhouse_tests enable_openssl enable_gnutls +enable_gnutls_tests enable_libgcrypt enable_rsyslogrt enable_rsyslogd @@ -1191,6 +1204,7 @@ enable_imsolaris enable_imptcp enable_impstats +enable_impcap enable_omprog enable_omudpspoof enable_omstdout @@ -1840,7 +1854,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rsyslog 8.2001.0 to adapt to many kinds of systems. +\`configure' configures rsyslog 8.2006.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1911,7 +1925,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rsyslog 8.2001.0:";; + short | recursive ) echo "Configuration of rsyslog 8.2006.0:";; esac cat <<\_ACEOF @@ -1980,6 +1994,7 @@ [default=no] --enable-openssl Enable openssl support [default=no] --enable-gnutls Enable GNU TLS support [default=no] + --enable-gnutls-tests Enable gnutls tests [default=yes] --enable-libgcrypt Enable log file encryption support (libgcrypt) [default=yes] --enable-rsyslogrt Build rsyslogrt [default=yes] @@ -2025,7 +2040,7 @@ --enable-imbatchreport batch report input module enabled [default=no] --enable-pmdb2diag db2diag parser module enabled [default=no] --enable-imfile file input module enabled [default=no] - --enable-imfile-tests Enable imfile tests [default=no] + --enable-imfile-tests Enable imfile tests [default=yes] --enable-imdocker input docker module enabled [default=no] --enable-imdocker-tests Enable imdocker tests [default=no] --enable-imtuxedoulog tuxedo ULOG input module enabled [default=no] @@ -2033,6 +2048,7 @@ --enable-imsolaris solaris input module enabled [default=no] --enable-imptcp plain tcp input module enabled [default=no] --enable-impstats periodic statistics module enabled [default=no] + --enable-impcap libpcap input module enabled [default=no] --enable-omprog Compiles omprog module [default=no] --enable-omudpspoof Compiles omudpspoof module [default=no] --enable-omstdout Compiles stdout module [default=no] @@ -2270,7 +2286,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rsyslog configure 8.2001.0 +rsyslog configure 8.2006.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2850,7 +2866,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rsyslog $as_me 8.2001.0, which was +It was created by rsyslog $as_me 8.2006.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3202,7 +3218,7 @@ $as_echo "#define VERSION_YEAR 20" >>confdefs.h # UPDATE on release -$as_echo "#define VERSION_MONTH 01" >>confdefs.h +$as_echo "#define VERSION_MONTH 06" >>confdefs.h # UPDATE on release am__api_version='1.15' @@ -3720,7 +3736,7 @@ # Define the identity of the package. PACKAGE='rsyslog' - VERSION='8.2001.0' + VERSION='8.2006.0' cat >>confdefs.h <<_ACEOF @@ -20432,6 +20448,7 @@ enableval=$enable_libdbi; case "${enableval}" in yes) enable_libdbi="yes" ;; no) enable_libdbi="no" ;; + optional) enable_libdbi="optional" ;; *) as_fn_error $? "bad value ${enableval} for --enable-libdbi" "$LINENO" 5 ;; esac else @@ -20439,7 +20456,8 @@ fi -if test "x$enable_libdbi" = "xyes"; then +libdbi_use_dummy="no" +if test "x$enable_libdbi" = "xyes" -o x$enable_libdbi = xoptional; then for ac_header in dbi/dbi.h do : ac_fn_c_check_header_mongrel "$LINENO" "dbi/dbi.h" "ac_cv_header_dbi_dbi_h" "$ac_includes_default" @@ -20449,12 +20467,18 @@ _ACEOF else + + if test x$enable_libdbi = xyes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "libdbi is missing See \`config.log' for more details" "$LINENO" 5; } fi + libdbi_use_dummy="yes" + + +fi done @@ -20499,12 +20523,18 @@ LIBDBI_LIBS="-ldbi" else + + if test x$enable_libdbi = xyes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "libdbi library is missing +as_fn_error $? "libdbi is missing See \`config.log' for more details" "$LINENO" 5; } fi + libdbi_use_dummy="yes" + + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbi_initialize_r in -ldbi" >&5 $as_echo_n "checking for dbi_initialize_r in -ldbi... " >&6; } @@ -20593,7 +20623,15 @@ fi fi - if test x$enable_libdbi = xyes; then + if test x$libdbi_use_dummy = xyes; then + LIBDBI_USE_DUMMY_TRUE= + LIBDBI_USE_DUMMY_FALSE='#' +else + LIBDBI_USE_DUMMY_TRUE='#' + LIBDBI_USE_DUMMY_FALSE= +fi + + if test x$enable_libdbi = xyes -o x$enable_libdbi = xoptional; then ENABLE_OMLIBDBI_TRUE= ENABLE_OMLIBDBI_FALSE='#' else @@ -20604,6 +20642,7 @@ + # SNMP support # Check whether --enable-snmp was given. if test "${enable_snmp+set}" = set; then : @@ -21904,6 +21943,38 @@ fi +# Check whether --enable-gnutls-tests was given. +if test "${enable_gnutls_tests+set}" = set; then : + enableval=$enable_gnutls_tests; case "${enableval}" in + yes) enable_gnutls_tests="yes" ;; + no) enable_gnutls_tests="no" ;; + *) as_fn_error $? "bad value ${enableval} for --enable-gnutls-tests" "$LINENO" 5 ;; + esac +else + if [ "$enable_gnutls" == "yes" ]; then + enable_gnutls_tests=yes + else + enable_gnutls_tests=no + fi + +fi + +if [ "$enable_gnutls_tests" == "yes" ] && [ "$enable_gnutls" != "yes" ]; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gnutls-tests can not be enabled without gnutls support. Disabling gnutls tests..." >&5 +$as_echo "$as_me: WARNING: gnutls-tests can not be enabled without gnutls support. Disabling gnutls tests..." >&2;} + enable_gnutls_tests="no" +fi + + if test x$enable_gnutls_tests = xyes; then + ENABLE_GNUTLS_TESTS_TRUE= + ENABLE_GNUTLS_TESTS_FALSE='#' +else + ENABLE_GNUTLS_TESTS_TRUE='#' + ENABLE_GNUTLS_TESTS_FALSE= +fi + + + # libgcrypt support # Check whether --enable-libgcrypt was given. if test "${enable_libgcrypt+set}" = set; then : @@ -22722,6 +22793,7 @@ enableval=$enable_mmdblookup; case "${enableval}" in yes) enable_mmdblookup="yes" ;; no) enable_mmdblookup="no" ;; + optional) enable_mmdblookup="optional" ;; *) as_fn_error $? "bad value ${enableval} for --enable-mmdblookup" "$LINENO" 5 ;; esac else @@ -22729,8 +22801,17 @@ fi -if test "x$enable_mmdblookup"; then - #PKG_CHECK_MODULES(LIBMAXMINDDB, libmaxminddb) + if test x$enable_mmdblookup = xyes -o x$enable_mmdblookup = xoptional; then + ENABLE_MMDBLOOKUP_TRUE= + ENABLE_MMDBLOOKUP_FALSE='#' +else + ENABLE_MMDBLOOKUP_TRUE='#' + ENABLE_MMDBLOOKUP_FALSE= +fi + +mmdblookup_use_dummy="no" +if test x$enable_mmdblookup = xoptional -o x$enable_mmdblookup = xyes; then + #PKG_CHECK_MODULES(LIBMAXMINDDB, libmaxminddb) -- does not work - later? for ac_header in maxminddb.h do : ac_fn_c_check_header_mongrel "$LINENO" "maxminddb.h" "ac_cv_header_maxminddb_h" "$ac_includes_default" @@ -22739,22 +22820,33 @@ #define HAVE_MAXMINDDB_H 1 _ACEOF + +else + + if test x$enable_mmdblookup = xyes; then : + as_fn_error $? "libmaxminddb library for mmdblookup could not be found" "$LINENO" 5 + +fi + mmdblookup_use_dummy="yes" + +$as_echo "#define ENABLE_MMBDLOOKUP_DUMMY 1" >>confdefs.h + + fi done fi - if test x$enable_mmdblookup = xyes; then - ENABLE_MMDBLOOKUP_TRUE= - ENABLE_MMDBLOOKUP_FALSE='#' + if test x$mmdblookup_use_dummy = xyes; then + MMDBLOOKUP_USE_DUMMY_TRUE= + MMDBLOOKUP_USE_DUMMY_FALSE='#' else - ENABLE_MMDBLOOKUP_TRUE='#' - ENABLE_MMDBLOOKUP_FALSE= + MMDBLOOKUP_USE_DUMMY_TRUE='#' + MMDBLOOKUP_USE_DUMMY_FALSE= fi - # mmdarwin # Check whether --enable-mmdarwin was given. if test "${enable_mmdarwin+set}" = set; then : @@ -23837,10 +23929,15 @@ *) as_fn_error $? "bad value ${enableval} for --enable-imfile-tests" "$LINENO" 5 ;; esac else - enable_file_tests=no + enable_imfile_tests=yes fi +if [ "$enable_imfile_tests" == "yes" ] && [ "$enable_imfile" != "yes" ]; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: imfile-tests can not be enabled without imfile support. Disabling imfile tests..." >&5 +$as_echo "$as_me: WARNING: imfile-tests can not be enabled without imfile support. Disabling imfile tests..." >&2;} + enable_imfile_tests="no" +fi if test x$enable_imfile_tests = xyes; then ENABLE_IMFILE_TESTS_TRUE= ENABLE_IMFILE_TESTS_FALSE='#' @@ -23850,6 +23947,7 @@ fi + # settings for the docker log input module # Check whether --enable-imdocker was given. if test "${enable_imdocker+set}" = set; then : @@ -24111,6 +24209,46 @@ fi +# settings for the pcap input module +# Check whether --enable-impcap was given. +if test "${enable_impcap+set}" = set; then : + enableval=$enable_impcap; case "${enableval}" in + yes) enable_impcap="yes" ;; + no) enable_impcap="no" ;; + *) as_fn_error $? "bad value ${enableval} for --enable-impcap" "$LINENO" 5 ;; + esac +else + enable_impcap=no + +fi + + +if test "x$enable_impcap" = "xyes"; then + for ac_header in pcap.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PCAP_H 1 +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: pcap found" >&5 +$as_echo "$as_me: pcap found" >&6;} +else + as_fn_error $? "libpcap library and headers not found" "$LINENO" 5 + +fi + +done + +fi + if test x$enable_impcap = xyes; then + ENABLE_IMPCAP_TRUE= + ENABLE_IMPCAP_FALSE='#' +else + ENABLE_IMPCAP_TRUE='#' + ENABLE_IMPCAP_FALSE= +fi + # settings for the omprog output module # Check whether --enable-omprog was given. @@ -24871,6 +25009,7 @@ enableval=$enable_omkafka; case "${enableval}" in yes) enable_omkafka="yes" ;; no) enable_omkafka="no" ;; + optional) enable_omkafka="optional" ;; *) as_fn_error $? "bad value ${enableval} for --enable-omkafka" "$LINENO" 5 ;; esac else @@ -24883,6 +25022,7 @@ enableval=$enable_imkafka; case "${enableval}" in yes) enable_imkafka="yes" ;; no) enable_imkafka="no" ;; + optional) enable_imkafka="optional" ;; *) as_fn_error $? "bad value ${enableval} for --enable-imkafka" "$LINENO" 5 ;; esac else @@ -24934,7 +25074,8 @@ # omkafka works with older library -if test "x$enable_omkafka" = "xyes"; then +omkafka_use_dummy="no" +if test "$enable_omkafka" = "yes" -o "$enable_omkafka" = "optional"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBRDKAFKA" >&5 @@ -24944,12 +25085,12 @@ pkg_cv_LIBRDKAFKA_CFLAGS="$LIBRDKAFKA_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rdkafka\""; } >&5 - ($PKG_CONFIG --exists --print-errors "rdkafka") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rdkafka >= 0.9.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "rdkafka >= 0.9.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBRDKAFKA_CFLAGS=`$PKG_CONFIG --cflags "rdkafka" 2>/dev/null` + pkg_cv_LIBRDKAFKA_CFLAGS=`$PKG_CONFIG --cflags "rdkafka >= 0.9.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -24961,12 +25102,12 @@ pkg_cv_LIBRDKAFKA_LIBS="$LIBRDKAFKA_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rdkafka\""; } >&5 - ($PKG_CONFIG --exists --print-errors "rdkafka") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rdkafka >= 0.9.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "rdkafka >= 0.9.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBRDKAFKA_LIBS=`$PKG_CONFIG --libs "rdkafka" 2>/dev/null` + pkg_cv_LIBRDKAFKA_LIBS=`$PKG_CONFIG --libs "rdkafka >= 0.9.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -24987,9 +25128,9 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBRDKAFKA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rdkafka" 2>&1` + LIBRDKAFKA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rdkafka >= 0.9.1" 2>&1` else - LIBRDKAFKA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rdkafka" 2>&1` + LIBRDKAFKA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rdkafka >= 0.9.1" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBRDKAFKA_PKG_ERRORS" >&5 @@ -25055,9 +25196,9 @@ echo "$LIBRDKAFKA_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_produce in -lrdkafka" >&5 -$as_echo_n "checking for rd_kafka_produce in -lrdkafka... " >&6; } -if ${ac_cv_lib_rdkafka_rd_kafka_produce+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_last_error in -lrdkafka" >&5 +$as_echo_n "checking for rd_kafka_last_error in -lrdkafka... " >&6; } +if ${ac_cv_lib_rdkafka_rd_kafka_last_error+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25071,27 +25212,27 @@ #ifdef __cplusplus extern "C" #endif -char rd_kafka_produce (); +char rd_kafka_last_error (); int main () { -return rd_kafka_produce (); +return rd_kafka_last_error (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rdkafka_rd_kafka_produce=yes + ac_cv_lib_rdkafka_rd_kafka_last_error=yes else - ac_cv_lib_rdkafka_rd_kafka_produce=no + ac_cv_lib_rdkafka_rd_kafka_last_error=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_produce" >&5 -$as_echo "$ac_cv_lib_rdkafka_rd_kafka_produce" >&6; } -if test "x$ac_cv_lib_rdkafka_rd_kafka_produce" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_last_error" >&5 +$as_echo "$ac_cv_lib_rdkafka_rd_kafka_last_error" >&6; } +if test "x$ac_cv_lib_rdkafka_rd_kafka_last_error" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: librdkafka is missing but library present, using -lrdkafka" >&5 $as_echo "$as_me: WARNING: librdkafka is missing but library present, using -lrdkafka" >&2;} @@ -25099,7 +25240,16 @@ else - as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + if test "$enable_omkafka" = "yes"; then : + as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: omkafka: no suiteable build environment, use omkafka dummy" >&5 +$as_echo "$as_me: omkafka: no suiteable build environment, use omkafka dummy" >&6;} + omkafka_use_dummy=yes + +$as_echo "#define ENABLE_OMKAFKA_DUMMY 1" >>confdefs.h + fi @@ -25108,9 +25258,9 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_produce in -lrdkafka" >&5 -$as_echo_n "checking for rd_kafka_produce in -lrdkafka... " >&6; } -if ${ac_cv_lib_rdkafka_rd_kafka_produce+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_last_error in -lrdkafka" >&5 +$as_echo_n "checking for rd_kafka_last_error in -lrdkafka... " >&6; } +if ${ac_cv_lib_rdkafka_rd_kafka_last_error+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25124,27 +25274,27 @@ #ifdef __cplusplus extern "C" #endif -char rd_kafka_produce (); +char rd_kafka_last_error (); int main () { -return rd_kafka_produce (); +return rd_kafka_last_error (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rdkafka_rd_kafka_produce=yes + ac_cv_lib_rdkafka_rd_kafka_last_error=yes else - ac_cv_lib_rdkafka_rd_kafka_produce=no + ac_cv_lib_rdkafka_rd_kafka_last_error=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_produce" >&5 -$as_echo "$ac_cv_lib_rdkafka_rd_kafka_produce" >&6; } -if test "x$ac_cv_lib_rdkafka_rd_kafka_produce" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_last_error" >&5 +$as_echo "$ac_cv_lib_rdkafka_rd_kafka_last_error" >&6; } +if test "x$ac_cv_lib_rdkafka_rd_kafka_last_error" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: librdkafka is missing but library present, using -lrdkafka" >&5 $as_echo "$as_me: WARNING: librdkafka is missing but library present, using -lrdkafka" >&2;} @@ -25152,7 +25302,16 @@ else - as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + if test "$enable_omkafka" = "yes"; then : + as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: omkafka: no suiteable build environment, use omkafka dummy" >&5 +$as_echo "$as_me: omkafka: no suiteable build environment, use omkafka dummy" >&6;} + omkafka_use_dummy=yes + +$as_echo "#define ENABLE_OMKAFKA_DUMMY 1" >>confdefs.h + fi @@ -25229,9 +25388,9 @@ echo "$LIBRDKAFKA_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_produce in -lrdkafka" >&5 -$as_echo_n "checking for rd_kafka_produce in -lrdkafka... " >&6; } -if ${ac_cv_lib_rdkafka_rd_kafka_produce+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_last_error in -lrdkafka" >&5 +$as_echo_n "checking for rd_kafka_last_error in -lrdkafka... " >&6; } +if ${ac_cv_lib_rdkafka_rd_kafka_last_error+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25245,27 +25404,27 @@ #ifdef __cplusplus extern "C" #endif -char rd_kafka_produce (); +char rd_kafka_last_error (); int main () { -return rd_kafka_produce (); +return rd_kafka_last_error (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rdkafka_rd_kafka_produce=yes + ac_cv_lib_rdkafka_rd_kafka_last_error=yes else - ac_cv_lib_rdkafka_rd_kafka_produce=no + ac_cv_lib_rdkafka_rd_kafka_last_error=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_produce" >&5 -$as_echo "$ac_cv_lib_rdkafka_rd_kafka_produce" >&6; } -if test "x$ac_cv_lib_rdkafka_rd_kafka_produce" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_last_error" >&5 +$as_echo "$ac_cv_lib_rdkafka_rd_kafka_last_error" >&6; } +if test "x$ac_cv_lib_rdkafka_rd_kafka_last_error" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: librdkafka is missing but library present, using -lrdkafka" >&5 $as_echo "$as_me: WARNING: librdkafka is missing but library present, using -lrdkafka" >&2;} @@ -25273,7 +25432,16 @@ else - as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + if test "$enable_omkafka" = "yes"; then : + as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: omkafka: no suiteable build environment, use omkafka dummy" >&5 +$as_echo "$as_me: omkafka: no suiteable build environment, use omkafka dummy" >&6;} + omkafka_use_dummy=yes + +$as_echo "#define ENABLE_OMKAFKA_DUMMY 1" >>confdefs.h + fi @@ -25282,9 +25450,9 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_produce in -lrdkafka" >&5 -$as_echo_n "checking for rd_kafka_produce in -lrdkafka... " >&6; } -if ${ac_cv_lib_rdkafka_rd_kafka_produce+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_last_error in -lrdkafka" >&5 +$as_echo_n "checking for rd_kafka_last_error in -lrdkafka... " >&6; } +if ${ac_cv_lib_rdkafka_rd_kafka_last_error+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25298,27 +25466,27 @@ #ifdef __cplusplus extern "C" #endif -char rd_kafka_produce (); +char rd_kafka_last_error (); int main () { -return rd_kafka_produce (); +return rd_kafka_last_error (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rdkafka_rd_kafka_produce=yes + ac_cv_lib_rdkafka_rd_kafka_last_error=yes else - ac_cv_lib_rdkafka_rd_kafka_produce=no + ac_cv_lib_rdkafka_rd_kafka_last_error=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_produce" >&5 -$as_echo "$ac_cv_lib_rdkafka_rd_kafka_produce" >&6; } -if test "x$ac_cv_lib_rdkafka_rd_kafka_produce" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_last_error" >&5 +$as_echo "$ac_cv_lib_rdkafka_rd_kafka_last_error" >&6; } +if test "x$ac_cv_lib_rdkafka_rd_kafka_last_error" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: librdkafka is missing but library present, using -lrdkafka" >&5 $as_echo "$as_me: WARNING: librdkafka is missing but library present, using -lrdkafka" >&2;} @@ -25326,7 +25494,16 @@ else - as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + if test "$enable_omkafka" = "yes"; then : + as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: omkafka: no suiteable build environment, use omkafka dummy" >&5 +$as_echo "$as_me: omkafka: no suiteable build environment, use omkafka dummy" >&6;} + omkafka_use_dummy=yes + +$as_echo "#define ENABLE_OMKAFKA_DUMMY 1" >>confdefs.h + fi @@ -25346,6 +25523,16 @@ $as_echo "yes" >&6; } fi +fi + if test x$omkafka_use_dummy = xyes; then + OMKAFKA_USE_DUMMY_TRUE= + OMKAFKA_USE_DUMMY_FALSE='#' +else + OMKAFKA_USE_DUMMY_TRUE='#' + OMKAFKA_USE_DUMMY_FALSE= +fi + +if test "$enable_omkafka" = "yes" -o "$enable_omkafka" = "optional" && test "$omkafka_use_dummy" = "no"; then for ac_header in librdkafka/rdkafka.h do : ac_fn_c_check_header_mongrel "$LINENO" "librdkafka/rdkafka.h" "ac_cv_header_librdkafka_rdkafka_h" "$ac_includes_default" @@ -25533,8 +25720,9 @@ fi fi +imkafka_use_dummy="no" # imkafka needs newer library -if test "x$enable_imkafka" = "xyes"; then +if test "x$enable_imkafka" = "xyes" -o "$enable_imkafka" = "optional"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBRDKAFKA" >&5 @@ -25595,9 +25783,9 @@ echo "$LIBRDKAFKA_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_produce in -lrdkafka" >&5 -$as_echo_n "checking for rd_kafka_produce in -lrdkafka... " >&6; } -if ${ac_cv_lib_rdkafka_rd_kafka_produce+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_consumer_poll in -lrdkafka" >&5 +$as_echo_n "checking for rd_kafka_consumer_poll in -lrdkafka... " >&6; } +if ${ac_cv_lib_rdkafka_rd_kafka_consumer_poll+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25611,27 +25799,27 @@ #ifdef __cplusplus extern "C" #endif -char rd_kafka_produce (); +char rd_kafka_consumer_poll (); int main () { -return rd_kafka_produce (); +return rd_kafka_consumer_poll (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rdkafka_rd_kafka_produce=yes + ac_cv_lib_rdkafka_rd_kafka_consumer_poll=yes else - ac_cv_lib_rdkafka_rd_kafka_produce=no + ac_cv_lib_rdkafka_rd_kafka_consumer_poll=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_produce" >&5 -$as_echo "$ac_cv_lib_rdkafka_rd_kafka_produce" >&6; } -if test "x$ac_cv_lib_rdkafka_rd_kafka_produce" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_consumer_poll" >&5 +$as_echo "$ac_cv_lib_rdkafka_rd_kafka_consumer_poll" >&6; } +if test "x$ac_cv_lib_rdkafka_rd_kafka_consumer_poll" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: librdkafka is missing but library present, using -lrdkafka" >&5 $as_echo "$as_me: WARNING: librdkafka is missing but library present, using -lrdkafka" >&2;} @@ -25639,7 +25827,16 @@ else - as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + if test "$enable_imkafka" = "yes"; then : + as_fn_error $? "could not find sufficiently current rdkafka library" "$LINENO" 5 + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: imkafka: no suiteable build environment, use imkafka dummy" >&5 +$as_echo "$as_me: imkafka: no suiteable build environment, use imkafka dummy" >&6;} + imkafka_use_dummy=yes + +$as_echo "#define ENABLE_IMKAFKA_DUMMY 1" >>confdefs.h + fi @@ -25648,9 +25845,9 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_produce in -lrdkafka" >&5 -$as_echo_n "checking for rd_kafka_produce in -lrdkafka... " >&6; } -if ${ac_cv_lib_rdkafka_rd_kafka_produce+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rd_kafka_consumer_poll in -lrdkafka" >&5 +$as_echo_n "checking for rd_kafka_consumer_poll in -lrdkafka... " >&6; } +if ${ac_cv_lib_rdkafka_rd_kafka_consumer_poll+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -25664,27 +25861,27 @@ #ifdef __cplusplus extern "C" #endif -char rd_kafka_produce (); +char rd_kafka_consumer_poll (); int main () { -return rd_kafka_produce (); +return rd_kafka_consumer_poll (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rdkafka_rd_kafka_produce=yes + ac_cv_lib_rdkafka_rd_kafka_consumer_poll=yes else - ac_cv_lib_rdkafka_rd_kafka_produce=no + ac_cv_lib_rdkafka_rd_kafka_consumer_poll=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_produce" >&5 -$as_echo "$ac_cv_lib_rdkafka_rd_kafka_produce" >&6; } -if test "x$ac_cv_lib_rdkafka_rd_kafka_produce" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rdkafka_rd_kafka_consumer_poll" >&5 +$as_echo "$ac_cv_lib_rdkafka_rd_kafka_consumer_poll" >&6; } +if test "x$ac_cv_lib_rdkafka_rd_kafka_consumer_poll" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: librdkafka is missing but library present, using -lrdkafka" >&5 $as_echo "$as_me: WARNING: librdkafka is missing but library present, using -lrdkafka" >&2;} @@ -25692,7 +25889,16 @@ else - as_fn_error $? "could not find rdkafka library" "$LINENO" 5 + if test "$enable_imkafka" = "yes"; then : + as_fn_error $? "could not find sufficiently current rdkafka library" "$LINENO" 5 + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: imkafka: no suiteable build environment, use imkafka dummy" >&5 +$as_echo "$as_me: imkafka: no suiteable build environment, use imkafka dummy" >&6;} + imkafka_use_dummy=yes + +$as_echo "#define ENABLE_IMKAFKA_DUMMY 1" >>confdefs.h + fi @@ -25704,6 +25910,16 @@ $as_echo "yes" >&6; } fi +fi + if test x$imkafka_use_dummy = xyes; then + IMKAFKA_USE_DUMMY_TRUE= + IMKAFKA_USE_DUMMY_FALSE='#' +else + IMKAFKA_USE_DUMMY_TRUE='#' + IMKAFKA_USE_DUMMY_FALSE= +fi + +if test "$enable_imkafka" = "yes" -o "$enable_imkafka" = "optional" && test "$imkafka_use_dummy" = "no"; then for ac_header in librdkafka/rdkafka.h do : ac_fn_c_check_header_mongrel "$LINENO" "librdkafka/rdkafka.h" "ac_cv_header_librdkafka_rdkafka_h" "$ac_includes_default" @@ -25992,7 +26208,7 @@ JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 25995 "configure" */ +/* #line 26211 "configure" */ public class Test { } EOF @@ -26208,7 +26424,7 @@ JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 26211 "configure" */ +/* #line 26427 "configure" */ public class Test { } EOF @@ -26242,7 +26458,7 @@ CLASS_TEST=Test.class TEST=Test cat << \EOF > $JAVA_TEST -/* [#]line 26245 "configure" */ +/* [#]line 26461 "configure" */ public class Test { public static void main (String args[]) { System.exit (0); @@ -26376,7 +26592,7 @@ enable_kafka_tests="no" fi fi - if test x$enable_omkafka = xyes; then + if test x$enable_omkafka = xyes -o x$enable_omkafka = xoptional; then ENABLE_OMKAFKA_TRUE= ENABLE_OMKAFKA_FALSE='#' else @@ -26384,7 +26600,7 @@ ENABLE_OMKAFKA_FALSE= fi - if test x$enable_imkafka = xyes; then + if test x$enable_imkafka = xyes -o x$enable_imkafka = xoptional; then ENABLE_IMKAFKA_TRUE= ENABLE_IMKAFKA_FALSE='#' else @@ -26546,12 +26762,12 @@ pkg_cv_CZMQ_CFLAGS="$CZMQ_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 3.0.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libczmq >= 3.0.0") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 4.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libczmq >= 4.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CZMQ_CFLAGS=`$PKG_CONFIG --cflags "libczmq >= 3.0.0" 2>/dev/null` + pkg_cv_CZMQ_CFLAGS=`$PKG_CONFIG --cflags "libczmq >= 4.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26563,12 +26779,12 @@ pkg_cv_CZMQ_LIBS="$CZMQ_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 3.0.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libczmq >= 3.0.0") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 4.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libczmq >= 4.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CZMQ_LIBS=`$PKG_CONFIG --libs "libczmq >= 3.0.0" 2>/dev/null` + pkg_cv_CZMQ_LIBS=`$PKG_CONFIG --libs "libczmq >= 4.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26589,14 +26805,14 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CZMQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libczmq >= 3.0.0" 2>&1` + CZMQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libczmq >= 4.0.0" 2>&1` else - CZMQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libczmq >= 3.0.0" 2>&1` + CZMQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libczmq >= 4.0.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CZMQ_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (libczmq >= 3.0.0) were not met: + as_fn_error $? "Package requirements (libczmq >= 4.0.0) were not met: $CZMQ_PKG_ERRORS @@ -26664,12 +26880,12 @@ pkg_cv_CZMQ_CFLAGS="$CZMQ_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 3.0.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libczmq >= 3.0.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 4.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libczmq >= 4.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CZMQ_CFLAGS=`$PKG_CONFIG --cflags "libczmq >= 3.0.2" 2>/dev/null` + pkg_cv_CZMQ_CFLAGS=`$PKG_CONFIG --cflags "libczmq >= 4.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26681,12 +26897,12 @@ pkg_cv_CZMQ_LIBS="$CZMQ_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 3.0.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libczmq >= 3.0.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libczmq >= 4.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libczmq >= 4.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CZMQ_LIBS=`$PKG_CONFIG --libs "libczmq >= 3.0.2" 2>/dev/null` + pkg_cv_CZMQ_LIBS=`$PKG_CONFIG --libs "libczmq >= 4.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26707,14 +26923,14 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CZMQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libczmq >= 3.0.2" 2>&1` + CZMQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libczmq >= 4.0.0" 2>&1` else - CZMQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libczmq >= 3.0.2" 2>&1` + CZMQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libczmq >= 4.0.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CZMQ_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (libczmq >= 3.0.2) were not met: + as_fn_error $? "Package requirements (libczmq >= 4.0.0) were not met: $CZMQ_PKG_ERRORS @@ -28172,7 +28388,7 @@ fi -ac_config_files="$ac_config_files Makefile runtime/Makefile compat/Makefile grammar/Makefile tools/Makefile plugins/imudp/Makefile plugins/imtcp/Makefile plugins/im3195/Makefile plugins/imgssapi/Makefile plugins/imuxsock/Makefile plugins/imjournal/Makefile plugins/immark/Makefile plugins/imklog/Makefile plugins/omhdfs/Makefile plugins/omkafka/Makefile plugins/omprog/Makefile plugins/mmexternal/Makefile plugins/omstdout/Makefile plugins/omjournal/Makefile plugins/pmciscoios/Makefile plugins/pmnull/Makefile plugins/pmnormalize/Makefile plugins/omruleset/Makefile plugins/omuxsock/Makefile plugins/imfile/Makefile plugins/imsolaris/Makefile plugins/imptcp/Makefile plugins/impstats/Makefile plugins/imrelp/Makefile plugins/imdiag/Makefile plugins/imkafka/Makefile plugins/omtesting/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile plugins/omrelp/Makefile plugins/omlibdbi/Makefile plugins/ommail/Makefile plugins/fmhttp/Makefile plugins/omsnmp/Makefile plugins/omudpspoof/Makefile plugins/ommongodb/Makefile plugins/mmnormalize/Makefile plugins/mmjsonparse/Makefile plugins/mmaudit/Makefile plugins/mmanon/Makefile plugins/mmrm1stspace/Makefile plugins/mmutf8fix/Makefile plugins/mmfields/Makefile plugins/mmpstrucdata/Makefile plugins/omelasticsearch/Makefile plugins/omclickhouse/Makefile plugins/mmsnmptrapd/Makefile plugins/pmlastmsg/Makefile plugins/mmdblookup/Makefile contrib/mmdarwin/Makefile contrib/omhttp/Makefile contrib/fmhash/Makefile contrib/pmsnare/Makefile contrib/pmpanngfw/Makefile contrib/pmaixforwardedfrom/Makefile contrib/omhiredis/Makefile contrib/omrabbitmq/Makefile contrib/imkmsg/Makefile contrib/mmgrok/Makefile contrib/mmcount/Makefile contrib/omczmq/Makefile contrib/imczmq/Makefile contrib/mmsequence/Makefile contrib/mmrfc5424addhmac/Makefile contrib/pmcisconames/Makefile contrib/omhttpfs/Makefile contrib/omamqp1/Makefile contrib/omtcl/Makefile contrib/imbatchreport/Makefile contrib/omfile-hardened/Makefile contrib/mmkubernetes/Makefile contrib/imtuxedoulog/Makefile contrib/improg/Makefile contrib/mmtaghostname/Makefile contrib/imdocker/Makefile contrib/pmdb2diag/Makefile tests/set-envvars tests/Makefile" +ac_config_files="$ac_config_files Makefile runtime/Makefile compat/Makefile grammar/Makefile tools/Makefile plugins/imudp/Makefile plugins/imtcp/Makefile plugins/im3195/Makefile plugins/imgssapi/Makefile plugins/imuxsock/Makefile plugins/imjournal/Makefile plugins/immark/Makefile plugins/imklog/Makefile plugins/omhdfs/Makefile plugins/omkafka/Makefile plugins/omprog/Makefile plugins/mmexternal/Makefile plugins/omstdout/Makefile plugins/omjournal/Makefile plugins/pmciscoios/Makefile plugins/pmnull/Makefile plugins/pmnormalize/Makefile plugins/omruleset/Makefile plugins/omuxsock/Makefile plugins/imfile/Makefile plugins/imsolaris/Makefile plugins/imptcp/Makefile plugins/impstats/Makefile plugins/imrelp/Makefile plugins/imdiag/Makefile plugins/imkafka/Makefile plugins/omtesting/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile plugins/omrelp/Makefile plugins/omlibdbi/Makefile plugins/ommail/Makefile plugins/fmhttp/Makefile plugins/omsnmp/Makefile plugins/omudpspoof/Makefile plugins/ommongodb/Makefile plugins/mmnormalize/Makefile plugins/mmjsonparse/Makefile plugins/mmaudit/Makefile plugins/mmanon/Makefile plugins/mmrm1stspace/Makefile plugins/mmutf8fix/Makefile plugins/mmfields/Makefile plugins/mmpstrucdata/Makefile plugins/omelasticsearch/Makefile plugins/omclickhouse/Makefile plugins/mmsnmptrapd/Makefile plugins/pmlastmsg/Makefile plugins/mmdblookup/Makefile contrib/mmdarwin/Makefile contrib/omhttp/Makefile contrib/fmhash/Makefile contrib/pmsnare/Makefile contrib/pmpanngfw/Makefile contrib/pmaixforwardedfrom/Makefile contrib/omhiredis/Makefile contrib/omrabbitmq/Makefile contrib/imkmsg/Makefile contrib/mmgrok/Makefile contrib/mmcount/Makefile contrib/omczmq/Makefile contrib/imczmq/Makefile contrib/mmsequence/Makefile contrib/mmrfc5424addhmac/Makefile contrib/pmcisconames/Makefile contrib/omhttpfs/Makefile contrib/omamqp1/Makefile contrib/omtcl/Makefile contrib/imbatchreport/Makefile contrib/omfile-hardened/Makefile contrib/mmkubernetes/Makefile contrib/impcap/Makefile contrib/imtuxedoulog/Makefile contrib/improg/Makefile contrib/mmtaghostname/Makefile contrib/imdocker/Makefile contrib/pmdb2diag/Makefile tests/set-envvars tests/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -28403,6 +28619,10 @@ as_fn_error $? "conditional \"ENABLE_PGSQL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LIBDBI_USE_DUMMY_TRUE}" && test -z "${LIBDBI_USE_DUMMY_FALSE}"; then + as_fn_error $? "conditional \"LIBDBI_USE_DUMMY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_OMLIBDBI_TRUE}" && test -z "${ENABLE_OMLIBDBI_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OMLIBDBI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -28451,6 +28671,10 @@ as_fn_error $? "conditional \"ENABLE_GNUTLS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_GNUTLS_TESTS_TRUE}" && test -z "${ENABLE_GNUTLS_TESTS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_GNUTLS_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_LIBGCRYPT_TRUE}" && test -z "${ENABLE_LIBGCRYPT_FALSE}"; then as_fn_error $? "conditional \"ENABLE_LIBGCRYPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -28531,6 +28755,10 @@ as_fn_error $? "conditional \"ENABLE_MMDBLOOKUP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MMDBLOOKUP_USE_DUMMY_TRUE}" && test -z "${MMDBLOOKUP_USE_DUMMY_FALSE}"; then + as_fn_error $? "conditional \"MMDBLOOKUP_USE_DUMMY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_MMDARWIN_TRUE}" && test -z "${ENABLE_MMDARWIN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_MMDARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -28635,6 +28863,10 @@ as_fn_error $? "conditional \"ENABLE_IMPSTATS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_IMPCAP_TRUE}" && test -z "${ENABLE_IMPCAP_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_IMPCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_OMPROG_TRUE}" && test -z "${ENABLE_OMPROG_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OMPROG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -28715,6 +28947,14 @@ as_fn_error $? "conditional \"ENABLE_KAFKA_STATIC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${OMKAFKA_USE_DUMMY_TRUE}" && test -z "${OMKAFKA_USE_DUMMY_FALSE}"; then + as_fn_error $? "conditional \"OMKAFKA_USE_DUMMY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${IMKAFKA_USE_DUMMY_TRUE}" && test -z "${IMKAFKA_USE_DUMMY_FALSE}"; then + as_fn_error $? "conditional \"IMKAFKA_USE_DUMMY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_OMKAFKA_TRUE}" && test -z "${ENABLE_OMKAFKA_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OMKAFKA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -29168,7 +29408,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rsyslog $as_me 8.2001.0, which was +This file was extended by rsyslog $as_me 8.2006.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -29234,7 +29474,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -rsyslog config.status 8.2001.0 +rsyslog config.status 8.2006.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -29726,6 +29966,7 @@ "contrib/imbatchreport/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/imbatchreport/Makefile" ;; "contrib/omfile-hardened/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/omfile-hardened/Makefile" ;; "contrib/mmkubernetes/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/mmkubernetes/Makefile" ;; + "contrib/impcap/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/impcap/Makefile" ;; "contrib/imtuxedoulog/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/imtuxedoulog/Makefile" ;; "contrib/improg/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/improg/Makefile" ;; "contrib/mmtaghostname/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/mmtaghostname/Makefile" ;; @@ -31037,6 +31278,10 @@ echo " imjournal input module enabled: $enable_imjournal" echo " imbatchreport input module enabled: $enable_imbatchreport" echo " imkafka module will be compiled: $enable_imkafka" +if test "$enable_imkafka" = "optional"; then +echo " imkafka use dummy: $imkafka_use_dummy" +fi +echo " impcap input module enabled: $enable_impcap" echo " imtuxedoulog module will be compiled: $enable_imtuxedoulog" echo " improg input module enabled: $enable_improg" echo @@ -31091,6 +31336,9 @@ echo "---{ database support }---" echo " MySql support enabled: $enable_mysql" echo " libdbi support enabled: $enable_libdbi" +if test "$enable_libdbi" = "optional"; then +echo " libdbi use dummy: $libdbi_use_dummy" +fi echo " PostgreSQL support enabled: $enable_pgsql" echo " mongodb support enabled: $enable_ommongodb" echo " hiredis support enabled: $enable_omhiredis" @@ -31121,6 +31369,8 @@ echo " PostgreSQL Tests enabled: $enable_pgsql_tests" echo " Kafka Tests enabled: $enable_kafka_tests" echo " Imdocker Tests enabled: $enable_imdocker_tests" +echo " gnutls tests enabled: $enable_gnutls_tests" +echo " imfile tests enabled: $enable_imfile_tests" echo " systemd journal tests enabled: $enable_journal_tests" echo " SNMP Tests enabled: $enable_snmp_tests" echo " Debug mode enabled: $enable_debug" diff -Nru rsyslog-8.2001.0/configure.ac rsyslog-8.2006.0/configure.ac --- rsyslog-8.2001.0/configure.ac 2020-01-14 12:59:05.000000000 +0000 +++ rsyslog-8.2006.0/configure.ac 2020-06-22 12:57:35.000000000 +0000 @@ -2,9 +2,9 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[8.2001.0],[rsyslog@lists.adiscon.com]) # UPDATE on release +AC_INIT([rsyslog],[8.2006.0],[rsyslog@lists.adiscon.com]) # UPDATE on release AC_DEFINE(VERSION_YEAR, 20, [year part of real rsyslog version]) # UPDATE on release -AC_DEFINE(VERSION_MONTH,01, [month part of real rsyslog version]) # UPDATE on release +AC_DEFINE(VERSION_MONTH,06, [month part of real rsyslog version]) # UPDATE on release AM_INIT_AUTOMAKE([subdir-objects]) @@ -845,22 +845,32 @@ [case "${enableval}" in yes) enable_libdbi="yes" ;; no) enable_libdbi="no" ;; + optional) enable_libdbi="optional" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdbi) ;; esac], [enable_libdbi=no] ) -if test "x$enable_libdbi" = "xyes"; then +libdbi_use_dummy="no" +if test "x$enable_libdbi" = "xyes" -o x$enable_libdbi = xoptional; then AC_CHECK_HEADERS( - [dbi/dbi.h],, - [AC_MSG_FAILURE([libdbi is missing])] + [dbi/dbi.h],,[ + AS_IF([test x$enable_libdbi = xyes], + AC_MSG_FAILURE([libdbi is missing]) + ) + libdbi_use_dummy="yes" + ] ) AC_CHECK_LIB( [dbi], [dbi_initialize], [LIBDBI_CFLAGS="" LIBDBI_LIBS="-ldbi" - ], - [AC_MSG_FAILURE([libdbi library is missing])] + ], [ + AS_IF([test x$enable_libdbi = xyes], + AC_MSG_FAILURE([libdbi is missing]) + ) + libdbi_use_dummy="yes" + ] ) AC_CHECK_LIB( [dbi], @@ -873,10 +883,12 @@ [AC_DEFINE([HAVE_DBI_TXSUPP], [1], [Define to 1 if libdbi supports transactions])] ) fi -AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes) +AM_CONDITIONAL(LIBDBI_USE_DUMMY, test x$libdbi_use_dummy = xyes) +AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes -o x$enable_libdbi = xoptional) AC_SUBST(LIBDBI_CFLAGS) AC_SUBST(LIBDBI_LIBS) + # SNMP support AC_ARG_ENABLE(snmp, [AS_HELP_STRING([--enable-snmp],[Enable SNMP support @<:@default=no@:>@])], @@ -1057,6 +1069,27 @@ AM_CONDITIONAL(ENABLE_GNUTLS, test x$enable_gnutls = xyes) +AC_ARG_ENABLE(gnutls-tests, + [AS_HELP_STRING([--enable-gnutls-tests],[Enable gnutls tests @<:@default=yes@:>@])], + [case "${enableval}" in + yes) enable_gnutls_tests="yes" ;; + no) enable_gnutls_tests="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-gnutls-tests) ;; + esac], + [if [[ "$enable_gnutls" == "yes" ]]; then + enable_gnutls_tests=yes + else + enable_gnutls_tests=no + fi] +) +if [[ "$enable_gnutls_tests" == "yes" ]] && [[ "$enable_gnutls" != "yes" ]]; then + AC_MSG_WARN([gnutls-tests can not be enabled without gnutls support. Disabling gnutls tests...]) + enable_gnutls_tests="no" +fi + +AM_CONDITIONAL(ENABLE_GNUTLS_TESTS, test x$enable_gnutls_tests = xyes) + + # libgcrypt support AC_ARG_ENABLE(libgcrypt, [AS_HELP_STRING([--enable-libgcrypt],[Enable log file encryption support (libgcrypt) @<:@default=yes@:>@])], @@ -1377,16 +1410,25 @@ [case "${enableval}" in yes) enable_mmdblookup="yes" ;; no) enable_mmdblookup="no" ;; + optional) enable_mmdblookup="optional" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmdblookup) ;; esac], [enable_mmdblookup=no] ) -if test "x$enable_mmdblookup"; then - #PKG_CHECK_MODULES(LIBMAXMINDDB, libmaxminddb) - AC_CHECK_HEADERS([maxminddb.h]) +AM_CONDITIONAL(ENABLE_MMDBLOOKUP, test x$enable_mmdblookup = xyes -o x$enable_mmdblookup = xoptional) +mmdblookup_use_dummy="no" +if test x$enable_mmdblookup = xoptional -o x$enable_mmdblookup = xyes; then + #PKG_CHECK_MODULES(LIBMAXMINDDB, libmaxminddb) -- does not work - later? + AC_CHECK_HEADERS([maxminddb.h], [ + ], [ + AS_IF([test x$enable_mmdblookup = xyes], + AC_MSG_ERROR(libmaxminddb library for mmdblookup could not be found) + ) + mmdblookup_use_dummy="yes" + AC_DEFINE([ENABLE_MMBDLOOKUP_DUMMY], [1], [Indicator that we need to build a dummy module]) + ]) fi -AM_CONDITIONAL(ENABLE_MMDBLOOKUP, test x$enable_mmdblookup = xyes) - +AM_CONDITIONAL(MMDBLOOKUP_USE_DUMMY, test x$mmdblookup_use_dummy = xyes) # mmdarwin @@ -1702,16 +1744,21 @@ AM_CONDITIONAL(ENABLE_IMFILE, test x$enable_imfile = xyes) AC_ARG_ENABLE(imfile-tests, - [AS_HELP_STRING([--enable-imfile-tests],[Enable imfile tests @<:@default=no@:>@])], + [AS_HELP_STRING([--enable-imfile-tests],[Enable imfile tests @<:@default=yes@:>@])], [case "${enableval}" in yes) enable_imfile_tests="yes" ;; no) enable_imfile_tests="no" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-imfile-tests) ;; esac], - [enable_file_tests=no] + [enable_imfile_tests=yes] ) +if [[ "$enable_imfile_tests" == "yes" ]] && [[ "$enable_imfile" != "yes" ]]; then + AC_MSG_WARN([imfile-tests can not be enabled without imfile support. Disabling imfile tests...]) + enable_imfile_tests="no" +fi AM_CONDITIONAL(ENABLE_IMFILE_TESTS, test x$enable_imfile_tests = xyes) + # settings for the docker log input module AC_ARG_ENABLE(imdocker, [AS_HELP_STRING([--enable-imdocker],[input docker module enabled @<:@default=no@:>@])], @@ -1802,6 +1849,24 @@ ) AM_CONDITIONAL(ENABLE_IMPSTATS, test x$enable_impstats = xyes) +# settings for the pcap input module +AC_ARG_ENABLE(impcap, + [AS_HELP_STRING([--enable-impcap],[libpcap input module enabled @<:@default=no@:>@])], + [case "${enableval}" in + yes) enable_impcap="yes" ;; + no) enable_impcap="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-impcap) ;; + esac], + [enable_impcap=no] +) + +if test "x$enable_impcap" = "xyes"; then + AC_CHECK_HEADERS([pcap.h], + [AC_MSG_NOTICE([pcap found])], + AC_MSG_ERROR([libpcap library and headers not found]) + ) +fi +AM_CONDITIONAL(ENABLE_IMPCAP, test x$enable_impcap = xyes) # settings for the omprog output module AC_ARG_ENABLE(omprog, @@ -2067,6 +2132,7 @@ [case "${enableval}" in yes) enable_omkafka="yes" ;; no) enable_omkafka="no" ;; + optional) enable_omkafka="optional" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-omkafka) ;; esac], [enable_omkafka=no] @@ -2076,6 +2142,7 @@ [case "${enableval}" in yes) enable_imkafka="yes" ;; no) enable_imkafka="no" ;; + optional) enable_imkafka="optional" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-imkafka) ;; esac], [enable_imkafka=no] @@ -2104,17 +2171,26 @@ AM_CONDITIONAL(ENABLE_KAFKA_STATIC, test x$enable_kafka_static = xyes) # omkafka works with older library -if test "x$enable_omkafka" = "xyes"; then - PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka],, [ +omkafka_use_dummy="no" +if test "$enable_omkafka" = "yes" -o "$enable_omkafka" = "optional"; then + PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka >= 0.9.1],, [ PKG_CHECK_MODULES([LIBRDKAFKA], [librdkafka],, [ - AC_CHECK_LIB([rdkafka], [rd_kafka_produce], [ + AC_CHECK_LIB([rdkafka], [rd_kafka_last_error], [ AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka]) LIBRDKAFKA_LIBS=-lrdkafka ], [ - AC_MSG_ERROR([could not find rdkafka library]) + AS_IF([test "$enable_omkafka" = "yes"], + AC_MSG_ERROR([could not find rdkafka library]) + ) + AC_MSG_NOTICE([omkafka: no suiteable build environment, use omkafka dummy]) + omkafka_use_dummy=yes + AC_DEFINE([ENABLE_OMKAFKA_DUMMY], [1], [Indicator that we need to build a dummy omkafka module]) ]) ]) ]) +fi +AM_CONDITIONAL(OMKAFKA_USE_DUMMY, test x$omkafka_use_dummy = xyes) +if test "$enable_omkafka" = "yes" -o "$enable_omkafka" = "optional" && test "$omkafka_use_dummy" = "no"; then AC_CHECK_HEADERS([librdkafka/rdkafka.h]) # Add additional dependencies if statically linking rdkafka @@ -2130,16 +2206,25 @@ fi fi +imkafka_use_dummy="no" # imkafka needs newer library -if test "x$enable_imkafka" = "xyes"; then +if test "x$enable_imkafka" = "xyes" -o "$enable_imkafka" = "optional"; then PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka >= 0.9.1],, [ - AC_CHECK_LIB([rdkafka], [rd_kafka_produce], [ + AC_CHECK_LIB([rdkafka], [rd_kafka_consumer_poll], [ AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka]) LIBRDKAFKA_LIBS=-lrdkafka ], [ - AC_MSG_ERROR([could not find rdkafka library]) + AS_IF([test "$enable_imkafka" = "yes"], + AC_MSG_ERROR([could not find sufficiently current rdkafka library]) + ) + AC_MSG_NOTICE([imkafka: no suiteable build environment, use imkafka dummy]) + imkafka_use_dummy=yes + AC_DEFINE([ENABLE_IMKAFKA_DUMMY], [1], [Indicator that we need to build a dummy imkafka module]) ]) ]) +fi +AM_CONDITIONAL(IMKAFKA_USE_DUMMY, test x$imkafka_use_dummy = xyes) +if test "$enable_imkafka" = "yes" -o "$enable_imkafka" = "optional" && test "$imkafka_use_dummy" = "no"; then AC_CHECK_HEADERS([librdkafka/rdkafka.h]) # Add additional dependencies if statically linking rdkafka @@ -2174,8 +2259,8 @@ enable_kafka_tests="no" fi fi -AM_CONDITIONAL(ENABLE_OMKAFKA, test x$enable_omkafka = xyes) -AM_CONDITIONAL(ENABLE_IMKAFKA, test x$enable_imkafka = xyes) +AM_CONDITIONAL(ENABLE_OMKAFKA, test x$enable_omkafka = xyes -o x$enable_omkafka = xoptional) +AM_CONDITIONAL(ENABLE_IMKAFKA, test x$enable_imkafka = xyes -o x$enable_imkafka = xoptional) #MONGODB SUPPORT @@ -2208,7 +2293,7 @@ [enable_imczmq=no] ) if test "x$enable_imczmq" = "xyes"; then - PKG_CHECK_MODULES(CZMQ, libczmq >= 3.0.0) + PKG_CHECK_MODULES(CZMQ, libczmq >= 4.0.0) fi AM_CONDITIONAL(ENABLE_IMCZMQ, test x$enable_imczmq = xyes) @@ -2226,7 +2311,7 @@ [enable_omczmq=no] ) if test "x$enable_omczmq" = "xyes"; then - PKG_CHECK_MODULES(CZMQ, libczmq >= 3.0.2) + PKG_CHECK_MODULES(CZMQ, libczmq >= 4.0.0) fi AM_CONDITIONAL(ENABLE_OMCZMQ, test x$enable_omczmq = xyes) @@ -2542,6 +2627,7 @@ contrib/imbatchreport/Makefile \ contrib/omfile-hardened/Makefile \ contrib/mmkubernetes/Makefile \ + contrib/impcap/Makefile \ contrib/imtuxedoulog/Makefile \ contrib/improg/Makefile \ contrib/mmtaghostname/Makefile \ @@ -2586,6 +2672,10 @@ echo " imjournal input module enabled: $enable_imjournal" echo " imbatchreport input module enabled: $enable_imbatchreport" echo " imkafka module will be compiled: $enable_imkafka" +if test "$enable_imkafka" = "optional"; then +echo " imkafka use dummy: $imkafka_use_dummy" +fi +echo " impcap input module enabled: $enable_impcap" echo " imtuxedoulog module will be compiled: $enable_imtuxedoulog" echo " improg input module enabled: $enable_improg" echo @@ -2640,6 +2730,9 @@ echo "---{ database support }---" echo " MySql support enabled: $enable_mysql" echo " libdbi support enabled: $enable_libdbi" +if test "$enable_libdbi" = "optional"; then +echo " libdbi use dummy: $libdbi_use_dummy" +fi echo " PostgreSQL support enabled: $enable_pgsql" echo " mongodb support enabled: $enable_ommongodb" echo " hiredis support enabled: $enable_omhiredis" @@ -2670,6 +2763,8 @@ echo " PostgreSQL Tests enabled: $enable_pgsql_tests" echo " Kafka Tests enabled: $enable_kafka_tests" echo " Imdocker Tests enabled: $enable_imdocker_tests" +echo " gnutls tests enabled: $enable_gnutls_tests" +echo " imfile tests enabled: $enable_imfile_tests" echo " systemd journal tests enabled: $enable_journal_tests" echo " SNMP Tests enabled: $enable_snmp_tests" echo " Debug mode enabled: $enable_debug" diff -Nru rsyslog-8.2001.0/contrib/impcap/arp_parser.c rsyslog-8.2006.0/contrib/impcap/arp_parser.c --- rsyslog-8.2001.0/contrib/impcap/arp_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/arp_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,163 @@ +/* arp_parser.c + * + * This file contains functions to parse ARP and RARP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +struct arp_header_s { + uint16_t hwType; + uint16_t pType; + uint8_t hwAddrLen; + uint8_t pAddrLen; + uint16_t opCode; + uint8_t pAddr[]; +}; + +typedef struct arp_header_s arp_header_t; + +/* + * This function parses the bytes in the received packet to extract ARP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the ARP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where ARP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *arp_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("arp_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 28) { /* too small for ARP header*/ + DBGPRINTF("ARP packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0); + } + + /* Union to prevent cast from uchar to arp_header_t */ + union { + const uchar *pck; + arp_header_t *hdr; + } arp_header_to_char; + + arp_header_to_char.pck = packet; + arp_header_t *arp_header = arp_header_to_char.hdr; + + char pAddrSrc[20], pAddrDst[20]; + + json_object_object_add(jparent, "ARP_hwType", json_object_new_int(ntohs(arp_header->hwType))); + json_object_object_add(jparent, "ARP_pType", json_object_new_int(ntohs(arp_header->pType))); + json_object_object_add(jparent, "ARP_op", json_object_new_int(ntohs(arp_header->opCode))); + + if (ntohs(arp_header->hwType) == 1) { /* ethernet addresses */ + char hwAddrSrc[20], hwAddrDst[20]; + + ether_ntoa_r((struct ether_addr *)arp_header->pAddr, hwAddrSrc); + ether_ntoa_r((struct ether_addr *)(arp_header->pAddr + arp_header->hwAddrLen + arp_header->pAddrLen), + hwAddrDst); + + json_object_object_add(jparent, "ARP_hwSrc", json_object_new_string((char *)hwAddrSrc)); + json_object_object_add(jparent, "ARP_hwDst", json_object_new_string((char *)hwAddrDst)); + } + + if (ntohs(arp_header->pType) == ETHERTYPE_IP) { + inet_ntop(AF_INET, (void *)(arp_header->pAddr + arp_header->hwAddrLen), pAddrSrc, 20); + inet_ntop(AF_INET, (void *)(arp_header->pAddr + 2 * arp_header->hwAddrLen + arp_header->pAddrLen), + pAddrDst, 20); + + json_object_object_add(jparent, "ARP_pSrc", json_object_new_string((char *)pAddrSrc)); + json_object_object_add(jparent, "ARP_pDst", json_object_new_string((char *)pAddrDst)); + } + + RETURN_DATA_AFTER(28); +} + +/* + * This function parses the bytes in the received packet to extract RARP metadata. + * This is a copy of ARP handler, as structure is the same but protocol code and name are different + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the RARP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where RARP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *rarp_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("rarp_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 28) { /* too small for RARP header*/ + DBGPRINTF("RARP packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0); + } + + /* Union to prevent cast from uchar to arp_header_t */ + union { + const uchar *pck; + arp_header_t *hdr; + } arp_header_to_char; + + arp_header_to_char.pck = packet; + arp_header_t *rarp_header = arp_header_to_char.hdr; + + char pAddrSrc[20], pAddrDst[20]; + + json_object_object_add(jparent, "RARP_hwType", json_object_new_int(ntohs(rarp_header->hwType))); + json_object_object_add(jparent, "RARP_pType", json_object_new_int(ntohs(rarp_header->pType))); + json_object_object_add(jparent, "RARP_op", json_object_new_int(ntohs(rarp_header->opCode))); + + if (ntohs(rarp_header->hwType) == 1) { /* ethernet addresses */ + char *hwAddrSrc = ether_ntoa((struct ether_addr *)rarp_header->pAddr); + char *hwAddrDst = ether_ntoa((struct ether_addr *)(rarp_header->pAddr + + rarp_header->hwAddrLen + + rarp_header->pAddrLen)); + + json_object_object_add(jparent, "RARP_hwSrc", json_object_new_string((char *)hwAddrSrc)); + json_object_object_add(jparent, "RARP_hwDst", json_object_new_string((char *)hwAddrDst)); + } + + if (ntohs(rarp_header->pType) == ETHERTYPE_IP) { + inet_ntop(AF_INET, (void *)(rarp_header->pAddr + rarp_header->hwAddrLen), pAddrSrc, 20); + inet_ntop(AF_INET, (void *)(rarp_header->pAddr + 2 * rarp_header->hwAddrLen + rarp_header->pAddrLen), + pAddrDst, 20); + + json_object_object_add(jparent, "RARP_pSrc", json_object_new_string((char *)pAddrSrc)); + json_object_object_add(jparent, "RARP_pDst", json_object_new_string((char *)pAddrDst)); + } + + RETURN_DATA_AFTER(28); +} diff -Nru rsyslog-8.2001.0/contrib/impcap/dns_parser.c rsyslog-8.2006.0/contrib/impcap/dns_parser.c --- rsyslog-8.2001.0/contrib/impcap/dns_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/dns_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,372 @@ +/* dns_parser.c + * + * This file contains functions to parse DNS headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Kevin Guillemot (kevin.guillemot@advens.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + + +/* List of RCodes defined in RFC6895 : https://tools.ietf.org/html/rfc6895 */ +static const char *dns_rcodes[] = { + "NoError", // 0 + "FormErr", // 1 + "ServFail", // 2 + "NXDomain", // 3 + "NotImp", // 4 + "Refused", // 5 + "YXDomain", // 6 + "YXRRSet", // 7 + "NXRRSet", // 8 + "NotAuth", // 9 + "NotZone", // 10 + "", // 11 - Reserved + "", // 12 - Reserved + "", // 13 - Reserved + "", // 14 - Reserved + "", // 15 - Reserved + "BADVERS|BADSIG", // 16 + "BADKEY", // 17 + "BADTIME", // 18 + "BADMODE", // 19 + "BADNAME", // 20 + "BADALG", // 21 + "BADTRUNC", // 22 + /* Reserved for private use */ + NULL +}; + +/* List of record types (maybe not complete) */ +static const char *dns_types[] = { + 0, + "A", // 1 + "NS", // 2 + "MD", // 3 + "MF", // 4 + "CNAME", // 5 + "SOA", // 6 + "MB", // 7 + "MG", // 8 + "MR", // 9 + "NULL", // 10 + "WKS", // 11 + "PTR", // 12 + "HINFO", // 13 + "MINFO", // 14 + "MX", // 15 + "TXT", // 16 + "RP", // 17 + "AFSDB", // 18 + "X25", // 19 + "ISDN", // 20 + "RT", // 21 + "NSAP", // 22 + "NSAP-PTR", // 23 + "SIG", // 24 + "KEY", // 25 + "PX", // 26 + "GPOS", // 27 + "AAAA", // 28 + "LOC", // 29 + "NXT", // 30 + "EID", // 31 + "NIMLOC", // 32 + "SRV", // 33 + "ATMA", // 34 + "NAPTR", // 35 + "KX", // 36 + "CERT", // 37 + "A6", // 38 + "DNAME", // 39 + "SINK", // 40 + "OPT", // 41 + "APL", // 42 + "DS", // 43 + "SSHFP", // 44 + "IPSECKEY", // 45 + "RRSIG", // 46 + "NSEC", // 47 + "DNSKEY", // 48 + "DHCID", // 49 + "NSEC3", // 50 + "NSEC3PARAM", // 51 + "TLSA", // 51 + "SMIMEA", // 52 + "Unassigned", // 53 + "HIP", // 53 + "NINFO", // 54 + "RKEY", // 55 + "TALINK", // 56 + "CDS", // 57 + "CDNSKEY", // 58 + "OPENPGPKEY", // 59 + "CSYNC", // 60 + "ZONEMD", // 61 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + "SPF", // 99 + "UINFO", // 100 + "UID", // 101 + "GID", // 102 + "UNSPEC", // 103 + "NID", // 104 + "L32", // 105 + "L64", // 106 + "LP", // 107 + "EUI48", // 108 + "EUI64", // 109 + /* Reserved for private use */ + NULL +}; +/* Part 2, since 249. To prevent useless large buffer in memory */ +static const char *dns_types2[] = { + "TKEY", + "TSIG", + "IXFR", + "AXFR", + "MAILB", + "MAILA", + "*", + "URI", + "CAA", + "AVC", + "DOA", + "AMTRELAY", + NULL +}; +/* Part 3, since 32768. To prevent useless large buffer in memory */ +static const char *dns_types3[] = { + "TA", + "DLV", + NULL +}; + + +/* This function takes an integer as parameter + * and returns the corresponding string type of DNS query + */ +static const char *get_type(uint16_t x) { + const char **types = NULL; + uint16_t len_types3 = (sizeof(dns_types3) / sizeof(char *)) - 1; + uint16_t len_types2 = (sizeof(dns_types2) / sizeof(char *)) - 1; + uint16_t len_types = (sizeof(dns_types) / sizeof(char *)) - 1; + if (x >= 32768 && x < 32768 + len_types3) { + types = dns_types3; + x -= 32768; + } + else if (x >= 249 && x < 249 + len_types2) { + types = dns_types2; + x -= 249; + } + else if (x > 0 && x < len_types) + types = dns_types; + else + return "UNKNOWN"; + if (types[x] != NULL) + return types[x]; + return "UNKNOWN"; +} + + +/* This function takes an integer as parameter + * and returns the corresponding string class of DNS query + */ +static const char *get_class(uint16_t x) { + switch (x) { + case 1: + return "IN"; + case 3: + return "CH"; + case 4: + return "HS"; + case 254: + return "QCLASS NONE"; + case 255: + return "QCLASS *"; + } + return "UNKNOWN"; +} + + +/* + * This function parses the bytes in the received packet to extract DNS metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where DNS metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *dns_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + const uchar *packet_ptr = packet; + const uchar *end_packet = packet + pktSize; + DBGPRINTF("dns_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + /* Union to prevent cast from uchar to smb_header_t */ + union { + unsigned short int *two_bytes; + const uchar *pckt; + } union_short_int; + + /* Get transaction id */ + union_short_int.pckt = packet_ptr; + unsigned short int transaction_id = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("transaction_id = %02x \n", transaction_id); + union_short_int.pckt += 2; + + /* Get flags */ + unsigned short int flags = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("flags = %02x \n", flags); + + /* Get response flag */ + unsigned short int response_flag = (flags >> 15) & 0b1; // Get the left bit + //DBGPRINTF("response_flag = %02x \n", response_flag); + + /* Get Opcode */ + unsigned short int opcode = (flags >> 11) & 0b1111; + //DBGPRINTF("opcode = %02x \n", opcode); + + /* Verify Z: reserved bit */ + unsigned short int reserved = (flags >> 6) & 0b1; + //DBGPRINTF("reserved = %02x \n", reserved); + /* Reserved bit MUST be 0 */ + if (reserved != 0) { + DBGPRINTF("DNS packet reserved bit (Z) is not 0, aborting message. \n"); + RETURN_DATA_AFTER(0) + } + + /* Get reply code : 4 last bits */ + unsigned short int reply_code = flags & 0b1111; + //DBGPRINTF("reply_code = %02x \n", reply_code); + + union_short_int.pckt += 2; + + /* Get QDCOUNT */ + unsigned short int query_count = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("query_count = %02x \n", query_count); + union_short_int.pckt += 2; + + /* Get ANCOUNT */ + unsigned short int answer_count = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("answer_count = %02x \n", answer_count); + union_short_int.pckt += 2; + + /* Get NSCOUNT */ + unsigned short int authority_count = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("authority_count = %02x \n", authority_count); + union_short_int.pckt += 2; + + /* Get ARCOUNT */ + unsigned short int additionnal_count = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("additionnal_count = %02x \n", additionnal_count); + union_short_int.pckt += 2; + packet_ptr = union_short_int.pckt; + + fjson_object *queries = NULL; + if ((queries = json_object_new_array()) == NULL) { + DBGPRINTF("impcap::dns_parser: Cannot create new json array. Stopping.\n"); + RETURN_DATA_AFTER(0) + } + + // For each query of query_count + int query_cpt = 0; + while (query_cpt < query_count && packet_ptr < end_packet) { + size_t query_size = strnlen((const char *)packet_ptr, (size_t)(end_packet - packet_ptr)); + // Check if query is valid (max 255 bytes, plus a '\0') + if (query_size >= 256) { + DBGPRINTF("impcap::dns_parser: Length of domain queried is > 255. Stopping.\n"); + break; + } + // Check if remaining data is enough to hold query + '\0' + 4 bytes (QTYPE and QCLASS fields) + if (query_size + 5 > (size_t)(end_packet - packet_ptr)) { + DBGPRINTF("impcap::dns_parser: packet size too small to parse query. Stopping.\n"); + break; + } + fjson_object *query = NULL; + if ((query = json_object_new_object()) == NULL) { + DBGPRINTF("impcap::dns_parser: Cannot create new json object. Stopping.\n"); + break; + } + char domain_query[256] = {0}; + uchar nb_char = *packet_ptr; + packet_ptr++; + size_t cpt = 0; + while (cpt + 1 < query_size) { + if (nb_char == 0) { + nb_char = *packet_ptr; + domain_query[cpt] = '.'; + } else { + domain_query[cpt] = (char)*packet_ptr; + nb_char--; + } + cpt++; + packet_ptr++; + } + domain_query[cpt] = '\0'; + if (cpt) + packet_ptr++; // pass the last \0, only if query was not empty + // DBGPRINTF("Requested domain : '%s' \n", domain_query); + + /* Register the name in dict */ + json_object_object_add(query, "qname", json_object_new_string(domain_query)); + /* Get QTYPE */ + union_short_int.pckt = packet_ptr; + unsigned short int qtype = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("qtype = %02x \n", qtype); + json_object_object_add(query, "qtype", json_object_new_int((int)qtype)); + json_object_object_add(query, "type", json_object_new_string(get_type(qtype))); + union_short_int.pckt += 2; + /* Retrieve QCLASS */ + unsigned short int qclass = ntohs(*(union_short_int.two_bytes)); + //DBGPRINTF("qclass = %02x \n", qclass); + json_object_object_add(query, "qclass", json_object_new_int((int)qclass)); + json_object_object_add(query, "class", json_object_new_string(get_class(qclass))); + packet_ptr = union_short_int.pckt + 2; + /* Register the query in json array */ + json_object_array_add(queries, query); + query_cpt++; + } + + json_object_object_add(jparent, "DNS_transaction_id", json_object_new_int((int)transaction_id)); + + json_bool is_reponse = FALSE; + if (response_flag) + is_reponse = TRUE; + json_object_object_add(jparent, "DNS_response_flag", json_object_new_boolean(is_reponse)); + + json_object_object_add(jparent, "DNS_opcode", json_object_new_int(opcode)); + json_object_object_add(jparent, "DNS_rcode", json_object_new_int((int)reply_code)); + json_object_object_add(jparent, "DNS_error", json_object_new_string(dns_rcodes[reply_code])); + json_object_object_add(jparent, "DNS_QDCOUNT", json_object_new_int((int)query_count)); + json_object_object_add(jparent, "DNS_ANCOUNT", json_object_new_int((int)answer_count)); + json_object_object_add(jparent, "DNS_NSCOUNT", json_object_new_int((int)authority_count)); + json_object_object_add(jparent, "DNS_ARCOUNT", json_object_new_int((int)additionnal_count)); + json_object_object_add(jparent, "DNS_Names", queries); + + /* Packet has been successfully parsed, there still can be some responses left, but do not process them */ + RETURN_DATA_AFTER(0); +} diff -Nru rsyslog-8.2001.0/contrib/impcap/eth_parser.c rsyslog-8.2006.0/contrib/impcap/eth_parser.c --- rsyslog-8.2001.0/contrib/impcap/eth_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/eth_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,179 @@ +/* eth_parser.c + * + * This file contains functions to parse Ethernet II headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpacked" +#pragma GCC diagnostic ignored "-Wattributes" +struct __attribute__ ((__packed__)) eth_header_s { + uint8_t addrDst[6]; + uint8_t addrSrc[6]; + uint16_t type; +}; + +struct __attribute__ ((__packed__)) vlan_header_s { + uint8_t addrDst[6]; + uint8_t addrSrc[6]; + uint16_t vlanCode; + uint16_t vlanTag; + uint16_t type; +}; +#pragma GCC diagnostic pop + +typedef struct eth_header_s eth_header_t; +typedef struct vlan_header_s vlan_header_t; + + +/* + * Get an ethernet header type as uint16_t + * and return the correspondence as string + * NOTE : Only most common types are present, to complete if needed + */ +static const char *eth_type_to_string(uint16_t eth_type) { + switch (eth_type) { + case 0x00bb: // Extreme Networks Discovery Protocol + return "EDP"; + case 0x0200: // PUP protocol + return "PUP"; + case 0x0800: // IP protocol + return "IP"; + case 0x0806: // address resolution protocol + return "ARP"; + case 0x88a2: // AoE protocol + return "AOE"; + case 0x2000: // Cisco Discovery Protocol + return "CDP"; + case 0x2004: // Cisco Dynamic Trunking Protocol + return "DTP"; + case 0x8035: // reverse addr resolution protocol + return "REVARP"; + case 0x8100: // IEEE 802.1Q VLAN tagging + return "802.1Q"; + case 0x88a8: // IEEE 802.1ad + return "802.1AD"; + case 0x9100: // Legacy QinQ + return "QINQ1"; + case 0x9200: // Legacy QinQ + return "QINQ2"; + case 0x8137: // Internetwork Packet Exchange + return "IPX"; + case 0x86DD: // IPv6 protocol + return "IPv6"; + case 0x880B: // PPP + return "PPP"; + case 0x8847: // MPLS + return "MPLS"; + case 0x8848: // MPLS Multicast + return "MPLS_MCAST"; + case 0x8863: // PPP Over Ethernet Discovery Stage + return "PPPoE_DISC"; + case 0x8864: // PPP Over Ethernet Session Stage + return "PPPoE"; + case 0x88CC: // Link Layer Discovery Protocol + return "LLDP"; + case 0x6558: // Transparent Ethernet Bridging + return "TEB"; + default: + return "UNKNOWN"; + } +} + + +/* + * This function parses the bytes in the received packet to extract Ethernet II metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the ETH header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where ETH metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *eth_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("entered eth_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + if (pktSize < 14) { /* too short for eth header */ + DBGPRINTF("ETH packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + eth_header_t *eth_header = (eth_header_t *)packet; + char ethMacSrc[20], ethMacDst[20]; + uint8_t hdrLen = 14; + + ether_ntoa_r((struct ether_addr *)eth_header->addrSrc, ethMacSrc); + ether_ntoa_r((struct ether_addr *)eth_header->addrDst, ethMacDst); + + json_object_object_add(jparent, "ETH_src", json_object_new_string((char *)ethMacSrc)); + json_object_object_add(jparent, "ETH_dst", json_object_new_string((char *)ethMacDst)); + + uint16_t ethType = (uint16_t)ntohs(eth_header->type); + + if (ethType == ETHERTYPE_VLAN) { + vlan_header_t *vlan_header = (vlan_header_t *)packet; + json_object_object_add(jparent, "ETH_tag", json_object_new_int(ntohs(vlan_header->vlanTag))); + ethType = (uint16_t)ntohs(vlan_header->type); + hdrLen += 4; + } + + data_ret_t *ret; + + if (ethType < 1500) { + /* this is a LLC header */ + json_object_object_add(jparent, "ETH_len", json_object_new_int(ethType)); + ret = llc_parse(packet + hdrLen, pktSize - hdrLen, jparent); + + /* packet has the minimum allowed size, so the remaining data is + * most likely padding, this should not appear as data, so remove it + * */ + //TODO this is a quick win, a more elaborate solution would be to check if all data + // is indeed zero, but that would take more processing time + if (pktSize <= 60 && ret->pData != NULL) { + if (!ret->pData[0]) ret->size = 0; + } + return ret; + } + + json_object_object_add(jparent, "ETH_type", json_object_new_int(ethType)); + json_object_object_add(jparent, "ETH_typestr", json_object_new_string((char *)eth_type_to_string(ethType))); + ret = (*ethProtoHandlers[ethType])((packet + hdrLen), (pktSize - hdrLen), jparent); + + /* packet has the minimum allowed size, so the remaining data is + * most likely padding, this should not appear as data, so remove it */ + if (pktSize <= 60 && ret->pData != NULL) { + if (!ret->pData[0]) ret->size = 0; + } + return ret; +} diff -Nru rsyslog-8.2001.0/contrib/impcap/ftp_parser.c rsyslog-8.2006.0/contrib/impcap/ftp_parser.c --- rsyslog-8.2001.0/contrib/impcap/ftp_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/ftp_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,152 @@ +/* ftp_parser.c + * + * This file contains functions to parse FTP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +static const int ftp_cds[] = { + 100, 110, 120, 125, 150, + 200, 202, 211, 212, 213, 214, 215, 220, 221, 225, 226, 227, 228, 229, 230, 231, 232, 250, 257, + 300, 331, 332, 350, + 400, 421, 425, 426, 430, 434, 450, 451, 452, + 500, 501, 502, 503, 504, 530, 532, 550, 551, 552, 553, + 600, 631, 632, 633, + 10000, 100054, 10060, 10061, 10066, 10068, + 0 +}; + +static const char *ftp_cmds[] = { + "STOR", + "TYPE", + "ABOR", + "ACCT", + "ALLO", + "APPE", + "CDUP", + "CWD", + "DELE", + "HELP", + "LIST", + "MKD", + "MODE", + "NLST", + "NOOP", + "PASS", + "PASV", + "PORT", + "PWD", + "QUIT", + "REIN", + "REST", + "RETR", + "RMD", + "RNFR", + "RNTO", + "SITE", + "SMNT", + "STAT", + "STOU", + "STRU", + "SYST", + "USER", + NULL +}; + +/* + * This function searches for a valid command in the header (from the list defined in ftp_cmds[]) + * and returns either the command or a NULL pointer +*/ +static const char *check_Command_ftp(uchar *first_part_packet) { + DBGPRINTF("in check_Command_ftp\n"); + DBGPRINTF("first_part_packet : '%s' \n", first_part_packet); + int i = 0; + for (i = 0; ftp_cmds[i] != NULL; i++) { + if (strncmp((const char *)first_part_packet, ftp_cmds[i], strlen((const char *)ftp_cmds[i]) + 1) == 0) { + return ftp_cmds[i]; + } + } + return "UNKNOWN"; +} + +/* + * This function searches for a valid code in the header (from the list defined in ftp_cds[]) + * and returns either the command or a NULL pointer +*/ +static int check_Code_ftp(uchar *first_part_packet) { + DBGPRINTF("in check_Code_ftp\n"); + DBGPRINTF("first_part_packet : %s \n", first_part_packet); + int i = 0; + for (i = 0; ftp_cds[i] != 0; i++) { + if (strtol((const char *)first_part_packet, NULL, 10) == ftp_cds[i]) { + return ftp_cds[i]; + } + } + return 0; +} + +/* + * This function parses the bytes in the received packet to extract FTP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the FTP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where FTP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *ftp_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("ftp_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 5) { /* too short for ftp packet*/ + RETURN_DATA_AFTER(0) + } + uchar *packet2 = (uchar *)malloc(pktSize * sizeof(uchar)); + + memcpy(packet2, packet, pktSize); // strtok changes original packet + uchar *frst_part_ftp; + frst_part_ftp = (uchar *)strtok((char *)packet2, " "); // Get first part of packet ftp + strtok(NULL, "\r\n"); + + if (frst_part_ftp) { + int code = check_Code_ftp(frst_part_ftp); + const char *command = check_Command_ftp(frst_part_ftp); + if (code != 0) { + json_object_object_add(jparent, "FTP_response", json_object_new_int(code)); + } else if (command != NULL) { + json_object_object_add(jparent, "FTP_request", json_object_new_string(command)); + } + } + free(packet2); + RETURN_DATA_AFTER(0) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/http_parser.c rsyslog-8.2006.0/contrib/impcap/http_parser.c --- rsyslog-8.2001.0/contrib/impcap/http_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/http_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,159 @@ +/* http_parser.c + * + * This file contains functions to parse HTTP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +static const char *keywords[] = { + "OPTIONS", + "GET", + "HEAD", + "POST", + "PUT", + "DELETE", + "TRACE", + "CONNECT", + "HTTP", + NULL +}; + +static inline char *string_split(char **initString, const char *delimiterString) { + char *ret = *initString; + + if (*initString) { + char *pos = strstr(*initString, delimiterString); + if (pos) { + *initString = pos; + **initString = '\0'; + *initString += strlen(delimiterString); + } else { + *initString = NULL; + } + } + + return ret; +} + +static inline int has_status_keyword(char *http) { + const char *found; + int i; + + for (i = 0; keywords[i] != NULL; i++) { + found = strstr(http, keywords[i]); + if (found && (found - http) < 20) { + return 1; + } + } + + return 0; +} + +/* + * This function catches HTTP header fields and status line + * and adds them to the provided json object +*/ +static inline void catch_status_and_fields(char *header, struct json_object *jparent) { + DBGPRINTF("catch_status_and_fields\n"); + + struct json_object *fields = json_object_new_object(); + + char *statusLine = string_split(&header, "\r\n"); + char *firstPart, *secondPart, *thirdPart; + firstPart = string_split(&statusLine, " "); + secondPart = string_split(&statusLine, " "); + thirdPart = statusLine; + if (firstPart && secondPart && thirdPart) { + if (strstr(firstPart, "HTTP")) { + json_object_object_add(jparent, "HTTP_version", json_object_new_string(firstPart)); + json_object_object_add(jparent, "HTTP_status_code", json_object_new_string(secondPart)); + json_object_object_add(jparent, "HTTP_reason", json_object_new_string(thirdPart)); + } else { + json_object_object_add(jparent, "HTTP_method", json_object_new_string(firstPart)); + json_object_object_add(jparent, "HTTP_request_URI", json_object_new_string(secondPart)); + json_object_object_add(jparent, "HTTP_version", json_object_new_string(thirdPart)); + } + } + + char *fieldValue = string_split(&header, "\r\n"); + char *field, *value; + while (fieldValue) { + field = string_split(&fieldValue, ":"); + value = fieldValue; + if (value) { + while (*value == ' ') { value++; } + DBGPRINTF("got header field -> '%s': '%s'\n", field, value); + json_object_object_add(fields, field, json_object_new_string(value)); + } + + fieldValue = string_split(&header, "\r\n"); + } + + json_object_object_add(jparent, "HTTP_header_fields", fields); + + return; +} + +/* + * This function parses the bytes in the received packet to extract HTTP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the beginning of the header will be checked by the function + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where HTTP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *http_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("http_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + if (pktSize < 6) { + RETURN_DATA_AFTER(0) + } + + char *pHttp = malloc(pktSize + 1); + char *http = pHttp; + memcpy(http, packet, pktSize); + *(http + pktSize) = '\0'; + + if (!has_status_keyword(http)) { + free(pHttp); + RETURN_DATA_AFTER(0) + } + + char *header = string_split(&http, "\r\n\r\n"); + + catch_status_and_fields(header, jparent); + + free(pHttp); + RETURN_DATA_AFTER(0) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/icmp_parser.c rsyslog-8.2006.0/contrib/impcap/icmp_parser.c --- rsyslog-8.2001.0/contrib/impcap/icmp_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/icmp_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,79 @@ +/* icmp_parser.c + * + * This file contains functions to parse ICMP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +struct icmp_header_s { + uint8_t type; + uint8_t code; + uint16_t checksum; + uint8_t data[]; +}; + +typedef struct icmp_header_s icmp_header_t; + +/* + * This function parses the bytes in the received packet to extract ICMP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the ICMP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where ICMP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *icmp_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("icmp_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 8) { + DBGPRINTF("ICMP packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0); + } + + /* Union to prevent cast from uchar to icmp_header_t */ + union { + const uchar *pck; + icmp_header_t *hdr; + } icmp_header_to_char; + + icmp_header_to_char.pck = packet; + icmp_header_t *icmp_header = icmp_header_to_char.hdr; + + json_object_object_add(jparent, "net_icmp_type", json_object_new_int(icmp_header->type)); + json_object_object_add(jparent, "net_icmp_code", json_object_new_int(icmp_header->code)); + json_object_object_add(jparent, "icmp_checksum", json_object_new_int(ntohs(icmp_header->checksum))); + + RETURN_DATA_AFTER(8) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/impcap.c rsyslog-8.2006.0/contrib/impcap/impcap.c --- rsyslog-8.2001.0/contrib/impcap/impcap.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/impcap.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,798 @@ +/* impcap.c + * + * This is an input module using libpcap, a + * portable C/C++ library for network traffic capture. + * This module reads packets received from a network interface + * using libpcap, to extract information such as IP addresses, ports, + * protocols, etc... and make it available to rsyslog and other modules. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "rsyslog.h" +#include "prop.h" +#include "ruleset.h" +#include "datetime.h" + +#include "errmsg.h" +#include "unicode-helper.h" +#include "module-template.h" +#include "rainerscript.h" +#include "rsconf.h" +#include "glbl.h" +#include "srUtils.h" + +#include "parsers.h" + + +MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP +MODULE_CNFNAME("impcap") + +#define DEFAULT_META_CONTAINER "!impcap" +#define DEFAULT_DATA_CONTAINER "!data" + + +/* static data */ +DEF_IMOD_STATIC_DATA +DEFobjCurrIf(glbl) +DEFobjCurrIf(prop) +DEFobjCurrIf(ruleset) +DEFobjCurrIf(datetime) + +static prop_t *pInputName = NULL; + +/* --- init prototypes --- */ +void init_eth_proto_handlers(void); + +void init_ip_proto_handlers(void); + +char *stringToHex(char *string, size_t length); + +static ATTR_NORETURN void *startCaptureThread(void *instanceConf); + +/* conf structures */ + +struct instanceConf_s { + char *interface; + uchar *filePath; + pcap_t *device; + uchar *filter; + uchar *tag; + uint8_t promiscuous; + uint8_t immediateMode; + uint32_t bufSize; + uint8_t bufTimeout; + uint8_t pktBatchCnt; + pthread_t tid; + uchar *pszBindRuleset; /* name of ruleset to bind to */ + ruleset_t *pBindRuleset; /* ruleset to bind listener to (use system default if unspecified) */ + struct instanceConf_s *next; +}; + +struct modConfData_s { + rsconf_t *pConf; + instanceConf_t *root, *tail; + uint16_t snap_length; + uint8_t metadataOnly; + char *metadataContainer; + char *dataContainer; +}; + +static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */ +static modConfData_t *runModConf = NULL; /* modConf ptr to use for the current exec process */ + +/* input instance parameters */ +static struct cnfparamdescr inppdescr[] = { + {"interface", eCmdHdlrGetWord, 0}, + {"file", eCmdHdlrString, 0}, + {"promiscuous", eCmdHdlrBinary, 0}, + {"filter", eCmdHdlrString, 0}, + {"tag", eCmdHdlrString, 0}, + {"ruleset", eCmdHdlrString, 0}, + {"no_buffer", eCmdHdlrBinary, 0}, + {"buffer_size", eCmdHdlrPositiveInt, 0}, + {"buffer_timeout", eCmdHdlrPositiveInt, 0}, + {"packet_count", eCmdHdlrPositiveInt, 0} +}; +static struct cnfparamblk inppblk = { + CNFPARAMBLK_VERSION, + sizeof(inppdescr) / sizeof(struct cnfparamdescr), + inppdescr +}; + +/* module-global parameters */ +static struct cnfparamdescr modpdescr[] = { + {"snap_length", eCmdHdlrPositiveInt, 0}, + {"metadata_only", eCmdHdlrBinary, 0}, + {"metadata_container", eCmdHdlrGetWord, 0}, + {"data_container", eCmdHdlrGetWord, 0} +}; +static struct cnfparamblk modpblk = { + CNFPARAMBLK_VERSION, + sizeof(modpdescr) / sizeof(struct cnfparamdescr), + modpdescr +}; + +#include "im-helper.h" + +/* + * create input instance, set default parameters, and + * add it to the list of instances. + */ +static rsRetVal +createInstance(instanceConf_t **pinst) { + instanceConf_t *inst; + DEFiRet; + CHKmalloc(inst = malloc(sizeof(instanceConf_t))); + inst->next = NULL; + inst->interface = NULL; + inst->filePath = NULL; + inst->device = NULL; + inst->promiscuous = 0; + inst->filter = NULL; + inst->tag = NULL; + inst->pszBindRuleset = NULL; + inst->immediateMode = 0; + inst->bufTimeout = 10; + inst->bufSize = 1024 * 1024 * 15; /* should be enough for up to 10Gb interface*/ + inst->pktBatchCnt = 5; + + /* node created, let's add to global config */ + if (loadModConf->tail == NULL) { + loadModConf->tail = loadModConf->root = inst; + } else { + loadModConf->tail->next = inst; + loadModConf->tail = inst; + } + + *pinst = inst; +finalize_it: + RETiRet; +} + +/* input instances */ + +BEGINnewInpInst +struct cnfparamvals *pvals; +instanceConf_t *inst; +int i; +CODESTARTnewInpInst + pvals = nvlstGetParams(lst, &inppblk, NULL); + + if(pvals == NULL) { + LogError(0, RS_RET_MISSING_CNFPARAMS, + "impcap: required parameters are missing\n"); + ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS); + } + + CHKiRet(createInstance(&inst)); + + for (i = 0 ; iinterface = (char *)es_str2cstr(pvals[i].val.d.estr, NULL); + } + else if (!strcmp(inppblk.descr[i].name, "file")) { + inst->filePath = (uchar *)es_str2cstr(pvals[i].val.d.estr, NULL); + } + else if (!strcmp(inppblk.descr[i].name, "promiscuous")) { + inst->promiscuous = (uint8_t)pvals[i].val.d.n; + } + else if (!strcmp(inppblk.descr[i].name, "filter")) { + inst-> + filter = (uchar *)es_str2cstr(pvals[i].val.d.estr, NULL); + } + else if (!strcmp(inppblk.descr[i].name, "tag")) { + inst->tag = (uchar *) es_str2cstr(pvals[i].val.d.estr, NULL); + } + else if (!strcmp(inppblk.descr[i].name, "ruleset")) { + inst->pszBindRuleset = (uchar *)es_str2cstr(pvals[i].val.d.estr, NULL); + } + else if (!strcmp(inppblk.descr[i].name, "no_buffer")) { + inst->immediateMode = (uint8_t)pvals[i].val.d.n; + } + else if (!strcmp(inppblk.descr[i].name, "buffer_size")) { + inst->bufSize = (uint32_t)pvals[i].val.d.n; + } + else if (!strcmp(inppblk.descr[i].name, "buffer_timeout")) { + inst->bufTimeout = (uint8_t)pvals[i].val.d.n; + } + else if (!strcmp(inppblk.descr[i].name, "packet_count")) { + inst->pktBatchCnt = (uint8_t)pvals[i].val.d.n; + } + else { + dbgprintf("impcap: non-handled param %s in beginCnfLoad\n", inppblk.descr[i].name); + } + } + +finalize_it: + +CODE_STD_FINALIZERnewInpInst + cnfparamvalsDestruct(pvals, &inppblk); +ENDnewInpInst + +/* global mod conf (v2 system) */ +BEGINsetModCnf + struct cnfparamvals *pvals = NULL; + int i; + +CODESTARTsetModCnf + + /* TODO: find a better place for this */ + init_ip_proto_handlers(); + + init_eth_proto_handlers(); + + pvals = nvlstGetParams(lst, &modpblk, NULL); + if (pvals == NULL) { + LogError(0, RS_RET_MISSING_CNFPARAMS, "impcap: error processing module " + "config parameters missing [module(...)]"); + ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS); + } + + for (i = 0 ; isnap_length = (int)pvals[i].val.d.n; + } + else if (!strcmp(modpblk.descr[i].name, "metadata_only")) { + loadModConf->metadataOnly = (uint8_t)pvals[i].val.d.n; + } + else if (!strcmp(modpblk.descr[i].name, "metadata_container")) { + loadModConf->metadataContainer = (char *)es_str2cstr(pvals[i].val.d.estr, NULL); + } + else if (!strcmp(modpblk.descr[i].name, "data_container")) { + loadModConf->dataContainer = (char *)es_str2cstr(pvals[i].val.d.estr, NULL); + } + else { + dbgprintf("impcap: non-handled param %s in beginSetModCnf\n", modpblk.descr[i].name); + } + } + + if (!loadModConf->metadataContainer) + CHKmalloc(loadModConf->metadataContainer = strdup(DEFAULT_META_CONTAINER)); + + if (!loadModConf->dataContainer) + CHKmalloc(loadModConf->dataContainer = strdup(DEFAULT_DATA_CONTAINER)); +finalize_it: + if (pvals != NULL) + cnfparamvalsDestruct(pvals, &modpblk); +ENDsetModCnf + +/* config v2 system */ + +BEGINbeginCnfLoad +CODESTARTbeginCnfLoad + loadModConf = pModConf; + loadModConf->pConf = pConf; + loadModConf->metadataOnly = 0; + loadModConf->snap_length = 65535; + loadModConf->metadataContainer = NULL; + loadModConf->dataContainer = NULL; +ENDbeginCnfLoad + +BEGINendCnfLoad +CODESTARTendCnfLoad +ENDendCnfLoad + + +/* function to generate error message if framework does not find requested ruleset */ +static inline void +std_checkRuleset_genErrMsg(__attribute__((unused)) modConfData_t *modConf, instanceConf_t *inst) { + LogError(0, NO_ERRCODE, "impcap: ruleset '%s' for interface %s not found - " + "using default ruleset instead", inst->pszBindRuleset, + inst->interface); +} + +BEGINcheckCnf + instanceConf_t *inst; +CODESTARTcheckCnf + if (pModConf->root == NULL) { + LogError(0, RS_RET_NO_LISTNERS , "impcap: module loaded, but " + "no interface defined - no input will be gathered"); + iRet = RS_RET_NO_LISTNERS; + } + + if (pModConf->metadataOnly) { /* if metadata_only is "on", snap_length is overwritten */ + pModConf->snap_length = 100; /* arbitrary value, but should be enough for most protocols */ + } + + if (!pModConf->metadataContainer || !pModConf->dataContainer) { + LogError(0, RS_RET_LOAD_ERROR, "impcap: no name defined for metadata_container and " + "data_container, this shouldn't happen"); + } + else { + DBGPRINTF("impcap: metadata will be stored in '%s', and data in '%s'\n", + pModConf->metadataContainer, pModConf->dataContainer); + } + + for (inst = pModConf->root ; inst != NULL ; inst = inst->next) { + std_checkRuleset(pModConf, inst); + if (inst->interface ==NULL &&inst->filePath == NULL) { + iRet = RS_RET_INVALID_PARAMS; + LogError(0, RS_RET_LOAD_ERROR, "impcap: 'interface' or 'file' must be specified"); + break; + } + if (inst->interface !=NULL &&inst->filePath != NULL) { + iRet = RS_RET_INVALID_PARAMS; + LogError(0, RS_RET_LOAD_ERROR, "impcap: either 'interface' or 'file' must be specified"); + break; + } + } + +ENDcheckCnf + +BEGINactivateCnfPrePrivDrop +CODESTARTactivateCnfPrePrivDrop + runModConf = pModConf; +ENDactivateCnfPrePrivDrop + +BEGINactivateCnf + instanceConf_t *inst; + pcap_t *dev; + struct bpf_program filter_program; + bpf_u_int32 SubNet, NetMask; + char errBuf[PCAP_ERRBUF_SIZE]; + uint8_t retCode = 0; +CODESTARTactivateCnf + for (inst = pModConf->root ; inst != NULL ; inst = inst->next) { + if (inst->filePath != NULL) { + dev = pcap_open_offline((const char *)inst->filePath, errBuf); + if (dev == NULL) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while opening capture file: '%s'", errBuf); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + } + else if (inst->interface != NULL) { + dev = pcap_create((const char *)inst->interface, errBuf); + if (dev == NULL) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while creating packet capture: '%s'", + errBuf); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + + DBGPRINTF("setting snap_length %d\n", pModConf->snap_length); + if (pcap_set_snaplen(dev, pModConf->snap_length)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting snap length: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + + DBGPRINTF("setting promiscuous %d\n", inst->promiscuous); + if (pcap_set_promisc(dev, inst->promiscuous)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting promiscuous mode: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + + if (inst->immediateMode) { + DBGPRINTF("setting immediate mode %d\n", inst->immediateMode); + retCode = pcap_set_immediate_mode(dev, inst->immediateMode); + if (retCode) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting immediate mode: '%s'," + " using buffer instead\n",pcap_geterr(dev)); + } + } + + if (!inst->immediateMode || retCode){ + DBGPRINTF("setting buffer size %u \n", inst->bufSize); + if (pcap_set_buffer_size(dev, inst->bufSize)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting buffer size: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + DBGPRINTF("setting buffer timeout %dms\n", inst->bufTimeout); + if (pcap_set_timeout(dev, inst->bufTimeout)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting buffer timeout: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + } + + switch (pcap_activate(dev)) { + case PCAP_WARNING_PROMISC_NOTSUP: + LogError(0, NO_ERRCODE, "interface doesn't support promiscuous mode"); + break; + case PCAP_WARNING_TSTAMP_TYPE_NOTSUP: + LogError(0, NO_ERRCODE, "timestamp type is not supported"); + break; + case PCAP_WARNING: + LogError(0, NO_ERRCODE, "pcap: %s", pcap_geterr(dev)); + break; + case PCAP_ERROR_ACTIVATED: + LogError(0, RS_RET_LOAD_ERROR, "already activated, shouldn't happen"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + case PCAP_ERROR_NO_SUCH_DEVICE: + LogError(0, RS_RET_LOAD_ERROR, "device doesn't exist"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + case PCAP_ERROR_PERM_DENIED: + LogError(0, RS_RET_LOAD_ERROR, "elevated privilege needed to open capture " + "interface"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + case PCAP_ERROR_PROMISC_PERM_DENIED: + LogError(0, RS_RET_LOAD_ERROR, "elevated privilege needed to put interface " + "in promiscuous mode"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + case PCAP_ERROR_RFMON_NOTSUP: + LogError(0, RS_RET_LOAD_ERROR, "interface doesn't support monitor mode"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + case PCAP_ERROR_IFACE_NOT_UP: + LogError(0, RS_RET_LOAD_ERROR, "interface is not up"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + case PCAP_ERROR: + LogError(0, RS_RET_LOAD_ERROR, "pcap: %s", pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + + if (inst->filter != NULL) { + DBGPRINTF("getting netmask on %s\n", inst->interface); + //obtain the subnet + if (pcap_lookupnet(inst->interface, &SubNet, &NetMask, errBuf)){ + DBGPRINTF("could not get netmask\n"); + NetMask = PCAP_NETMASK_UNKNOWN; + } + DBGPRINTF("setting filter to '%s'\n", inst->filter); + /* Compile the filter */ + if (pcap_compile(dev, &filter_program, (const char *)inst->filter, 1, NetMask)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while compiling filter: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + else if (pcap_setfilter(dev, &filter_program)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting filter: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + pcap_freecode(&filter_program); + } + + if (pcap_set_datalink(dev, DLT_EN10MB)) { + LogError(0, RS_RET_LOAD_ERROR, "pcap: error while setting datalink type: '%s'", + pcap_geterr(dev)); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + } /* inst->interface != NULL */ + else { + LogError(0, RS_RET_LOAD_ERROR, "impcap: no capture method specified, " + "please specify either 'interface' or 'file' in config"); + ABORT_FINALIZE(RS_RET_LOAD_ERROR); + } + + inst->device = dev; + } + +finalize_it: +ENDactivateCnf + +BEGINfreeCnf + instanceConf_t *inst, *del; +CODESTARTfreeCnf + DBGPRINTF("impcap: freeing confs...\n"); + for (inst = pModConf->root ; inst != NULL ; ) { + del = inst; + inst = inst->next; + free(del->filePath); + free(del->filter); + free(del->pszBindRuleset); + free(del->interface); + free(del->tag); + free(del); + } + free(pModConf->metadataContainer); + free(pModConf->dataContainer); + DBGPRINTF("impcap: finished freeing confs\n"); +ENDfreeCnf + +/* runtime functions */ + +/* + * Mock function to do no parsing when protocol is not a valid number +*/ +data_ret_t *dont_parse(const uchar *packet, int pktSize, __attribute__((unused)) struct json_object *jparent) { + DBGPRINTF("protocol not handled\n"); + RETURN_DATA_AFTER(0) +} + +/* + * Initializes the function pointers' list for handled protocols + * contained within Ethernet II +*/ +void init_eth_proto_handlers(void) { + DBGPRINTF("begining init eth handlers\n"); + // set all to blank function + for (int i = 0; i < ETH_PROTO_NUM; ++i) { + ethProtoHandlers[i] = dont_parse; + } + + ethProtoHandlers[ETHERTYPE_IP] = ipv4_parse; + ethProtoHandlers[ETHERTYPE_ARP] = arp_parse; + ethProtoHandlers[ETHERTYPE_REVARP] = rarp_parse; + ethProtoHandlers[ETHERTYPE_IPV6] = ipv6_parse; + ethProtoHandlers[ETHERTYPE_IPX] = ipx_parse; + +} + +/* + * Initializes the function pointers' list for handled protocols + * contained within IP +*/ +void init_ip_proto_handlers(void) { + DBGPRINTF("begining init ip handlers\n"); + // set all to blank function + for (int i = 0; i < IP_PROTO_NUM; ++i) { + ipProtoHandlers[i] = dont_parse; + } + + ipProtoHandlers[IPPROTO_ICMP] = icmp_parse; + ipProtoHandlers[IPPROTO_TCP] = tcp_parse; + ipProtoHandlers[IPPROTO_UDP] = udp_parse; +} + +/* + * Converts a list of bytes to their hexadecimal representation in ASCII + * + * Gets the list of bytes and the length as parameters + * + * Returns a pointer on the new list, being a string of ASCII characters + * representing hexadecimal values, in the form "A5B34C65..." + * its size is twice length parameter + 1 +*/ +char *stringToHex(char *string, size_t length) { + const char *hexChar = "0123456789ABCDEF"; + char *retBuf; + uint16_t i; + + retBuf = malloc((2 * length + 1) * sizeof(char)); + for (i = 0; i < length; ++i) { + retBuf[2 * i] = hexChar[(string[i] & 0xF0) >> 4]; + retBuf[2 * i + 1] = hexChar[string[i] & 0x0F]; + } + retBuf[2 * length] = '\0'; + + return retBuf; +} + +/* + * This method parses every packet received by libpcap, and is called by it + * It creates the message for Rsyslog, calls the parsers and add all necessary information + * in the message +*/ +void packet_parse(uchar *arg, const struct pcap_pkthdr *pkthdr, const uchar *packet) { + DBGPRINTF("impcap : entered packet_parse\n"); + smsg_t *pMsg; + + /* Prevent cast error from char to int with arg */ + union { + uchar *buf; + int *id; + } aux; + + aux.buf = arg; + int *id = aux.id; + msgConstruct(&pMsg); + + MsgSetInputName(pMsg, pInputName); + //search inst in loadmodconf,and check if there is tag. if so set tag in msg. + pthread_t ctid = pthread_self(); + instanceConf_t * inst; + for (inst = runModConf->root; inst != NULL; inst = inst->next) { + if (pthread_equal(ctid, inst->tid)) { + if (inst->pBindRuleset != NULL) { + MsgSetRuleset(pMsg, inst->pBindRuleset); + } + if (inst->tag != NULL) { + MsgSetTAG(pMsg, inst->tag, strlen((const char *)inst->tag)); + } + } + } + + + struct json_object *jown = json_object_new_object(); + json_object_object_add(jown, "ID", json_object_new_int(++(*id))); + + struct syslogTime sysTimePkt; + char timeStr[30]; + struct timeval tv = pkthdr->ts; + datetime.timeval2syslogTime(&tv, &sysTimePkt, 1/*inUTC*/); + if (datetime.formatTimestamp3339(&sysTimePkt, timeStr)) { + json_object_object_add(jown, "timestamp", json_object_new_string(timeStr)); + } + + json_object_object_add(jown, "net_bytes_total", json_object_new_int(pkthdr->len)); + + data_ret_t * dataLeft = eth_parse(packet, pkthdr->caplen, jown); + + json_object_object_add(jown, "net_bytes_data", json_object_new_int(dataLeft->size)); + char *dataHex = stringToHex(dataLeft->pData, dataLeft->size); + if (dataHex != NULL) { + struct json_object *jadd = json_object_new_object(); + json_object_object_add(jadd, "length", json_object_new_int(strlen(dataHex))); + json_object_object_add(jadd, "content", json_object_new_string(dataHex)); + msgAddJSON(pMsg, (uchar *)runModConf->dataContainer, jadd, 0, 0); + free(dataHex); + } + free(dataLeft); + + msgAddJSON(pMsg, (uchar *)runModConf->metadataContainer, jown, 0, 0); + submitMsg2(pMsg); +} + +/* This is used to terminate the plugin. + */ +static void +doSIGTTIN(int __attribute__((unused)) sig) +{ + pthread_t tid = pthread_self(); + const int bTerminate = ATOMIC_FETCH_32BIT(&bTerminateInputs, &mutTerminateInputs); + DBGPRINTF("impcap: awoken via SIGTTIN; bTerminateInputs: %d\n", bTerminate); + if(bTerminate) { + for(instanceConf_t *inst = runModConf->root; inst != NULL; inst = inst->next) { + if(pthread_equal(tid, inst->tid)) { + pcap_breakloop(inst->device); + DBGPRINTF("impcap: thread %lx, termination requested via SIGTTIN - telling libpcap\n", + (long unsigned int)tid); + } + } + } +} + +/* + * This is the main function for each thread + * taking care of a specified network interface +*/ +static ATTR_NORETURN void *startCaptureThread(void *instanceConf) { + int id = 0; + pthread_t tid = pthread_self(); + + /* we want to support non-cancel input termination. To do so, we must signal libpcap + * when to stop. As we run on the same thread, we need to register as SIGTTIN handler, + * which will be used to put the terminating condition into libpcap. + */ + DBGPRINTF("impcap: setting catch for SIGTTIN, thread %lx\n", + (long unsigned int)tid); + sigset_t sigSet; + struct sigaction sigAct; + sigfillset(&sigSet); + pthread_sigmask(SIG_BLOCK, &sigSet, NULL); + sigemptyset(&sigSet); + sigaddset(&sigSet, SIGTTIN); + pthread_sigmask(SIG_UNBLOCK, &sigSet, NULL); + memset(&sigAct, 0, sizeof (sigAct)); + sigemptyset(&sigAct.sa_mask); + sigAct.sa_handler = doSIGTTIN; + sigaction(SIGTTIN, &sigAct, NULL); + + instanceConf_t * inst = (instanceConf_t * )instanceConf; + DBGPRINTF("impcap: thread %lx, begin capture!\n", + (long unsigned int)tid); + while (glbl.GetGlobalInputTermState() == 0) { + pcap_dispatch(inst->device, inst->pktBatchCnt, packet_parse, (uchar * ) & id); + } + DBGPRINTF("impcap: thread %lx, capture finished\n", + (long unsigned int)tid); + pthread_exit(0); +} + +BEGINrunInput + instanceConf_t *inst; + int ret = 0; +CODESTARTrunInput + for (inst = runModConf->root ; inst != NULL ; inst = inst->next) { + /* creates a thread and starts capturing on the interface */ + ret = pthread_create(&inst->tid, NULL, startCaptureThread, inst); + if (ret) { + LogError(0, RS_RET_NO_RUN, "impcap: error while creating threads\n"); + } + } + + DBGPRINTF("impcap: starting to wait for close condition\n"); + // TODO: Use thread for capture instead of just waiting + while(glbl.GetGlobalInputTermState() == 0) { + if(glbl.GetGlobalInputTermState() == 0) + srSleep(0, 400000); + } + + DBGPRINTF("impcap: received close signal, signaling instance threads...\n"); + for (inst = runModConf->root; inst != NULL; inst = inst->next) { + pthread_kill(inst->tid, SIGTTIN); + } + + DBGPRINTF("impcap: threads signaled, waiting for join..."); + for (inst = runModConf->root ; inst != NULL ; inst = inst->next) { + pthread_join(inst->tid, NULL); + pcap_close(inst->device); + } + + DBGPRINTF("impcap: finished threads, stopping\n"); +ENDrunInput + +BEGINwillRun +CODESTARTwillRun +/* we need to create the inputName property (only once during our lifetime) */ + CHKiRet(prop.Construct(&pInputName)); + CHKiRet(prop.SetString(pInputName, UCHAR_CONSTANT("impcap"), sizeof("impcap") - 1)); + CHKiRet(prop.ConstructFinalize(pInputName)); +finalize_it: +ENDwillRun + +BEGINafterRun +CODESTARTafterRun + if (pInputName != NULL) { + prop.Destruct(&pInputName); + } +ENDafterRun + +BEGINmodExit +CODESTARTmodExit + DBGPRINTF("impcap:: modExit\n"); + objRelease(glbl, CORE_COMPONENT); + objRelease(prop, CORE_COMPONENT); + objRelease(ruleset, CORE_COMPONENT); + objRelease(datetime, CORE_COMPONENT); +ENDmodExit + +/* declaration of functions */ + +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature + if(eFeat == sFEATURENonCancelInputTermination) + iRet = RS_RET_OK; +ENDisCompatibleWithFeature + +BEGINqueryEtryPt +CODESTARTqueryEtryPt + CODEqueryEtryPt_STD_IMOD_QUERIES + CODEqueryEtryPt_STD_CONF2_QUERIES + CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES + CODEqueryEtryPt_STD_CONF2_IMOD_QUERIES + CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES /* might need it */ + CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES +ENDqueryEtryPt + +BEGINmodInit() +CODESTARTmodInit + *ipIFVersProvided = CURR_MOD_IF_VERSION; + CHKiRet(objUse(glbl, CORE_COMPONENT)); + CHKiRet(objUse(ruleset, CORE_COMPONENT)); + CHKiRet(objUse(prop, CORE_COMPONENT)); + CHKiRet(objUse(datetime, CORE_COMPONENT)); +ENDmodInit diff -Nru rsyslog-8.2001.0/contrib/impcap/ipv4_parser.c rsyslog-8.2006.0/contrib/impcap/ipv4_parser.c --- rsyslog-8.2001.0/contrib/impcap/ipv4_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/ipv4_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,101 @@ +/* ipv4_parser.c + * + * This file contains functions to parse IP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +struct ipv4_header_s { +/*#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char version:4; + unsigned char ihl:4; +#else*/ + unsigned char ihl:4; + unsigned char version:4; +//#endif + uint8_t service; + uint16_t totLen; + uint16_t id; + uint16_t frag; + uint8_t ttl; + uint8_t proto; + uint16_t hdrChksum; + uint8_t addrSrc[4]; + uint8_t addrDst[4]; + uint8_t pOptions[]; +}; + +typedef struct ipv4_header_s ipv4_header_t; + +/* + * This function parses the bytes in the received packet to extract IP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the IP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where IP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *ipv4_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("ipv4_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 20) { /* too small for IPv4 header + data (header might be longer)*/ + DBGPRINTF("IPv4 packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + /* Union to prevent cast from uchar to ipv4_header_t */ + union { + const uchar *pck; + ipv4_header_t *hdr; + } ipv4_header_to_char; + + ipv4_header_to_char.pck = packet; + ipv4_header_t *ipv4_header = ipv4_header_to_char.hdr; + + char addrSrc[20], addrDst[20]; + uint8_t hdrLen = 4 * ipv4_header->ihl; /* 4 x length in words */ + + inet_ntop(AF_INET, (void *)&ipv4_header->addrSrc, addrSrc, 20); + inet_ntop(AF_INET, (void *)&ipv4_header->addrDst, addrDst, 20); + + json_object_object_add(jparent, "net_dst_ip", json_object_new_string((char *)addrDst)); + json_object_object_add(jparent, "net_src_ip", json_object_new_string((char *)addrSrc)); + json_object_object_add(jparent, "IP_ihl", json_object_new_int(ipv4_header->ihl)); + json_object_object_add(jparent, "net_ttl", json_object_new_int(ipv4_header->ttl)); + json_object_object_add(jparent, "IP_proto", json_object_new_int(ipv4_header->proto)); + + + return (*ipProtoHandlers[ipv4_header->proto])((packet + hdrLen), (pktSize - hdrLen), jparent); +} diff -Nru rsyslog-8.2001.0/contrib/impcap/ipv6_parser.c rsyslog-8.2006.0/contrib/impcap/ipv6_parser.c --- rsyslog-8.2001.0/contrib/impcap/ipv6_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/ipv6_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,305 @@ +/* ipv6_parser.c + * + * This file contains functions to parse IPv6 headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpacked" +#pragma GCC diagnostic ignored "-Wattributes" +typedef struct __attribute__ ((__packed__)) ipv6_header_s { +#ifndef IPV6_VERSION_MASK +#define IPV6_VERSION_MASK 0xF0000000 +#endif +#ifndef IPV6_TC_MASK +#define IPV6_TC_MASK 0x0FF00000 +#endif +#ifndef IPV6_FLOW_MASK +#define IPV6_FLOW_MASK 0x000FFFFF +#endif + uint32_t vtf; + uint16_t dataLength; + uint8_t nextHeader; +#define IPV6_NHDR_HBH 0 +#define IPV6_NHDR_TCP 6 +#define IPV6_NHDR_UDP 17 +#define IPV6_NHDR_ENCIP6 41 +#define IPV6_NHDR_ROUT 43 +#define IPV6_NHDR_FRAG 44 +#define IPV6_NHDR_RRSV 46 +#define IPV6_NHDR_SEC 50 +#define IPV6_NHDR_AUTH 51 +#define IPV6_NHDR_ICMP6 58 +#define IPV6_NHDR_NONHDR 59 +#define IPV6_NHDR_DOPTS 60 + + uint8_t hopLimit; + uint8_t addrSrc[16]; + uint8_t addrDst[16]; +} ipv6_header_t; +#pragma GCC diagnostic pop + +#ifndef IPV6_VERSION +#define IPV6_VERSION(h) (ntohl(h->vtf) & IPV6_VERSION_MASK)>>28 +#endif +#ifndef IPV6_TC +#define IPV6_TC(h) (ntohl(h->vtf) & IPV6_TC_MASK)>>20 +#endif +#ifndef IPV6_FLOW +#define IPV6_FLOW(h) (ntohl(h->vtf) & IPV6_FLOW_MASK) +#endif + +/* extension headers */ +typedef struct hbh_header_s { + uint8_t nextHeader; + uint8_t hLength; + uint8_t *pOptions; +} hbh_header_t; + +typedef struct dest_header_s { + uint8_t nextHeader; + uint8_t hLength; + uint8_t *pOptions; +} dest_header_t; + +typedef struct route_header_s { + uint8_t nextHeader; + uint8_t hLength; + uint8_t rType; + uint8_t segsLeft; + uint32_t reserved; + uint8_t addrs[16]; +} route_header_t; + +typedef struct frag_header_s { + uint8_t nextHeader; + uint8_t reserved; + uint16_t offsetFlags; + uint32_t id; +} frag_header_t; + +static inline uint8_t hbh_header_parse(const uchar **packet, int *pktSize) { + DBGPRINTF("hbh_header_parse\n"); + + /* Union to prevent cast from uchar to hbh_header_t */ + union { + const uchar *pck; + hbh_header_t *hdr; + } hbh_header_to_char; + + hbh_header_to_char.pck = *packet; + hbh_header_t *hbh_header = hbh_header_to_char.hdr; + + /* hbh_header->hLength is the number of octets of header in 8-octet units minus 1 + * the header length SHOULD be a multiple of 8 */ + uint8_t hByteLength = hbh_header->hLength * 8 + 8; + DBGPRINTF("hByteLength: %d\n", hByteLength); + *pktSize -= hByteLength; + *packet += hByteLength; + + return hbh_header->nextHeader; +} + +static inline uint8_t dest_header_parse(const uchar **packet, int *pktSize) { + DBGPRINTF("dest_header_parse\n"); + + /* Union to prevent cast from uchar to dest_header_t */ + union { + const uchar *pck; + dest_header_t *hdr; + } dest_header_to_char; + + dest_header_to_char.pck = *packet; + dest_header_t *dest_header = dest_header_to_char.hdr; + + /* dest_header->hLength is the number of octets of header in 8-octet units minus 1 + * the header length SHOULD be a multiple of 8 */ + uint8_t hByteLength = dest_header->hLength * 8 + 8; + DBGPRINTF("hByteLength: %d\n", hByteLength); + *pktSize -= hByteLength; + *packet += hByteLength; + + return dest_header->nextHeader; +} + +static inline uint8_t route_header_parse(const uchar **packet, int *pktSize, struct json_object *jparent) { + DBGPRINTF("route_header_parse\n"); + + /* Union to prevent cast from uchar to route_header_t */ + union { + const uchar *pck; + route_header_t *hdr; + } route_header_to_char; + + route_header_to_char.pck = *packet; + route_header_t *route_header = route_header_to_char.hdr; + + /* route_header->hLength is the number of octets of header in 8-octet units minus 1 + * the header length (in bytes) SHOULD be a multiple of 8 */ + uint8_t hByteLength = route_header->hLength * 8 + 8; + *pktSize -= hByteLength; + *packet += hByteLength; + + if (route_header->rType == 0) { + json_object_object_add(jparent, "IP6_route_seg_left", json_object_new_int(route_header->segsLeft)); + + hByteLength -= 8; //leave only length of routing addresses + + char addrStr[40], routeFieldName[20]; + int addrNum = 1; + uint8_t *addr = &(route_header->addrs[0]); + + //while there is enough space for an IPv6 address + while (hByteLength >= 16) { + inet_ntop(AF_INET6, (void *)addr, addrStr, 40); + snprintf(routeFieldName, 20, "IP6_route_%d", addrNum++); + json_object_object_add(jparent, routeFieldName, json_object_new_string((char *)addrStr)); + + addr += 16; + hByteLength -= 16; + } + } + + return route_header->nextHeader; +} + +#define FRAG_OFFSET_MASK 0xFFF8 +#define MFLAG_MASK 0x0001 +static inline uint8_t frag_header_parse(const uchar **packet, int *pktSize, struct json_object *jparent) { + DBGPRINTF("frag_header_parse\n"); + + /* Union to prevent cast from uchar to frag_header_t */ + union { + const uchar *pck; + frag_header_t *hdr; + } frag_header_to_char; + + frag_header_to_char.pck = *packet; + frag_header_t *frag_header = frag_header_to_char.hdr; + + uint16_t flags = ntohs(frag_header->offsetFlags); + + json_object_object_add(jparent, "IP6_frag_offset", json_object_new_int((flags & FRAG_OFFSET_MASK) >> 3)); + json_object_object_add(jparent, "IP6_frag_more", json_object_new_boolean(flags & MFLAG_MASK)); + json_object_object_add(jparent, "IP6_frag_id", json_object_new_int64(frag_header->id)); + + *pktSize -= 8; + *packet += 8; + + return frag_header->nextHeader; +} + +/* + * This function parses the bytes in the received packet to extract IPv6 metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the IPv6 header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where IPv6 metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *ipv6_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("ipv6_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 40) { /* too small for IPv6 header + data (header might be longer)*/ + DBGPRINTF("IPv6 packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + ipv6_header_t *ipv6_header = (ipv6_header_t *)packet; + + char addrSrc[40], addrDst[40]; + + inet_ntop(AF_INET6, (void *)&ipv6_header->addrSrc, addrSrc, 40); + inet_ntop(AF_INET6, (void *)&ipv6_header->addrDst, addrDst, 40); + + json_object_object_add(jparent, "net_dst_ip", json_object_new_string((char *)addrDst)); + json_object_object_add(jparent, "net_src_ip", json_object_new_string((char *)addrSrc)); + json_object_object_add(jparent, "net_ttl", json_object_new_int(ipv6_header->hopLimit)); + + uint8_t nextHeader = ipv6_header->nextHeader; + + packet += sizeof(ipv6_header_t); + pktSize -= sizeof(ipv6_header_t); + + DBGPRINTF("beginning ext headers scan\n"); + uint8_t hasNext = 1; + do { + switch (nextHeader) { + case IPV6_NHDR_HBH: + nextHeader = hbh_header_parse(&packet, &pktSize); + break; + case IPV6_NHDR_TCP: + json_object_object_add(jparent, "IP_proto", json_object_new_int(nextHeader)); + return tcp_parse(packet, pktSize, jparent); + case IPV6_NHDR_UDP: + json_object_object_add(jparent, "IP_proto", json_object_new_int(nextHeader)); + return udp_parse(packet, pktSize, jparent); + case IPV6_NHDR_ENCIP6: + hasNext = 0; + break; + case IPV6_NHDR_ROUT: + nextHeader = route_header_parse(&packet, &pktSize, jparent); + break; + case IPV6_NHDR_FRAG: + nextHeader = frag_header_parse(&packet, &pktSize, jparent); + break; + case IPV6_NHDR_RRSV: + hasNext = 0; + break; + case IPV6_NHDR_SEC: + hasNext = 0; + break; + case IPV6_NHDR_AUTH: + hasNext = 0; + break; + case IPV6_NHDR_ICMP6: + json_object_object_add(jparent, "IP_proto", json_object_new_int(nextHeader)); + return icmp_parse(packet, pktSize, jparent); + case IPV6_NHDR_NONHDR: + hasNext = 0; + break; + case IPV6_NHDR_DOPTS: + nextHeader = dest_header_parse(&packet, &pktSize); + break; + default: + hasNext = 0; + break; + } + } while (hasNext); + + json_object_object_add(jparent, "IP_proto", json_object_new_int(nextHeader)); + RETURN_DATA_AFTER(0) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/ipx_parser.c rsyslog-8.2006.0/contrib/impcap/ipx_parser.c --- rsyslog-8.2001.0/contrib/impcap/ipx_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/ipx_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,97 @@ +/* ipx_parser.c + * + * This file contains functions to parse IPX (Novell) headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpacked" +#pragma GCC diagnostic ignored "-Wattributes" +struct __attribute__ ((__packed__)) ipx_header_s { + uint16_t chksum; + uint16_t pktLen; + uint8_t transCtrl; + uint8_t type; + uint32_t dstNet; + uint8_t dstNode[6]; + uint16_t dstSocket; + uint32_t srcNet; + uint8_t srcNode[6]; + uint16_t srcSocket; +}; +#pragma GCC diagnostic pop + +typedef struct ipx_header_s ipx_header_t; + +/* + * This function parses the bytes in the received packet to extract IPX metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the IPX header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where IPX metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *ipx_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + + DBGPRINTF("entered ipx_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 30) { /* too short for IPX header */ + DBGPRINTF("IPX packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + char ipxSrcNode[20], ipxDstNode[20]; + ipx_header_t *ipx_header = (ipx_header_t *)packet; + + snprintf(ipxDstNode, sizeof(ipxDstNode), "%02x:%02x:%02x:%02x:%02x:%02x", ipx_header->dstNode[0], + ipx_header->dstNode[1], ipx_header->dstNode[2], ipx_header->dstNode[3], ipx_header->dstNode[4], + ipx_header->dstNode[5]); + + snprintf(ipxSrcNode, sizeof(ipxSrcNode), "%02x:%02x:%02x:%02x:%02x:%02x", ipx_header->srcNode[0], + ipx_header->srcNode[1], ipx_header->srcNode[2], ipx_header->srcNode[3], ipx_header->srcNode[4], + ipx_header->srcNode[5]); + + json_object_object_add(jparent, "IPX_transCtrl", json_object_new_int(ipx_header->transCtrl)); + json_object_object_add(jparent, "IPX_type", json_object_new_int(ipx_header->type)); + json_object_object_add(jparent, "IPX_dest_net", json_object_new_int(ntohl(ipx_header->dstNet))); + json_object_object_add(jparent, "IPX_src_net", json_object_new_int(ntohl(ipx_header->srcNet))); + json_object_object_add(jparent, "IPX_dest_node", json_object_new_string(ipxDstNode)); + json_object_object_add(jparent, "IPX_src_node", json_object_new_string(ipxSrcNode)); + json_object_object_add(jparent, "IPX_dest_socket", json_object_new_int(ntohs(ipx_header->dstSocket))); + json_object_object_add(jparent, "IPX_src_socket", json_object_new_int(ntohs(ipx_header->srcSocket))); + + RETURN_DATA_AFTER(30) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/llc_parser.c rsyslog-8.2006.0/contrib/impcap/llc_parser.c --- rsyslog-8.2001.0/contrib/impcap/llc_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/llc_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,109 @@ +/* llc_parser.c + * + * This file contains functions to parse llc headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +/* + * This function parses the bytes in the received packet to extract LLC metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the LLC header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where LLC metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *llc_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("entered llc_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 3) { /* too short for llc header */ + DBGPRINTF("LLC packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + uint8_t dsapField, dsap, ssapField, ssap; + uint16_t ctrl; + uint8_t headerLen; + + dsapField = (uint8_t)packet[0]; + ssapField = (uint8_t)packet[1]; + DBGPRINTF("dsapField : %02X\n", dsapField); + DBGPRINTF("ssapField : %02X\n", ssapField); + + if (dsapField == 0xff && ssapField == 0xff) { + /* this is an IPX packet, without LLC */ + return ipx_parse(packet, pktSize, jparent); + } + + if ((packet[2] & 0x03) == 3) { + /* U frame: LLC control is 8 bits */ + ctrl = (uint8_t)packet[2]; + headerLen = 3; + } else { + /* I and S data frames: LLC control is 16 bits */ + ctrl = ntohs((uint16_t)packet[2]); + headerLen = 4; + } + + /* don't take last bit into account */ + dsap = dsapField & 0xfe; + ssap = ssapField & 0xfe; + + json_object_object_add(jparent, "LLC_dsap", json_object_new_int(dsap)); + json_object_object_add(jparent, "LLC_ssap", json_object_new_int(ssap)); + json_object_object_add(jparent, "LLC_ctrl", json_object_new_int(ctrl)); + + if (dsap == 0xaa && ssap == 0xaa && ctrl == 0x03) { + /* SNAP header */ + uint32_t orgCode = packet[headerLen] << 16 | + packet[headerLen + 1] << 8 | + packet[headerLen + 2]; + uint16_t ethType = packet[headerLen + 3] << 8 | + packet[headerLen + 4]; + json_object_object_add(jparent, "SNAP_oui", json_object_new_int(orgCode)); + json_object_object_add(jparent, "SNAP_ethType", json_object_new_int(ethType)); + return (*ethProtoHandlers[ethType])(packet + headerLen, pktSize - headerLen, jparent); + } + if (dsap == 0x06 && ssap == 0x06 && ctrl == 0x03) { + /* IPv4 header */ + return ipv4_parse(packet + headerLen, pktSize - headerLen, jparent); + } + if (dsap == 0xe0 && ssap == 0xe0 && ctrl == 0x03) { + /* IPX packet with LLC */ + return ipx_parse(packet + headerLen, pktSize - headerLen, jparent); + } + + RETURN_DATA_AFTER(headerLen) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/Makefile.am rsyslog-8.2006.0/contrib/impcap/Makefile.am --- rsyslog-8.2001.0/contrib/impcap/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,22 @@ +pkglib_LTLIBRARIES = impcap.la + +impcap_la_SOURCES = impcap.c +impcap_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) +impcap_la_LDFLAGS = -module -avoid-version +impcap_la_LIBADD = -lpcap + +impcap_la_SOURCES += arp_parser.c +impcap_la_SOURCES += eth_parser.c +impcap_la_SOURCES += icmp_parser.c +impcap_la_SOURCES += ipv4_parser.c +impcap_la_SOURCES += ipv6_parser.c +impcap_la_SOURCES += ipx_parser.c +impcap_la_SOURCES += llc_parser.c +impcap_la_SOURCES += udp_parser.c +impcap_la_SOURCES += dns_parser.c +impcap_la_SOURCES += tcp_parser.c +impcap_la_SOURCES += smb_parser.c +impcap_la_SOURCES += ftp_parser.c +impcap_la_SOURCES += http_parser.c + +EXTRA_DIST=parsers.h diff -Nru rsyslog-8.2001.0/contrib/impcap/Makefile.in rsyslog-8.2006.0/contrib/impcap/Makefile.in --- rsyslog-8.2001.0/contrib/impcap/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/Makefile.in 2020-06-22 12:58:09.000000000 +0000 @@ -0,0 +1,886 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = contrib/impcap +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_define.m4 \ + $(top_srcdir)/m4/atomic_operations.m4 \ + $(top_srcdir)/m4/atomic_operations_64bit.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkglibdir)" +LTLIBRARIES = $(pkglib_LTLIBRARIES) +impcap_la_DEPENDENCIES = +am_impcap_la_OBJECTS = impcap_la-impcap.lo impcap_la-arp_parser.lo \ + impcap_la-eth_parser.lo impcap_la-icmp_parser.lo \ + impcap_la-ipv4_parser.lo impcap_la-ipv6_parser.lo \ + impcap_la-ipx_parser.lo impcap_la-llc_parser.lo \ + impcap_la-udp_parser.lo impcap_la-dns_parser.lo \ + impcap_la-tcp_parser.lo impcap_la-smb_parser.lo \ + impcap_la-ftp_parser.lo impcap_la-http_parser.lo +impcap_la_OBJECTS = $(am_impcap_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +impcap_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(impcap_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(impcap_la_SOURCES) +DIST_SOURCES = $(impcap_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILE_PATH = @CONF_FILE_PATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CYGPATH_W = @CYGPATH_W@ +CZMQ_CFLAGS = @CZMQ_CFLAGS@ +CZMQ_LIBS = @CZMQ_LIBS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +GSS_LIBS = @GSS_LIBS@ +GT_KSI_LS12_CFLAGS = @GT_KSI_LS12_CFLAGS@ +GT_KSI_LS12_LIBS = @GT_KSI_LS12_LIBS@ +HASH_XXHASH_LIBS = @HASH_XXHASH_LIBS@ +HIREDIS_CFLAGS = @HIREDIS_CFLAGS@ +HIREDIS_LIBS = @HIREDIS_LIBS@ +IMUDP_LIBS = @IMUDP_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IP = @IP@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDBI_CFLAGS = @LIBDBI_CFLAGS@ +LIBDBI_LIBS = @LIBDBI_LIBS@ +LIBESTR_CFLAGS = @LIBESTR_CFLAGS@ +LIBESTR_LIBS = @LIBESTR_LIBS@ +LIBFASTJSON_CFLAGS = @LIBFASTJSON_CFLAGS@ +LIBFASTJSON_LIBS = @LIBFASTJSON_LIBS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@ +LIBLOGGING_LIBS = @LIBLOGGING_LIBS@ +LIBLOGGING_STDLOG_CFLAGS = @LIBLOGGING_STDLOG_CFLAGS@ +LIBLOGGING_STDLOG_LIBS = @LIBLOGGING_STDLOG_LIBS@ +LIBLOGNORM_CFLAGS = @LIBLOGNORM_CFLAGS@ +LIBLOGNORM_LIBS = @LIBLOGNORM_LIBS@ +LIBLZ4_CFLAGS = @LIBLZ4_CFLAGS@ +LIBLZ4_LIBS = @LIBLZ4_LIBS@ +LIBM = @LIBM@ +LIBMONGOC_CFLAGS = @LIBMONGOC_CFLAGS@ +LIBMONGOC_LIBS = @LIBMONGOC_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBRDKAFKA_CFLAGS = @LIBRDKAFKA_CFLAGS@ +LIBRDKAFKA_LIBS = @LIBRDKAFKA_LIBS@ +LIBS = @LIBS@ +LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ +LIBSYSTEMD_JOURNAL_CFLAGS = @LIBSYSTEMD_JOURNAL_CFLAGS@ +LIBSYSTEMD_JOURNAL_LIBS = @LIBSYSTEMD_JOURNAL_LIBS@ +LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUUID_CFLAGS = @LIBUUID_CFLAGS@ +LIBUUID_LIBS = @LIBUUID_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_CONFIG = @MYSQL_CONFIG@ +MYSQL_LIBS = @MYSQL_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PGSQL_CFLAGS = @PGSQL_CFLAGS@ +PGSQL_LIBS = @PGSQL_LIBS@ +PG_CONFIG = @PG_CONFIG@ +PID_FILE_PATH = @PID_FILE_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROTON_CFLAGS = @PROTON_CFLAGS@ +PROTON_LIBS = @PROTON_LIBS@ +PTHREADS_CFLAGS = @PTHREADS_CFLAGS@ +PTHREADS_LIBS = @PTHREADS_LIBS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RABBITMQ_CFLAGS = @RABBITMQ_CFLAGS@ +RABBITMQ_LIBS = @RABBITMQ_LIBS@ +RANLIB = @RANLIB@ +READLINK = @READLINK@ +RELP_CFLAGS = @RELP_CFLAGS@ +RELP_LIBS = @RELP_LIBS@ +RSRT_CFLAGS = @RSRT_CFLAGS@ +RSRT_CFLAGS1 = @RSRT_CFLAGS1@ +RSRT_LIBS = @RSRT_LIBS@ +RSRT_LIBS1 = @RSRT_LIBS1@ +RST2MAN = @RST2MAN@ +RT_LIBS = @RT_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SNMP_CFLAGS = @SNMP_CFLAGS@ +SNMP_LIBS = @SNMP_LIBS@ +SOL_LIBS = @SOL_LIBS@ +STRIP = @STRIP@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ +TCL_LIB_FILE = @TCL_LIB_FILE@ +TCL_LIB_FLAG = @TCL_LIB_FLAG@ +TCL_LIB_SPEC = @TCL_LIB_SPEC@ +TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ +TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ +TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ +TCL_VERSION = @TCL_VERSION@ +UDPSPOOF_CFLAGS = @UDPSPOOF_CFLAGS@ +UDPSPOOF_LIBS = @UDPSPOOF_LIBS@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@ +WGET = @WGET@ +YACC = @YACC@ +YACC_FOUND = @YACC_FOUND@ +YFLAGS = @YFLAGS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +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_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +pkglib_LTLIBRARIES = impcap.la +impcap_la_SOURCES = impcap.c arp_parser.c eth_parser.c icmp_parser.c \ + ipv4_parser.c ipv6_parser.c ipx_parser.c llc_parser.c \ + udp_parser.c dns_parser.c tcp_parser.c smb_parser.c \ + ftp_parser.c http_parser.c +impcap_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) +impcap_la_LDFLAGS = -module -avoid-version +impcap_la_LIBADD = -lpcap +EXTRA_DIST = parsers.h +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 ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/impcap/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu contrib/impcap/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 +$(am__aclocal_m4_deps): + +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ + } + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +impcap.la: $(impcap_la_OBJECTS) $(impcap_la_DEPENDENCIES) $(EXTRA_impcap_la_DEPENDENCIES) + $(AM_V_CCLD)$(impcap_la_LINK) -rpath $(pkglibdir) $(impcap_la_OBJECTS) $(impcap_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-arp_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-dns_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-eth_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-ftp_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-http_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-icmp_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-impcap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-ipv4_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-ipv6_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-ipx_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-llc_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-smb_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-tcp_parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/impcap_la-udp_parser.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +impcap_la-impcap.lo: impcap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-impcap.lo -MD -MP -MF $(DEPDIR)/impcap_la-impcap.Tpo -c -o impcap_la-impcap.lo `test -f 'impcap.c' || echo '$(srcdir)/'`impcap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-impcap.Tpo $(DEPDIR)/impcap_la-impcap.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='impcap.c' object='impcap_la-impcap.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-impcap.lo `test -f 'impcap.c' || echo '$(srcdir)/'`impcap.c + +impcap_la-arp_parser.lo: arp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-arp_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-arp_parser.Tpo -c -o impcap_la-arp_parser.lo `test -f 'arp_parser.c' || echo '$(srcdir)/'`arp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-arp_parser.Tpo $(DEPDIR)/impcap_la-arp_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='arp_parser.c' object='impcap_la-arp_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-arp_parser.lo `test -f 'arp_parser.c' || echo '$(srcdir)/'`arp_parser.c + +impcap_la-eth_parser.lo: eth_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-eth_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-eth_parser.Tpo -c -o impcap_la-eth_parser.lo `test -f 'eth_parser.c' || echo '$(srcdir)/'`eth_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-eth_parser.Tpo $(DEPDIR)/impcap_la-eth_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eth_parser.c' object='impcap_la-eth_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-eth_parser.lo `test -f 'eth_parser.c' || echo '$(srcdir)/'`eth_parser.c + +impcap_la-icmp_parser.lo: icmp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-icmp_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-icmp_parser.Tpo -c -o impcap_la-icmp_parser.lo `test -f 'icmp_parser.c' || echo '$(srcdir)/'`icmp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-icmp_parser.Tpo $(DEPDIR)/impcap_la-icmp_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='icmp_parser.c' object='impcap_la-icmp_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-icmp_parser.lo `test -f 'icmp_parser.c' || echo '$(srcdir)/'`icmp_parser.c + +impcap_la-ipv4_parser.lo: ipv4_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-ipv4_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-ipv4_parser.Tpo -c -o impcap_la-ipv4_parser.lo `test -f 'ipv4_parser.c' || echo '$(srcdir)/'`ipv4_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-ipv4_parser.Tpo $(DEPDIR)/impcap_la-ipv4_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ipv4_parser.c' object='impcap_la-ipv4_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-ipv4_parser.lo `test -f 'ipv4_parser.c' || echo '$(srcdir)/'`ipv4_parser.c + +impcap_la-ipv6_parser.lo: ipv6_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-ipv6_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-ipv6_parser.Tpo -c -o impcap_la-ipv6_parser.lo `test -f 'ipv6_parser.c' || echo '$(srcdir)/'`ipv6_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-ipv6_parser.Tpo $(DEPDIR)/impcap_la-ipv6_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ipv6_parser.c' object='impcap_la-ipv6_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-ipv6_parser.lo `test -f 'ipv6_parser.c' || echo '$(srcdir)/'`ipv6_parser.c + +impcap_la-ipx_parser.lo: ipx_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-ipx_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-ipx_parser.Tpo -c -o impcap_la-ipx_parser.lo `test -f 'ipx_parser.c' || echo '$(srcdir)/'`ipx_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-ipx_parser.Tpo $(DEPDIR)/impcap_la-ipx_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ipx_parser.c' object='impcap_la-ipx_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-ipx_parser.lo `test -f 'ipx_parser.c' || echo '$(srcdir)/'`ipx_parser.c + +impcap_la-llc_parser.lo: llc_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-llc_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-llc_parser.Tpo -c -o impcap_la-llc_parser.lo `test -f 'llc_parser.c' || echo '$(srcdir)/'`llc_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-llc_parser.Tpo $(DEPDIR)/impcap_la-llc_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='llc_parser.c' object='impcap_la-llc_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-llc_parser.lo `test -f 'llc_parser.c' || echo '$(srcdir)/'`llc_parser.c + +impcap_la-udp_parser.lo: udp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-udp_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-udp_parser.Tpo -c -o impcap_la-udp_parser.lo `test -f 'udp_parser.c' || echo '$(srcdir)/'`udp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-udp_parser.Tpo $(DEPDIR)/impcap_la-udp_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='udp_parser.c' object='impcap_la-udp_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-udp_parser.lo `test -f 'udp_parser.c' || echo '$(srcdir)/'`udp_parser.c + +impcap_la-dns_parser.lo: dns_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-dns_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-dns_parser.Tpo -c -o impcap_la-dns_parser.lo `test -f 'dns_parser.c' || echo '$(srcdir)/'`dns_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-dns_parser.Tpo $(DEPDIR)/impcap_la-dns_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dns_parser.c' object='impcap_la-dns_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-dns_parser.lo `test -f 'dns_parser.c' || echo '$(srcdir)/'`dns_parser.c + +impcap_la-tcp_parser.lo: tcp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-tcp_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-tcp_parser.Tpo -c -o impcap_la-tcp_parser.lo `test -f 'tcp_parser.c' || echo '$(srcdir)/'`tcp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-tcp_parser.Tpo $(DEPDIR)/impcap_la-tcp_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp_parser.c' object='impcap_la-tcp_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-tcp_parser.lo `test -f 'tcp_parser.c' || echo '$(srcdir)/'`tcp_parser.c + +impcap_la-smb_parser.lo: smb_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-smb_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-smb_parser.Tpo -c -o impcap_la-smb_parser.lo `test -f 'smb_parser.c' || echo '$(srcdir)/'`smb_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-smb_parser.Tpo $(DEPDIR)/impcap_la-smb_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='smb_parser.c' object='impcap_la-smb_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-smb_parser.lo `test -f 'smb_parser.c' || echo '$(srcdir)/'`smb_parser.c + +impcap_la-ftp_parser.lo: ftp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-ftp_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-ftp_parser.Tpo -c -o impcap_la-ftp_parser.lo `test -f 'ftp_parser.c' || echo '$(srcdir)/'`ftp_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-ftp_parser.Tpo $(DEPDIR)/impcap_la-ftp_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ftp_parser.c' object='impcap_la-ftp_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-ftp_parser.lo `test -f 'ftp_parser.c' || echo '$(srcdir)/'`ftp_parser.c + +impcap_la-http_parser.lo: http_parser.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT impcap_la-http_parser.lo -MD -MP -MF $(DEPDIR)/impcap_la-http_parser.Tpo -c -o impcap_la-http_parser.lo `test -f 'http_parser.c' || echo '$(srcdir)/'`http_parser.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/impcap_la-http_parser.Tpo $(DEPDIR)/impcap_la-http_parser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http_parser.c' object='impcap_la-http_parser.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(impcap_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o impcap_la-http_parser.lo `test -f 'http_parser.c' || echo '$(srcdir)/'`http_parser.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +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 TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ + ctags-am 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 tags-am uninstall uninstall-am \ + uninstall-pkglibLTLIBRARIES + +.PRECIOUS: Makefile + + +# 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 -Nru rsyslog-8.2001.0/contrib/impcap/parsers.h rsyslog-8.2006.0/contrib/impcap/parsers.h --- rsyslog-8.2001.0/contrib/impcap/parsers.h 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/parsers.h 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,126 @@ +/* parser.h + * + * This file contains the prototypes of all the parsers available within impcap. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include +#include +#include +#include +#include +#include +#include + +#include "rsyslog.h" +#include "msg.h" +#include "dirty.h" + +#ifdef __FreeBSD__ +#include +#else + +#include + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef INCLUDED_PARSER_H +#define INCLUDED_PARSER_H 1 + +#define IP_PROTO_NUM 256 +#define ETH_PROTO_NUM 0x9000 + +/* data return structure */ +struct data_ret_s { + size_t size; + char *pData; +}; +typedef struct data_ret_s data_ret_t; + +data_ret_t *(*ipProtoHandlers[IP_PROTO_NUM])(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *(*ethProtoHandlers[ETH_PROTO_NUM])(const uchar *packet, int pktSize, struct json_object *jparent); + +/* --- handlers prototypes --- */ +void packet_parse(uchar *arg, const struct pcap_pkthdr *pkthdr, const uchar *packet); + +data_ret_t *eth_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *llc_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *ipx_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *ipv4_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *icmp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *tcp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *udp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *ipv6_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *arp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *rarp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *dont_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *ah_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *esp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *smb_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *ftp_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *http_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +data_ret_t *dns_parse(const uchar *packet, int pktSize, struct json_object *jparent); + +#define RETURN_DATA_AFTER(x) data_ret_t *retData = malloc(sizeof(data_ret_t)); \ + if(pktSize > x) { \ + retData->size = pktSize - x; \ + retData->pData = (char *)packet + x; \ + } \ + else { \ + retData->size = 0; \ + retData->pData = NULL; \ + } \ + return retData; \ + +#endif /* INCLUDED_PARSER_H */ diff -Nru rsyslog-8.2001.0/contrib/impcap/smb_parser.c rsyslog-8.2006.0/contrib/impcap/smb_parser.c --- rsyslog-8.2001.0/contrib/impcap/smb_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/smb_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,145 @@ +/* smb_parser.c + * + * This file contains functions to parse SMB (version 2 and 3) headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +/* SMB2 opCodes */ +#define SMB2_NEGOTIATE 0x00 +#define SMB2_SESSIONSET 0x01 +#define SMB2_SESSIONLOGOFF 0x02 +#define SMB2_TREECONNECT 0x03 +#define SMB2_TREEDISCONNECT 0x04 +#define SMB2_CREATE 0x05 +#define SMB2_CLOSE 0x06 +#define SMB2_FLUSH 0x07 +#define SMB2_READ 0x08 +#define SMB2_WRITE 0x09 +#define SMB2_LOCK 0x0a +#define SMB2_IOCTL 0x0b +#define SMB2_CANCEL 0x0c +#define SMB2_KEEPALIVE 0x0d +#define SMB2_FIND 0x0e +#define SMB2_NOTIFY 0x0f +#define SMB2_GETINFO 0x10 +#define SMB2_SETINFO 0x11 +#define SMB2_BREAK 0x12 + +struct smb_header_s { + uint32_t version; + uint16_t headerLength; + uint16_t padding1; + uint32_t ntStatus; + uint16_t opCode; + uint16_t padding2; + uint32_t flags; + uint32_t chainOffset; + uint32_t comSeqNumber[2]; + uint32_t processID; + uint32_t treeID; + uint32_t userID[2]; + uint32_t signature[4]; +}; + +typedef struct smb_header_s smb_header_t; + +static char flagCodes[5] = "RPCS"; + +/* + * This function parses the bytes in the received packet to extract SMB2 metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the beginning of the header will be checked by the function + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where SMB2 metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *smb_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("smb_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + int pktSizeCpy = pktSize; + const uchar *packetCpy = packet; + + while (pktSizeCpy > 0) { + /* don't check packetCpy[0] to include SMB version byte at the beginning */ + if (packetCpy[1] == 'S') { + if (packetCpy[2] == 'M') { + if (packetCpy[3] == 'B') { + break; + } + } + } + packetCpy++, pktSizeCpy--; + } + + if ((int)pktSizeCpy < 64) { + DBGPRINTF("SMB packet too small : %d\n", pktSizeCpy); + RETURN_DATA_AFTER(0) + } + + /* Union to prevent cast from uchar to smb_header_t */ + union { + const uchar *pck; + smb_header_t *hdr; + } smb_header_to_char; + + smb_header_to_char.pck = packetCpy; + smb_header_t *smb_header = smb_header_to_char.hdr; + + char flags[5] = {0}; + uint64_t seqNum, userID; + uint8_t version; + + version = (smb_header->version == 0xFF) ? 1 : 2; + seqNum = smb_header->comSeqNumber[0] | smb_header->comSeqNumber[1] << 16; + userID = smb_header->userID[0] | smb_header->userID[1] << 16; + + uint8_t i, pos = 0; + for (i = 0; i < 4; ++i) { + if (smb_header->flags & (0x01 << i)) + flags[pos++] = flagCodes[i]; + } + + json_object_object_add(jparent, "SMB_version", json_object_new_int(version)); + json_object_object_add(jparent, "SMB_NTstatus", json_object_new_int64(smb_header->ntStatus)); + json_object_object_add(jparent, "SMB_operation", json_object_new_int(smb_header->opCode)); + json_object_object_add(jparent, "SMB_flags", json_object_new_string(flags)); + json_object_object_add(jparent, "SMB_seqNumber", json_object_new_int64(seqNum)); + json_object_object_add(jparent, "SMB_processID", json_object_new_int64(smb_header->processID)); + json_object_object_add(jparent, "SMB_treeID", json_object_new_int64(smb_header->treeID)); + json_object_object_add(jparent, "SMB_userID", json_object_new_int64(userID)); + + RETURN_DATA_AFTER(0) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/tcp_parser.c rsyslog-8.2006.0/contrib/impcap/tcp_parser.c --- rsyslog-8.2001.0/contrib/impcap/tcp_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/tcp_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,121 @@ +/* tcp_parser.c + * + * This file contains functions to parse TCP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +#define SMB_PORT 445 +#define HTTP_PORT 80 +#define HTTP_PORT_ALT 8080 +#define FTP_PORT 21 +#define FTP_PORT_DATA 20 + +struct tcp_header_s { + uint16_t srcPort; + uint16_t dstPort; + uint32_t seq; + uint32_t ack; + uint8_t dor; + uint8_t flags; + uint16_t windowSize; + uint16_t checksum; + uint16_t urgPointer; + uint8_t options[]; +}; + +typedef struct tcp_header_s tcp_header_t; + +static char flagCodes[10] = "FSRPAUECN"; + +/* + * This function parses the bytes in the received packet to extract TCP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the TCP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where TCP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *tcp_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("tcp_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 20) { + DBGPRINTF("TCP packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + /* Union to prevent cast from uchar to tcp_header_t */ + union { + const uchar *pck; + tcp_header_t *hdr; + } tcp_header_to_char; + + tcp_header_to_char.pck = packet; + tcp_header_t *tcp_header = tcp_header_to_char.hdr; + + uint8_t i, pos = 0; + char flags[10] = {0}; + + for (i = 0; i < 8; ++i) { + if (tcp_header->flags & (0x01 << i)) + flags[pos++] = flagCodes[i]; + } + if (tcp_header->dor & 0x01) + flags[pos++] = flagCodes[9]; + + uint16_t srcPort = ntohs(tcp_header->srcPort); + uint16_t dstPort = ntohs(tcp_header->dstPort); + + uint8_t headerLength = (tcp_header->dor & 0xF0) >> 2; //>>4 to offset but <<2 to get offset as bytes + + json_object_object_add(jparent, "net_src_port", json_object_new_int(srcPort)); + json_object_object_add(jparent, "net_dst_port", json_object_new_int(dstPort)); + json_object_object_add(jparent, "TCP_seq_number", json_object_new_int64(ntohl(tcp_header->seq))); + json_object_object_add(jparent, "TCP_ack_number", json_object_new_int64(ntohl(tcp_header->ack))); + json_object_object_add(jparent, "net_flags", json_object_new_string(flags)); + + if (srcPort == SMB_PORT || dstPort == SMB_PORT) { + return smb_parse(packet + headerLength, pktSize - headerLength, jparent); + } + if (srcPort == FTP_PORT || dstPort == FTP_PORT || srcPort == FTP_PORT_DATA || dstPort == FTP_PORT_DATA) { + return ftp_parse(packet + headerLength, pktSize - headerLength, jparent); + } + if (srcPort == HTTP_PORT || dstPort == HTTP_PORT || + srcPort == HTTP_PORT_ALT || dstPort == HTTP_PORT_ALT) { + return http_parse(packet + headerLength, pktSize - headerLength, jparent); + } + DBGPRINTF("tcp return after header length (%u)\n", headerLength); + RETURN_DATA_AFTER(headerLength) +} diff -Nru rsyslog-8.2001.0/contrib/impcap/udp_parser.c rsyslog-8.2006.0/contrib/impcap/udp_parser.c --- rsyslog-8.2001.0/contrib/impcap/udp_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/contrib/impcap/udp_parser.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,90 @@ +/* udp_parser.c + * + * This file contains functions to parse UDP headers. + * + * File begun on 2018-11-13 + * + * Created by: + * - Théo Bertin (theo.bertin@advens.fr) + * + * With: + * - François Bernard (francois.bernard@isen.yncrea.fr) + * - Tianyu Geng (tianyu.geng@isen.yncrea.fr) + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" +#include "parsers.h" + +#define DNS_PORT 53 + +struct udp_header_s { + uint16_t srcPort; + uint16_t dstPort; + uint16_t totalLength; + uint16_t checksum; +}; + +typedef struct udp_header_s udp_header_t; + +/* + * This function parses the bytes in the received packet to extract UDP metadata. + * + * its parameters are: + * - a pointer on the list of bytes representing the packet + * the first byte must be the beginning of the UDP header + * - the size of the list passed as first parameter + * - a pointer on a json_object, containing all the metadata recovered so far + * this is also where UDP metadata will be added + * + * This function returns a structure containing the data unprocessed by this parser + * or the ones after (as a list of bytes), and the length of this data. +*/ +data_ret_t *udp_parse(const uchar *packet, int pktSize, struct json_object *jparent) { + DBGPRINTF("udp_parse\n"); + DBGPRINTF("packet size %d\n", pktSize); + + if (pktSize < 8) { + DBGPRINTF("UDP packet too small : %d\n", pktSize); + RETURN_DATA_AFTER(0) + } + + /* Union to prevent cast from uchar to udp_header_t */ + union { + const uchar *pck; + udp_header_t *hdr; + } udp_header_to_char; + + udp_header_to_char.pck = packet; + udp_header_t *udp_header = udp_header_to_char.hdr; + + // Prevent endianness issue + unsigned short int src_port = ntohs(udp_header->srcPort); + unsigned short int dst_port = ntohs(udp_header->dstPort); + + json_object_object_add(jparent, "net_src_port", json_object_new_int(src_port)); + json_object_object_add(jparent, "net_dst_port", json_object_new_int(dst_port)); + json_object_object_add(jparent, "UDP_Length", json_object_new_int(ntohs(udp_header->totalLength))); + json_object_object_add(jparent, "UDP_Checksum", json_object_new_int(ntohs(udp_header->checksum))); + + if (src_port == DNS_PORT || dst_port == DNS_PORT) { + return dns_parse(packet + sizeof(udp_header_t), pktSize - sizeof(udp_header_t), jparent); + } + + RETURN_DATA_AFTER(8) +} diff -Nru rsyslog-8.2001.0/contrib/omhttp/omhttp.c rsyslog-8.2006.0/contrib/omhttp/omhttp.c --- rsyslog-8.2001.0/contrib/omhttp/omhttp.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/contrib/omhttp/omhttp.c 2020-06-22 12:57:15.000000000 +0000 @@ -119,6 +119,8 @@ uchar *httpheaderkey; uchar *httpheadervalue; uchar *headerBuf; + uchar **httpHeaders; + int nHttpHeaders; uchar *restPath; uchar *checkPath; uchar *tplName; @@ -189,6 +191,7 @@ { "httpcontenttype", eCmdHdlrGetWord, 0 }, { "httpheaderkey", eCmdHdlrGetWord, 0 }, { "httpheadervalue", eCmdHdlrString, 0 }, + { "httpheaders", eCmdHdlrArray, 0 }, { "uid", eCmdHdlrGetWord, 0 }, { "pwd", eCmdHdlrGetWord, 0 }, { "restpath", eCmdHdlrGetWord, 0 }, @@ -299,6 +302,11 @@ free(pData->headerContentTypeBuf); free(pData->httpheaderkey); free(pData->httpheadervalue); + for(i = 0 ; i < pData->nHttpHeaders ; ++i) { + free((void*) pData->httpHeaders[i]); + } + free(pData->httpHeaders); + pData->nHttpHeaders = 0; free(pData->pwd); free(pData->authBuf); free(pData->headerBuf); @@ -351,6 +359,10 @@ (uchar*)"(not configured)" : pData->httpheaderkey); dbgprintf("\thttpheadervalue='%s'\n", pData->httpheadervalue == NULL ? (uchar*)"(not configured)" : pData->httpheadervalue); + dbgprintf("\thttpHeaders=["); + for(i = 0 ; i < pData->nHttpHeaders ; ++i) + dbgprintf("\t%s\n",pData->httpHeaders[i]); + dbgprintf("\t]\n"); dbgprintf("\tpwd=(%sconfigured)\n", pData->pwd == NULL ? "not " : ""); dbgprintf("\trest path='%s'\n", pData->restPath); dbgprintf("\tcheck path='%s'\n", pData->checkPath); @@ -1029,6 +1041,11 @@ CHKmalloc(slist); } + for (int k = 0 ; k < pWrkrData->pData->nHttpHeaders; k++) { + slist = curl_slist_append(slist, (char *)pWrkrData->pData->httpHeaders[k]); + CHKmalloc(slist); + } + // When sending more than 1Kb, libcurl automatically sends an Except: 100-Continue header // and will wait 1s for a response, could make this configurable but for now disable slist = curl_slist_append(slist, HTTP_HEADER_EXPECT_EMPTY); @@ -1656,9 +1673,17 @@ } else { slist = curl_slist_append(slist, HTTP_HEADER_CONTENT_JSON); } + if (pWrkrData->pData->headerBuf != NULL) { slist = curl_slist_append(slist, (char *)pWrkrData->pData->headerBuf); + CHKmalloc(slist); } + + for (int k = 0 ; k < pWrkrData->pData->nHttpHeaders; k++) { + slist = curl_slist_append(slist, (char *)pWrkrData->pData->httpHeaders[k]); + CHKmalloc(slist); + } + // When sending more than 1Kb, libcurl automatically sends an Except: 100-Continue header // and will wait 1s for a response, could make this configurable but for now disable slist = curl_slist_append(slist, HTTP_HEADER_EXPECT_EMPTY); @@ -1705,6 +1730,8 @@ pData->headerContentTypeBuf = NULL; pData->httpheaderkey = NULL; pData->httpheadervalue = NULL; + pData->httpHeaders = NULL; + pData->nHttpHeaders = 0; pData->pwd = NULL; pData->authBuf = NULL; pData->restPath = NULL; @@ -1735,6 +1762,20 @@ pData->retryRuleset = NULL; } +static rsRetVal +checkHeaderParam(char *const param) +{ + DEFiRet; + char *val = strstr(param, ":"); + if(val == NULL) { + LogError(0, RS_RET_PARAM_ERROR, "missing ':' delimiter in " + "parameter '%s'", param); + ABORT_FINALIZE(RS_RET_PARAM_ERROR); + } +finalize_it: + RETiRet; +} + BEGINnewActInst struct cnfparamvals *pvals; char* serverParam = NULL; @@ -1772,6 +1813,14 @@ pData->httpheaderkey = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "httpheadervalue")) { pData->httpheadervalue = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); + } else if(!strcmp(actpblk.descr[i].name, "httpheaders")) { + pData->nHttpHeaders = pvals[i].val.d.ar->nmemb; + CHKmalloc(pData->httpHeaders = malloc(sizeof(uchar *) * pvals[i].val.d.ar->nmemb )); + for(int j = 0 ; j < pvals[i].val.d.ar->nmemb ; ++j) { + char *cstr = es_str2cstr(pvals[i].val.d.ar->arr[j], NULL); + CHKiRet(checkHeaderParam(cstr)); + pData->httpHeaders[j] = (uchar *)cstr; + } } else if(!strcmp(actpblk.descr[i].name, "pwd")) { pData->pwd = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "restpath")) { @@ -1896,6 +1945,7 @@ if (pData->httpcontenttype != NULL) CHKiRet(computeApiHeader((char*) "Content-Type", (char*) pData->httpcontenttype, &pData->headerContentTypeBuf)); + if (pData->httpheaderkey != NULL) CHKiRet(computeApiHeader((char*) pData->httpheaderkey, (char*) pData->httpheadervalue, &pData->headerBuf)); diff -Nru rsyslog-8.2001.0/debian/changelog rsyslog-8.2006.0/debian/changelog --- rsyslog-8.2001.0/debian/changelog 2020-06-24 06:14:32.000000000 +0000 +++ rsyslog-8.2006.0/debian/changelog 2020-06-30 17:23:05.000000000 +0000 @@ -1,13 +1,101 @@ -rsyslog (8.2001.0-1ubuntu2) groovy; urgency=medium +rsyslog (8.2006.0-2ubuntu2) groovy; urgency=medium - * Make /var/log/dmesg not be world readable (LP: #XXXXXXX) + * Make /var/log/dmesg not be world readable (LP: #1884887) - debian/dmesg.service: + add additional ExecStartPost to set permissions so that only - root and group amd can read /var/log/dmesg + root and group adm can read /var/log/dmesg + modify savelog invocation to also adjust permissions on rotated dmesg logs to match. - -- Steve Beattie Tue, 23 Jun 2020 23:14:32 -0700 + -- Steve Beattie Tue, 30 Jun 2020 10:23:05 -0700 + +rsyslog (8.2006.0-2ubuntu1) groovy; urgency=medium + + [ Christian Ehrhardt ] + * Merge with Debian unstable (LP: #1885125). Remaining changes: + - debian/00rsyslog.conf Install tmpfiles.d snippet to ensure that the + syslog group can write into /var/log/. + - debian/50-default.conf: set of default rules for syslog + + debian/50-default.conf: separated default rules + + d/rsyslog.install: install default rules + + d/rsyslog.postrm: clear default rules on purge + + d/rsyslog.postrm: remove conf file in postrm on purge. manage with ucf + + d/rsyslog.postinst: Adapt script to use ucf for Ubuntu's config files + + debian/control: Add Depends for ucf + - debian/rsyslog.conf: + + enable $RepeatedMsgReduction to avoid bloating the syslog file. + + enable $KLogPermitNonKernelFacility for non-kernel klog messages + + Run as rsyslog:rsyslog, set $FileOwner to syslog + + Remove rules moved to 50-default.conf + - Add disabled by default AppArmor profile, debian/usr.sbin.rsyslogd + + d/rsyslog.install: install apparmor rule + + d/rules: use dh_apparmor to install profile before rsyslog is started + + d/control: suggests apparmor (>= 2.3) + + d/contrl: Build-Depends on dh-apparmor + + debian/rsyslog.dirs: install /etc/apparmor.d/force-complain, + /etc/apparmor.d/disable and /etc/apparmor.d/local + + d/usr.sbin.rsyslogd apparmor profile for rsyslogd + + debian/rsyslog.preinst: disable profile on clean installs. + - d/rules: Fix LDFLAGS to avoid segfault on receipt of first message + - Drop mmnormalize module, which depends on liblognorm from universe. + + d/rules: drop --enable-mmnormalize + + d/control: drop build dependency on liblognorm-dev + - run as user syslog + + d/rsyslog.postinst: fix ownership of /var/spool/rsyslog. + + d/rsyslog.postinst: Create syslog user and add it to adm group + + d/rsyslog.postinst: Adapt privileges for /var/log + + debian/control: Add Depends for adduser + - debian/dmesg.service: provide /var/log/dmesg.log as non log-rotated + log for boot-time kernel messages. + - debian/clean: Delete some files left over by the test suite + * Added changes + - d/p/Increase-timeouts-in-imfile-basic-2GB-file-and-imfile-tru.patch: bump + even further for riscv64 to avoid FTBFS + + [ Simon Deziel ] + * d/usr.sbin.rsyslogd: apparmor: use preferred "profile " syntax. + + -- Christian Ehrhardt Thu, 25 Jun 2020 14:54:01 +0200 + +rsyslog (8.2006.0-2) unstable; urgency=medium + + * Revert upstream changes which caused /dev/log from journald being + overwritten (Closes: #963715) + + -- Michael Biebl Sat, 27 Jun 2020 13:29:13 +0200 + +rsyslog (8.2006.0-1) unstable; urgency=medium + + * New upstream version 8.2006.0 + * Bump debhelper-compat to 13 + + -- Michael Biebl Wed, 24 Jun 2020 12:54:55 +0200 + +rsyslog (8.2004.0-1) unstable; urgency=medium + + * New upstream version 8.2004.0 + + -- Michael Biebl Tue, 28 Apr 2020 18:28:36 +0200 + +rsyslog (8.2002.0-2) unstable; urgency=medium + + * Increase timeouts in imfile-basic-2GB-file and imfile-truncate-2GB-file. + Those tests can take a long time, especially on slow architectures like + armhf, so bump the test timeouts considerably. + + -- Michael Biebl Fri, 28 Feb 2020 01:05:57 +0100 + +rsyslog (8.2002.0-1) unstable; urgency=medium + + * New upstream version 8.2002.0 + * Rebase patches + * Use ip instead of deprecated ifconfig when running the test suite. + * Add Build-Depends on curl. + This is required to run the test allowed-sender-tcp-hostname-fail. + * Enable extended test bench + * Bump Standards-Version to 4.5.0 + + -- Michael Biebl Wed, 26 Feb 2020 17:10:44 +0100 rsyslog (8.2001.0-1ubuntu1) focal; urgency=medium diff -Nru rsyslog-8.2001.0/debian/control rsyslog-8.2006.0/debian/control --- rsyslog-8.2001.0/debian/control 2020-02-11 15:25:29.000000000 +0000 +++ rsyslog-8.2006.0/debian/control 2020-06-25 12:54:01.000000000 +0000 @@ -3,7 +3,7 @@ Priority: important Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Michael Biebl -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper-compat (= 13), dh-exec, dh-apparmor, autoconf-archive, @@ -32,8 +32,9 @@ systemd [linux-any] , lsof [linux-any] , logrotate , - net-tools , -Standards-Version: 4.4.1 + iproute2 , + curl , +Standards-Version: 4.5.0 Rules-Requires-Root: no Vcs-Git: https://salsa.debian.org/debian/rsyslog.git Vcs-Browser: https://salsa.debian.org/debian/rsyslog diff -Nru rsyslog-8.2001.0/debian/patches/Add-missing-test-files.patch rsyslog-8.2006.0/debian/patches/Add-missing-test-files.patch --- rsyslog-8.2001.0/debian/patches/Add-missing-test-files.patch 2020-02-11 15:20:30.000000000 +0000 +++ rsyslog-8.2006.0/debian/patches/Add-missing-test-files.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -From: Michael Biebl -Date: Wed, 22 Jan 2020 15:37:38 +0100 -Subject: Add missing test files - -See https://github.com/rsyslog/rsyslog/issues/4146 ---- - tests/imfile-escapelf.replacement-empty.sh | 30 ++++++++++++++++++++++++++++++ - tests/imfile-escapelf.replacement.sh | 30 ++++++++++++++++++++++++++++++ - 2 files changed, 60 insertions(+) - create mode 100755 tests/imfile-escapelf.replacement-empty.sh - create mode 100755 tests/imfile-escapelf.replacement.sh - -diff --git a/tests/imfile-escapelf.replacement-empty.sh b/tests/imfile-escapelf.replacement-empty.sh -new file mode 100755 -index 0000000..759c8a9 ---- /dev/null -+++ b/tests/imfile-escapelf.replacement-empty.sh -@@ -0,0 +1,30 @@ -+#!/bin/bash -+# Written in 2019 by Rainer Gerhards -+# This is part of the rsyslog testbench, licensed under ASL 2.0 -+export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines -+. ${srcdir:=.}/diag.sh init -+generate_conf -+add_conf ' -+global(workDirectory="'${RSYSLOG_DYNNAME}'.spool") -+module(load="../plugins/imfile/.libs/imfile") -+input(type="imfile" ruleset="output" escapelf.replacement="" -+ File="./'$RSYSLOG_DYNNAME'.input" tag="file:" startmsg.regex="^msg") -+ -+template(name="outfmt" type="string" string="%msg%\n") -+ruleset(name="output") { -+ action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") -+} -+' -+# make sure file exists when rsyslog starts up -+echo 'msg 1 part 1 -+ msg 1 part 2 -+msg 2 -+msg INVISIBLE by design' > $RSYSLOG_DYNNAME.input -+startup -+export NUMMESSAGES=2 -+shutdown_when_empty -+wait_shutdown -+export EXPECTED='msg 1 part 1 msg 1 part 2 -+msg 2' -+cmp_exact -+exit_test -diff --git a/tests/imfile-escapelf.replacement.sh b/tests/imfile-escapelf.replacement.sh -new file mode 100755 -index 0000000..6039947 ---- /dev/null -+++ b/tests/imfile-escapelf.replacement.sh -@@ -0,0 +1,30 @@ -+#!/bin/bash -+# Written in 2019 by Rainer Gerhards -+# This is part of the rsyslog testbench, licensed under ASL 2.0 -+export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines -+. ${srcdir:=.}/diag.sh init -+generate_conf -+add_conf ' -+global(workDirectory="'${RSYSLOG_DYNNAME}'.spool") -+module(load="../plugins/imfile/.libs/imfile") -+input(type="imfile" ruleset="output" escapelf.replacement="[LF]" -+ File="./'$RSYSLOG_DYNNAME'.input" tag="file:" startmsg.regex="^msg") -+ -+template(name="outfmt" type="string" string="%msg%\n") -+ruleset(name="output") { -+ action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") -+} -+' -+# make sure file exists when rsyslog starts up -+echo 'msg 1 part 1 -+ msg 1 part 2 -+msg 2 -+msg INVISIBLE by design' > $RSYSLOG_DYNNAME.input -+startup -+export NUMMESSAGES=2 -+shutdown_when_empty -+wait_shutdown -+export EXPECTED='msg 1 part 1[LF] msg 1 part 2 -+msg 2' -+cmp_exact -+exit_test diff -Nru rsyslog-8.2001.0/debian/patches/Fixed-saving-of-old-file_id-for-statefiles.patch rsyslog-8.2006.0/debian/patches/Fixed-saving-of-old-file_id-for-statefiles.patch --- rsyslog-8.2001.0/debian/patches/Fixed-saving-of-old-file_id-for-statefiles.patch 2020-02-11 15:20:30.000000000 +0000 +++ rsyslog-8.2006.0/debian/patches/Fixed-saving-of-old-file_id-for-statefiles.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -From: Jiri Vymazal -Date: Tue, 21 Jan 2020 13:58:14 +0100 -Subject: Fixed saving of old file_id for statefiles - -Previously we saved old file_id unconditionally, which led to not -deleting old statefiles if files changes without rsyslog running. -Now it should work correctly. - -(cherry picked from commit 2ff1e7a73d727b457e6f91698b50d97502e2e66d) ---- - plugins/imfile/imfile.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c -index 908bb59..8eb6763 100644 ---- a/plugins/imfile/imfile.c -+++ b/plugins/imfile/imfile.c -@@ -1258,8 +1258,8 @@ get_file_id_hash(const char *data, size_t lendata, - static void ATTR_NONNULL(1) - getFileID(act_obj_t *const act) - { -- /* save the old id for cleaning purposes */ -- strncpy(act->file_id_prev, (const char*)act->file_id, FILE_ID_HASH_SIZE); -+ char tmp_id[FILE_ID_HASH_SIZE]; -+ strncpy(tmp_id, (const char*)act->file_id, FILE_ID_HASH_SIZE); - act->file_id[0] = '\0'; - assert(act->fd >= 0); /* fd must have been opened at act_obj_t creation! */ - char filedata[FILE_ID_SIZE]; -@@ -1270,6 +1270,9 @@ getFileID(act_obj_t *const act) - } else { - DBGPRINTF("getFileID partial or error read, ret %d\n", r); - } -+ if (strncmp(tmp_id, act->file_id, FILE_ID_HASH_SIZE)) {/* save the old id for cleaning purposes */ -+ strncpy(act->file_id_prev, tmp_id, FILE_ID_HASH_SIZE); -+ } - DBGPRINTF("getFileID for '%s', file_id_hash '%s'\n", act->name, act->file_id); - } - diff -Nru rsyslog-8.2001.0/debian/patches/imfile-bugfix-misadressing-and-potential-segfault.patch rsyslog-8.2006.0/debian/patches/imfile-bugfix-misadressing-and-potential-segfault.patch --- rsyslog-8.2001.0/debian/patches/imfile-bugfix-misadressing-and-potential-segfault.patch 2020-02-11 15:20:30.000000000 +0000 +++ rsyslog-8.2006.0/debian/patches/imfile-bugfix-misadressing-and-potential-segfault.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -From: Rainer Gerhards -Date: Tue, 21 Jan 2020 17:57:42 +0100 -Subject: imfile bugfix: misadressing and potential segfault - -Commit 3f72e8c introduced an invalid memory allocation size. This lead to -too-short alloc and thus to overwrite of non-owned memory. That in turn -could lead to segfaults or other hard to find problems. - -The issue was detected by our upgraded CI system. We did not receive -any problem reports in practice. Nevertheless, the problem is real and -people should update affected versions to patched ones. - -The bug was present in scheduled stable release 8.1911.0 and 8.2001.0. - -see also: https://github.com/rsyslog/rsyslog/issues/4120 -see also: https://github.com/rsyslog/rsyslog/pull/4141 - -(cherry picked from commit aa809b61dcadcb41c18a13e79276849ae75d6780) ---- - plugins/imfile/imfile.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c -index 8eb6763..3084a82 100644 ---- a/plugins/imfile/imfile.c -+++ b/plugins/imfile/imfile.c -@@ -1144,7 +1144,8 @@ fs_node_add(fs_node_t *const node, - if(!ustrcmp(chld->name, name)) { - DBGPRINTF("fs_node_add(%p, '%s') found '%s'\n", chld->node, toFind, name); - /* add new instance */ -- instanceConf_t **instarr_new = realloc(chld->instarr, sizeof(instanceConf_t*) * chld->ninst+1); -+ instanceConf_t **instarr_new = realloc(chld->instarr, -+ sizeof(instanceConf_t*) * (chld->ninst+1)); - CHKmalloc(instarr_new); - chld->instarr = instarr_new; - chld->ninst++; diff -Nru rsyslog-8.2001.0/debian/patches/Increase-timeouts-in-imfile-basic-2GB-file-and-imfile-tru.patch rsyslog-8.2006.0/debian/patches/Increase-timeouts-in-imfile-basic-2GB-file-and-imfile-tru.patch --- rsyslog-8.2001.0/debian/patches/Increase-timeouts-in-imfile-basic-2GB-file-and-imfile-tru.patch 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/debian/patches/Increase-timeouts-in-imfile-basic-2GB-file-and-imfile-tru.patch 2020-06-25 12:54:01.000000000 +0000 @@ -0,0 +1,56 @@ +From: Michael Biebl +Date: Fri, 28 Feb 2020 00:56:33 +0100 +Subject: Increase timeouts in imfile-basic-2GB-file and + imfile-truncate-2GB-file + +Those tests can take a long time, especially on slow architectures like +armhf, so bump the test timeouts considerably. +--- + tests/imfile-basic-2GB-file.sh | 4 ++-- + tests/imfile-truncate-2GB-file.sh | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/imfile-basic-2GB-file.sh b/tests/imfile-basic-2GB-file.sh +index 930302d..d6b40d1 100755 +--- a/tests/imfile-basic-2GB-file.sh ++++ b/tests/imfile-basic-2GB-file.sh +@@ -5,7 +5,7 @@ + # adds a couple of messages to get it over 2GiB. + # This is part of the rsyslog testbench, licensed under ASL 2.0 + . ${srcdir:=.}/diag.sh init +-export TB_TEST_MAX_RUNTIME=1200 # test is very slow as it works on large files ++export TB_TEST_MAX_RUNTIME=8000 # test is very slow as it works on large files + generate_conf + add_conf ' + module(load="../plugins/imfile/.libs/imfile") +@@ -22,7 +22,7 @@ startup + ls -lh $RSYSLOG_DYNNAME.input + export NUMMESSAGES="$(cat $RSYSLOG_DYNNAME.msgcnt)" + +-wait_file_lines --delay 2500 --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES 1000 ++wait_file_lines --delay 2500 --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES 6000 + + # add one message --> exactly 2GB + ./inputfilegen -m1 -d47 -i$NUMMESSAGES>> $RSYSLOG_DYNNAME.input +diff --git a/tests/imfile-truncate-2GB-file.sh b/tests/imfile-truncate-2GB-file.sh +index ce94cc7..67c9ac1 100755 +--- a/tests/imfile-truncate-2GB-file.sh ++++ b/tests/imfile-truncate-2GB-file.sh +@@ -5,7 +5,7 @@ + # adds a couple of messages to get it over 2GiB. + # This is part of the rsyslog testbench, licensed under ASL 2.0 + . ${srcdir:=.}/diag.sh init +-export TB_TEST_MAX_RUNTIME=1200 # test is very slow as it works on large files ++export TB_TEST_MAX_RUNTIME=8000 # test is very slow as it works on large files + generate_conf + add_conf ' + module(load="../plugins/imfile/.libs/imfile") +@@ -22,7 +22,7 @@ startup + ls -lh $RSYSLOG_DYNNAME.input + export NUMMESSAGES="$(cat $RSYSLOG_DYNNAME.msgcnt)" + +-wait_file_lines --delay 2500 --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES 1000 ++wait_file_lines --delay 2500 --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES 6000 + + # add one message --> exactly 2GB + ./inputfilegen -m1 -d47 -i$NUMMESSAGES>> $RSYSLOG_DYNNAME.input diff -Nru rsyslog-8.2001.0/debian/patches/Revert-change-systemd-service-file-to-wait-for-network.patch rsyslog-8.2006.0/debian/patches/Revert-change-systemd-service-file-to-wait-for-network.patch --- rsyslog-8.2001.0/debian/patches/Revert-change-systemd-service-file-to-wait-for-network.patch 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/debian/patches/Revert-change-systemd-service-file-to-wait-for-network.patch 2020-06-25 12:54:01.000000000 +0000 @@ -0,0 +1,43 @@ +From: Michael Biebl +Date: Sat, 27 Jun 2020 12:17:31 +0200 +Subject: Revert "change systemd service file to wait for network" + +The default rsyslog configuration in Debian uses imuxsock which relies +on ForwardToSyslog to work properly. This commit broke that resulting in +syslog.service and syslog.socket no longer being started correctly and +rsyslog taking over /dev/log from journald. + +As for the remaining bits: +We don't enable remote syslog by default, so we don't need/want to +wait for network-online.target during boot. + +This reverts commit 7a671da74f78047b3fd0eb65203f045de28cec0f. + +Closes: #963715 +--- + rsyslog.service.in | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/rsyslog.service.in b/rsyslog.service.in +index 839765d..b761ae5 100644 +--- a/rsyslog.service.in ++++ b/rsyslog.service.in +@@ -1,10 +1,8 @@ + [Unit] + Description=System Logging Service +-;Requires=syslog.socket +-Wants=network.target network-online.target +-After=network.target network-online.target ++Requires=syslog.socket + Documentation=man:rsyslogd(8) +-Documentation=http://www.rsyslog.com/doc/ ++Documentation=https://www.rsyslog.com/doc/ + + [Service] + Type=notify +@@ -18,4 +16,4 @@ LimitNOFILE=16384 + + [Install] + WantedBy=multi-user.target +-;Alias=syslog.service ++Alias=syslog.service diff -Nru rsyslog-8.2001.0/debian/patches/series rsyslog-8.2006.0/debian/patches/series --- rsyslog-8.2001.0/debian/patches/series 2020-02-11 15:20:30.000000000 +0000 +++ rsyslog-8.2006.0/debian/patches/series 2020-06-25 12:54:01.000000000 +0000 @@ -1,4 +1,3 @@ Don-t-create-a-database.patch -Fixed-saving-of-old-file_id-for-statefiles.patch -imfile-bugfix-misadressing-and-potential-segfault.patch -Add-missing-test-files.patch +Increase-timeouts-in-imfile-basic-2GB-file-and-imfile-tru.patch +Revert-change-systemd-service-file-to-wait-for-network.patch diff -Nru rsyslog-8.2001.0/debian/rules rsyslog-8.2006.0/debian/rules --- rsyslog-8.2001.0/debian/rules 2020-02-11 15:23:13.000000000 +0000 +++ rsyslog-8.2006.0/debian/rules 2020-06-25 12:54:01.000000000 +0000 @@ -59,6 +59,7 @@ --enable-fmhash \ --disable-libgcrypt \ --enable-testbench \ + --enable-extended-tests \ --enable-imdiag \ --disable-generate-man-pages \ --disable-fmhttp \ diff -Nru rsyslog-8.2001.0/debian/usr.sbin.rsyslogd rsyslog-8.2006.0/debian/usr.sbin.rsyslogd --- rsyslog-8.2001.0/debian/usr.sbin.rsyslogd 2020-02-11 15:25:29.000000000 +0000 +++ rsyslog-8.2006.0/debian/usr.sbin.rsyslogd 2020-06-25 12:54:01.000000000 +0000 @@ -6,7 +6,7 @@ # following: # watch -n 1 'dmesg | tail -5' -/usr/sbin/rsyslogd { +profile rsyslogd /usr/sbin/rsyslogd { #include #include diff -Nru rsyslog-8.2001.0/grammar/lexer.c rsyslog-8.2006.0/grammar/lexer.c --- rsyslog-8.2001.0/grammar/lexer.c 2020-01-13 07:37:14.000000000 +0000 +++ rsyslog-8.2006.0/grammar/lexer.c 2020-06-22 12:59:26.000000000 +0000 @@ -1924,7 +1924,14 @@ estr = expand_backticks_echo(param); } else if(strncmp(param, "cat ", sizeof("cat ")-1) == 0) { const char *val = read_file(param+4); - estr = es_newStrFromCStr(val, strlen(val)); + if(val == NULL) { + parser_errmsg("file could not be accessed for `%s`", param); + const char *errmsg = "/* file cound not be accessed - see" + "error messages */"; + estr = es_newStrFromCStr(errmsg, strlen(errmsg)); + } else { + estr = es_newStrFromCStr(val, strlen(val)); + } free((void*) val); } else { parser_errmsg("invalid backtick parameter `%s` - replaced by " @@ -1934,8 +1941,8 @@ return estr; } -#line 1938 "lexer.c" -#line 165 "lexer.l" +#line 1945 "lexer.c" +#line 172 "lexer.l" /*%option noyywrap nodefault case-insensitive */ /* avoid compiler warning: `yyunput' defined but not used */ #define YY_NO_INPUT 1 @@ -1999,8 +2006,8 @@ #endif -#line 2003 "lexer.c" -#line 2004 "lexer.c" +#line 2010 "lexer.c" +#line 2011 "lexer.c" #define INITIAL 0 #define INOBJ 1 @@ -2225,12 +2232,12 @@ } { -#line 233 "lexer.l" +#line 240 "lexer.l" -#line 236 "lexer.l" +#line 243 "lexer.l" /* keywords */ -#line 2234 "lexer.c" +#line 2241 "lexer.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -2300,28 +2307,28 @@ case 1: YY_RULE_SETUP -#line 237 "lexer.l" +#line 244 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return IF; } YY_BREAK case 2: YY_RULE_SETUP -#line 238 "lexer.l" +#line 245 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return FOREACH; } YY_BREAK case 3: YY_RULE_SETUP -#line 239 "lexer.l" +#line 246 "lexer.l" { cnfPrintToken(yytext); BEGIN IN_PROCEDURE_CALL; return RELOAD_LOOKUP_TABLE_PROCEDURE; } YY_BREAK case 4: YY_RULE_SETUP -#line 240 "lexer.l" +#line 247 "lexer.l" { cnfPrintToken(yytext); return yytext[0]; } YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP -#line 241 "lexer.l" +#line 248 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2331,7 +2338,7 @@ case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 246 "lexer.l" +#line 253 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2340,162 +2347,162 @@ YY_BREAK case 7: YY_RULE_SETUP -#line 251 "lexer.l" +#line 258 "lexer.l" { cnfPrintToken(yytext); return yytext[0]; } YY_BREAK case 8: YY_RULE_SETUP -#line 252 "lexer.l" +#line 259 "lexer.l" { cnfPrintToken(yytext); BEGIN INITIAL; return yytext[0]; } YY_BREAK case 9: /* rule 9 can match eol */ YY_RULE_SETUP -#line 253 "lexer.l" +#line 260 "lexer.l" {cnfPrintToken(yytext); } YY_BREAK case 10: YY_RULE_SETUP -#line 254 "lexer.l" +#line 261 "lexer.l" { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' in expression " "- is there an invalid escape sequence somewhere?", yytext); } YY_BREAK case 11: YY_RULE_SETUP -#line 257 "lexer.l" +#line 264 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return yytext[0]; } YY_BREAK case 12: YY_RULE_SETUP -#line 258 "lexer.l" +#line 265 "lexer.l" { cnfPrintToken(yytext); BEGIN INITIAL; return THEN; } YY_BREAK case 13: YY_RULE_SETUP -#line 259 "lexer.l" +#line 266 "lexer.l" { cnfPrintToken(yytext); BEGIN INITIAL; return DO; } YY_BREAK case 14: YY_RULE_SETUP -#line 260 "lexer.l" +#line 267 "lexer.l" { cnfPrintToken(yytext); BEGIN INITIAL; return ';'; } YY_BREAK case 15: YY_RULE_SETUP -#line 261 "lexer.l" +#line 268 "lexer.l" { cnfPrintToken(yytext); return OR; } YY_BREAK case 16: YY_RULE_SETUP -#line 262 "lexer.l" +#line 269 "lexer.l" { cnfPrintToken(yytext); return AND; } YY_BREAK case 17: YY_RULE_SETUP -#line 263 "lexer.l" +#line 270 "lexer.l" { cnfPrintToken(yytext); return NOT; } YY_BREAK case 18: -#line 265 "lexer.l" +#line 272 "lexer.l" case 19: -#line 266 "lexer.l" +#line 273 "lexer.l" case 20: -#line 267 "lexer.l" +#line 274 "lexer.l" case 21: -#line 268 "lexer.l" +#line 275 "lexer.l" case 22: -#line 269 "lexer.l" +#line 276 "lexer.l" case 23: -#line 270 "lexer.l" +#line 277 "lexer.l" case 24: -#line 271 "lexer.l" +#line 278 "lexer.l" case 25: -#line 272 "lexer.l" +#line 279 "lexer.l" case 26: -#line 273 "lexer.l" +#line 280 "lexer.l" case 27: -#line 274 "lexer.l" +#line 281 "lexer.l" case 28: YY_RULE_SETUP -#line 274 "lexer.l" +#line 281 "lexer.l" { cnfPrintToken(yytext); return yytext[0]; } YY_BREAK case 29: YY_RULE_SETUP -#line 275 "lexer.l" +#line 282 "lexer.l" { cnfPrintToken(yytext); return CMP_EQ; } YY_BREAK case 30: YY_RULE_SETUP -#line 276 "lexer.l" +#line 283 "lexer.l" { cnfPrintToken(yytext); return CMP_LE; } YY_BREAK case 31: YY_RULE_SETUP -#line 277 "lexer.l" +#line 284 "lexer.l" { cnfPrintToken(yytext); return CMP_GE; } YY_BREAK case 32: -#line 279 "lexer.l" +#line 286 "lexer.l" case 33: YY_RULE_SETUP -#line 279 "lexer.l" +#line 286 "lexer.l" { cnfPrintToken(yytext); return CMP_NE; } YY_BREAK case 34: YY_RULE_SETUP -#line 280 "lexer.l" +#line 287 "lexer.l" { cnfPrintToken(yytext); return CMP_LT; } YY_BREAK case 35: YY_RULE_SETUP -#line 281 "lexer.l" +#line 288 "lexer.l" { cnfPrintToken(yytext); return CMP_GT; } YY_BREAK case 36: YY_RULE_SETUP -#line 282 "lexer.l" +#line 289 "lexer.l" { cnfPrintToken(yytext); return CMP_CONTAINS; } YY_BREAK case 37: YY_RULE_SETUP -#line 283 "lexer.l" +#line 290 "lexer.l" { cnfPrintToken(yytext); return ITERATOR_ASSIGNMENT; } YY_BREAK case 38: YY_RULE_SETUP -#line 284 "lexer.l" +#line 291 "lexer.l" { cnfPrintToken(yytext); return CMP_CONTAINSI; } YY_BREAK case 39: YY_RULE_SETUP -#line 285 "lexer.l" +#line 292 "lexer.l" { cnfPrintToken(yytext); return CMP_STARTSWITH; } YY_BREAK case 40: YY_RULE_SETUP -#line 286 "lexer.l" +#line 293 "lexer.l" { cnfPrintToken(yytext); return CMP_STARTSWITHI; } YY_BREAK case 41: -#line 288 "lexer.l" +#line 295 "lexer.l" case 42: -#line 289 "lexer.l" +#line 296 "lexer.l" case 43: YY_RULE_SETUP -#line 289 "lexer.l" +#line 296 "lexer.l" { cnfPrintToken(yytext); yylval.n = strtoll(yytext, NULL, 0); return NUMBER; } YY_BREAK case 44: YY_RULE_SETUP -#line 290 "lexer.l" +#line 297 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(yytext+1); return VAR; } YY_BREAK case 45: /* rule 45 can match eol */ YY_RULE_SETUP -#line 291 "lexer.l" +#line 298 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2505,7 +2512,7 @@ case 46: /* rule 46 can match eol */ YY_RULE_SETUP -#line 296 "lexer.l" +#line 303 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2515,7 +2522,7 @@ case 47: /* rule 47 can match eol */ YY_RULE_SETUP -#line 301 "lexer.l" +#line 308 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2525,7 +2532,7 @@ case 48: /* rule 48 can match eol */ YY_RULE_SETUP -#line 306 "lexer.l" +#line 313 "lexer.l" { cnfPrintToken(yytext); parser_errmsg("$-sign in double quotes must be " "escaped, problem string is: %s", @@ -2534,18 +2541,18 @@ case 49: /* rule 49 can match eol */ YY_RULE_SETUP -#line 310 "lexer.l" +#line 317 "lexer.l" { cnfPrintToken(yytext); } YY_BREAK case 50: YY_RULE_SETUP -#line 311 "lexer.l" +#line 318 "lexer.l" { cnfPrintToken(yytext); yylval.estr = es_newStrFromCStr(yytext, yyleng); return FUNC; } YY_BREAK case 51: YY_RULE_SETUP -#line 313 "lexer.l" +#line 320 "lexer.l" { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' in expression " "- is there an invalid escape sequence somewhere?", yytext); } @@ -2553,76 +2560,76 @@ case 52: /* rule 52 can match eol */ YY_RULE_SETUP -#line 316 "lexer.l" - +#line 323 "lexer.l" +{ cnfPrintToken(yytext); } YY_BREAK case 53: YY_RULE_SETUP -#line 317 "lexer.l" +#line 324 "lexer.l" { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' in 'call' statement" "- is there an invalid escape sequence somewhere?", yytext); } YY_BREAK case 54: YY_RULE_SETUP -#line 320 "lexer.l" +#line 327 "lexer.l" { cnfPrintToken(yytext); yylval.estr = es_newStrFromCStr(yytext, yyleng); BEGIN INITIAL; return NAME; } YY_BREAK case 55: YY_RULE_SETUP -#line 323 "lexer.l" +#line 330 "lexer.l" { cnfPrintToken(yytext); return '&'; } YY_BREAK case 56: YY_RULE_SETUP -#line 324 "lexer.l" +#line 331 "lexer.l" { cnfPrintToken(yytext); return '{'; } YY_BREAK case 57: YY_RULE_SETUP -#line 325 "lexer.l" +#line 332 "lexer.l" { cnfPrintToken(yytext); return '}'; } YY_BREAK case 58: YY_RULE_SETUP -#line 326 "lexer.l" +#line 333 "lexer.l" { cnfPrintToken(yytext); return STOP; } YY_BREAK case 59: YY_RULE_SETUP -#line 327 "lexer.l" +#line 334 "lexer.l" { cnfPrintToken(yytext); return ELSE; } YY_BREAK case 60: YY_RULE_SETUP -#line 328 "lexer.l" +#line 335 "lexer.l" { cnfPrintToken(yytext); BEGIN INCALL; return CALL; } YY_BREAK case 61: YY_RULE_SETUP -#line 329 "lexer.l" +#line 336 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return CALL_INDIRECT; } YY_BREAK case 62: YY_RULE_SETUP -#line 330 "lexer.l" +#line 337 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return SET; } YY_BREAK case 63: YY_RULE_SETUP -#line 331 "lexer.l" +#line 338 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return RESET; } YY_BREAK case 64: YY_RULE_SETUP -#line 332 "lexer.l" +#line 339 "lexer.l" { cnfPrintToken(yytext); BEGIN EXPR; return UNSET; } YY_BREAK case 65: YY_RULE_SETUP -#line 333 "lexer.l" +#line 340 "lexer.l" { cnfPrintToken(yytext); return CONTINUE; } YY_BREAK /* line number support because the "preprocessor" combines lines and so needs @@ -2630,23 +2637,23 @@ */ case 66: YY_RULE_SETUP -#line 337 "lexer.l" +#line 344 "lexer.l" { cnfPrintToken(yytext); BEGIN LINENO; } YY_BREAK case 67: YY_RULE_SETUP -#line 338 "lexer.l" +#line 345 "lexer.l" { cnfPrintToken(yytext); yylineno = atoi(yytext) - 1; } YY_BREAK case 68: YY_RULE_SETUP -#line 339 "lexer.l" +#line 346 "lexer.l" { cnfPrintToken(yytext); BEGIN INITIAL; } YY_BREAK case 69: /* rule 69 can match eol */ YY_RULE_SETUP -#line 340 "lexer.l" +#line 347 "lexer.l" YY_BREAK /* $IncludeConfig must be detected as part of CFSYSLINE, because this is @@ -2655,12 +2662,12 @@ case 70: /* rule 70 can match eol */ YY_RULE_SETUP -#line 344 "lexer.l" +#line 351 "lexer.l" YY_BREAK case 71: YY_RULE_SETUP -#line 345 "lexer.l" +#line 352 "lexer.l" { cnfPrintToken(yytext); if(cnfDoInclude(yytext, 0) != 0) yyterminate(); BEGIN INITIAL; } @@ -2668,103 +2675,103 @@ case 72: /* rule 72 can match eol */ YY_RULE_SETUP -#line 348 "lexer.l" +#line 355 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_MAINQ; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 73: /* rule 73 can match eol */ YY_RULE_SETUP -#line 350 "lexer.l" +#line 357 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_TIMEZONE; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 74: /* rule 74 can match eol */ YY_RULE_SETUP -#line 352 "lexer.l" +#line 359 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_PARSER; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 75: /* rule 75 can match eol */ YY_RULE_SETUP -#line 354 "lexer.l" +#line 361 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_GLOBAL; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 76: /* rule 76 can match eol */ YY_RULE_SETUP -#line 356 "lexer.l" +#line 363 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_TPL; BEGIN INOBJ; return BEGIN_TPL; } YY_BREAK case 77: /* rule 77 can match eol */ YY_RULE_SETUP -#line 358 "lexer.l" +#line 365 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_RULESET; BEGIN INOBJ; return BEGIN_RULESET; } YY_BREAK case 78: /* rule 78 can match eol */ YY_RULE_SETUP -#line 360 "lexer.l" +#line 367 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_PROPERTY; BEGIN INOBJ; return BEGIN_PROPERTY; } YY_BREAK case 79: /* rule 79 can match eol */ YY_RULE_SETUP -#line 362 "lexer.l" +#line 369 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_CONSTANT; BEGIN INOBJ; return BEGIN_CONSTANT; } YY_BREAK case 80: /* rule 80 can match eol */ YY_RULE_SETUP -#line 364 "lexer.l" +#line 371 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_INPUT; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 81: /* rule 81 can match eol */ YY_RULE_SETUP -#line 366 "lexer.l" +#line 373 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_MODULE; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 82: /* rule 82 can match eol */ YY_RULE_SETUP -#line 368 "lexer.l" +#line 375 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_LOOKUP_TABLE; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 83: /* rule 83 can match eol */ YY_RULE_SETUP -#line 370 "lexer.l" +#line 377 "lexer.l" { cnfPrintToken(yytext); yylval.objType = CNFOBJ_DYN_STATS; BEGIN INOBJ; return BEGINOBJ; } YY_BREAK case 84: /* rule 84 can match eol */ YY_RULE_SETUP -#line 372 "lexer.l" +#line 379 "lexer.l" { cnfPrintToken(yytext); BEGIN INOBJ; return BEGIN_INCLUDE; } YY_BREAK case 85: /* rule 85 can match eol */ YY_RULE_SETUP -#line 373 "lexer.l" +#line 380 "lexer.l" { cnfPrintToken(yytext); BEGIN INOBJ; return BEGIN_ACTION; } YY_BREAK case 86: /* rule 86 can match eol */ YY_RULE_SETUP -#line 374 "lexer.l" +#line 381 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(rmLeadingSpace(yytext)); dbgprintf("lexer: propfilt is '%s'\n", yylval.s); @@ -2773,57 +2780,57 @@ YY_BREAK case 87: YY_RULE_SETUP -#line 379 "lexer.l" +#line 386 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(rmLeadingSpace(yytext)); return PRIFILT; } YY_BREAK case 88: -#line 381 "lexer.l" +#line 388 "lexer.l" case 89: -#line 382 "lexer.l" +#line 389 "lexer.l" case 90: /* rule 90 can match eol */ -#line 383 "lexer.l" +#line 390 "lexer.l" case 91: /* rule 91 can match eol */ -#line 384 "lexer.l" +#line 391 "lexer.l" case 92: /* rule 92 can match eol */ -#line 385 "lexer.l" +#line 392 "lexer.l" case 93: /* rule 93 can match eol */ -#line 386 "lexer.l" +#line 393 "lexer.l" case 94: /* rule 94 can match eol */ YY_RULE_SETUP -#line 386 "lexer.l" +#line 393 "lexer.l" { cnfPrintToken(yytext); yylval.s = yytext; return LEGACY_ACTION; } YY_BREAK case 95: YY_RULE_SETUP -#line 387 "lexer.l" +#line 394 "lexer.l" { cnfPrintToken(yytext); BEGIN INITIAL; return ENDOBJ; } YY_BREAK case 96: YY_RULE_SETUP -#line 388 "lexer.l" +#line 395 "lexer.l" { cnfPrintToken(yytext); yylval.estr = es_newStrFromCStr(yytext, yyleng); return NAME; } YY_BREAK case 97: -#line 391 "lexer.l" +#line 398 "lexer.l" case 98: -#line 392 "lexer.l" +#line 399 "lexer.l" case 99: -#line 393 "lexer.l" +#line 400 "lexer.l" case 100: YY_RULE_SETUP -#line 393 "lexer.l" +#line 400 "lexer.l" { cnfPrintToken(yytext); return(yytext[0]); } YY_BREAK case 101: /* rule 101 can match eol */ YY_RULE_SETUP -#line 394 "lexer.l" +#line 401 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2833,7 +2840,7 @@ case 102: /* rule 102 can match eol */ YY_RULE_SETUP -#line 399 "lexer.l" +#line 406 "lexer.l" { cnfPrintToken(yytext); yytext[yyleng-1] = '\0'; unescapeStr((uchar*)yytext+1, yyleng-2); @@ -2844,28 +2851,28 @@ return VALUE; }*/ case 103: YY_RULE_SETUP -#line 406 "lexer.l" +#line 413 "lexer.l" { cnfPrintToken(yytext); preCommentState = YY_START; BEGIN COMMENT; } YY_BREAK case 104: YY_RULE_SETUP -#line 407 "lexer.l" +#line 414 "lexer.l" { cnfPrintToken(yytext); preCommentState = YY_START; BEGIN COMMENT; } YY_BREAK case 105: YY_RULE_SETUP -#line 408 "lexer.l" +#line 415 "lexer.l" { cnfPrintToken(yytext); preCommentState = YY_START; BEGIN COMMENT; } YY_BREAK case 106: YY_RULE_SETUP -#line 409 "lexer.l" +#line 416 "lexer.l" { cnfPrintToken(yytext); BEGIN preCommentState; } YY_BREAK case 107: /* rule 107 can match eol */ YY_RULE_SETUP -#line 410 "lexer.l" +#line 417 "lexer.l" YY_BREAK case 108: @@ -2873,18 +2880,18 @@ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 411 "lexer.l" +#line 418 "lexer.l" /* skip comments in input */ YY_BREAK case 109: /* rule 109 can match eol */ YY_RULE_SETUP -#line 412 "lexer.l" +#line 419 "lexer.l" { cnfPrintToken(yytext); } YY_BREAK case 110: YY_RULE_SETUP -#line 413 "lexer.l" +#line 420 "lexer.l" { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' in object definition " "- is there an invalid escape sequence somewhere?", yytext); } @@ -2894,7 +2901,7 @@ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 416 "lexer.l" +#line 423 "lexer.l" { cnfPrintToken(yytext); /* see comment on $IncludeConfig above */ if(!strncasecmp(yytext, "$includeconfig ", 14)) { yyless((yy_size_t)14); @@ -2912,7 +2919,7 @@ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 427 "lexer.l" +#line 434 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(yytext); return BSD_TAG_SELECTOR; } YY_BREAK case 113: @@ -2922,7 +2929,7 @@ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 428 "lexer.l" +#line 435 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; } YY_BREAK case 114: @@ -2932,7 +2939,7 @@ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 429 "lexer.l" +#line 436 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; } YY_BREAK case 115: @@ -2940,24 +2947,24 @@ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 430 "lexer.l" +#line 437 "lexer.l" { cnfPrintToken(yytext); yylval.s = strdup(yytext); return BSD_HOST_SELECTOR; } YY_BREAK case 116: /* rule 116 can match eol */ YY_RULE_SETUP -#line 431 "lexer.l" +#line 438 "lexer.l" {cnfPrintToken(yytext); }/* skip comments in input */ YY_BREAK case 117: /* rule 117 can match eol */ YY_RULE_SETUP -#line 432 "lexer.l" +#line 439 "lexer.l" {cnfPrintToken(yytext); }/* drop whitespace */ YY_BREAK case 118: YY_RULE_SETUP -#line 433 "lexer.l" +#line 440 "lexer.l" { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' " "- is there an invalid escape sequence somewhere?", yytext); } @@ -2970,15 +2977,15 @@ case YY_STATE_EOF(INCALL): case YY_STATE_EOF(IN_PROCEDURE_CALL): case YY_STATE_EOF(EXPR): -#line 436 "lexer.l" +#line 443 "lexer.l" { if(popfile() != 0) yyterminate(); } YY_BREAK case 119: YY_RULE_SETUP -#line 438 "lexer.l" +#line 445 "lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2982 "lexer.c" +#line 2989 "lexer.c" case YY_END_OF_BUFFER: { @@ -3954,7 +3961,7 @@ #define YYTABLES_NAME "yytables" -#line 438 "lexer.l" +#line 445 "lexer.l" static void cnfPrintToken(const char *token) { diff -Nru rsyslog-8.2001.0/grammar/lexer.l rsyslog-8.2006.0/grammar/lexer.l --- rsyslog-8.2001.0/grammar/lexer.l 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/grammar/lexer.l 2020-06-22 12:57:15.000000000 +0000 @@ -148,7 +148,14 @@ estr = expand_backticks_echo(param); } else if(strncmp(param, "cat ", sizeof("cat ")-1) == 0) { const char *val = read_file(param+4); - estr = es_newStrFromCStr(val, strlen(val)); + if(val == NULL) { + parser_errmsg("file could not be accessed for `%s`", param); + const char *errmsg = "/* file cound not be accessed - see" + "error messages */"; + estr = es_newStrFromCStr(errmsg, strlen(errmsg)); + } else { + estr = es_newStrFromCStr(val, strlen(val)); + } free((void*) val); } else { parser_errmsg("invalid backtick parameter `%s` - replaced by " @@ -312,7 +319,7 @@ . { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' in expression " "- is there an invalid escape sequence somewhere?", yytext); } -[ \t\n] +[ \t\n] { cnfPrintToken(yytext); } . { cnfPrintToken(yytext); parser_errmsg("invalid character '%s' in 'call' statement" "- is there an invalid escape sequence somewhere?", yytext); } diff -Nru rsyslog-8.2001.0/grammar/rainerscript.c rsyslog-8.2006.0/grammar/rainerscript.c --- rsyslog-8.2001.0/grammar/rainerscript.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/grammar/rainerscript.c 2020-06-22 12:57:15.000000000 +0000 @@ -699,6 +699,23 @@ return lst; } +/* check if the nvlst is disabled, and mark config.enabled directive + * as used if it is not. Returns 1 if block is disabled, 0 otherwise. + */ +int nvlstChkDisabled(struct nvlst *lst) +{ + struct nvlst *valnode; + + if((valnode = nvlstFindNameCStr(lst, "config.enabled")) != NULL) { + if(es_strbufcmp(valnode->val.d.estr, (unsigned char*) "on", 2)) { + return 1; + } else { + valnode->bUsed = 1; + } + } + return 0; +} + /* check if there are duplicate names inside a nvlst and emit * an error message, if so. @@ -891,13 +908,27 @@ { char *cstr; int r; - struct group *resultBuf; + struct group *resultBuf = NULL; struct group wrkBuf; - char stringBuf[2048]; /* 2048 has been proven to be large enough */ + char *stringBuf = NULL; + size_t bufSize = 1024; + int e; cstr = es_str2cstr(valnode->val.d.estr, NULL); - const int e = getgrnam_r(cstr, &wrkBuf, stringBuf, - sizeof(stringBuf), &resultBuf); + do { + char *p; + + /* Increase bufsize and try again.*/ + bufSize *= 2; + p = realloc(stringBuf, bufSize); + if(!p) { + e = ENOMEM; + break; + } + stringBuf = p; + e = getgrnam_r(cstr, &wrkBuf, stringBuf, bufSize, &resultBuf); + } while(!resultBuf && (e == ERANGE)); + if(resultBuf == NULL) { if(e != 0) { LogError(e, RS_RET_ERR, "parameter '%s': error to " @@ -913,6 +944,7 @@ param->name, (int) resultBuf->gr_gid, cstr); r = 1; } + free(stringBuf); free(cstr); return r; } @@ -1207,23 +1239,6 @@ } } - /* now config-system parameters (currently a bit hackish, as we - * only have one...). -- rgerhards, 2018-01-24 - */ - if((valnode = nvlstFindNameCStr(lst, "config.enabled")) != NULL) { - if(es_strbufcmp(valnode->val.d.estr, (unsigned char*) "on", 2)) { - dbgprintf("config object disabled by configuration\n"); - /* flag all params as used to not emit error mssages */ - bInError = 1; - struct nvlst *val; - for(val = lst; val != NULL ; val = val->next) { - val->bUsed = 1; - } - } else { - valnode->bUsed = 1; - } - } - /* done parameter processing */ if(bInError) { if(bValsWasNULL) @@ -4418,8 +4433,13 @@ struct cnfstmt* cnfstmt; char namebuf[256]; rsRetVal localRet; - if((cnfstmt = cnfstmtNew(S_ACT)) == NULL) + if((cnfstmt = cnfstmtNew(S_ACT)) == NULL) { goto done; + } + if (nvlstChkDisabled(lst)) { + dbgprintf("action disabled by configuration\n"); + cnfstmt->nodetype = S_NOP; + } localRet = actionNewInst(lst, &cnfstmt->d.act); if(localRet == RS_RET_OK_WARN) { parser_errmsg("warnings occured in file '%s' around line %d", @@ -5284,6 +5304,11 @@ goto done; } + if (nvlstChkDisabled(lst)) { + DBGPRINTF("include statement disabled\n"); + goto done; + } + pvals = nvlstGetParams(lst, &incpblk, NULL); if(pvals == NULL) { goto done; diff -Nru rsyslog-8.2001.0/grammar/rainerscript.h rsyslog-8.2006.0/grammar/rainerscript.h --- rsyslog-8.2001.0/grammar/rainerscript.h 2019-12-27 16:19:58.000000000 +0000 +++ rsyslog-8.2006.0/grammar/rainerscript.h 2020-05-28 10:29:49.000000000 +0000 @@ -340,6 +340,7 @@ void nvlstPrint(struct nvlst *lst); void nvlstChkUnused(struct nvlst *lst); struct nvlst* nvlstFindName(struct nvlst *lst, es_str_t *name); +int nvlstChkDisabled(struct nvlst *lst); struct cnfobj* cnfobjNew(enum cnfobjType objType, struct nvlst *lst); void cnfobjDestruct(struct cnfobj *o); void cnfobjPrint(struct cnfobj *o); diff -Nru rsyslog-8.2001.0/Makefile.am rsyslog-8.2006.0/Makefile.am --- rsyslog-8.2001.0/Makefile.am 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -312,6 +312,11 @@ SUBDIRS += contrib/mmkubernetes endif +# impcap +if ENABLE_IMPCAP +SUBDIRS += contrib/impcap +endif + # imtuxedoulog if ENABLE_IMTUXEDOULOG SUBDIRS += contrib/imtuxedoulog @@ -384,6 +389,9 @@ --enable-pmsnare \ --enable-usertools +else +DISTCHECK_CONFIGURE_FLAGS+= \ + --disable-default-tests endif # if ENABLE_DEFAULT_TESTS if ENABLE_IMPROG @@ -470,6 +478,12 @@ DISTCHECK_CONFIGURE_FLAGS+= --enable-gnutls endif +if ENABLE_GNUTLS_TESTS +DISTCHECK_CONFIGURE_FLAGS+= --enable-gnutls-tests +else +DISTCHECK_CONFIGURE_FLAGS+= --disable-gnutls-tests +endif + if ENABLE_OPENSSL DISTCHECK_CONFIGURE_FLAGS+= --enable-openssl endif @@ -550,6 +564,16 @@ DISTCHECK_CONFIGURE_FLAGS+= --enable-imfile endif +if ENABLE_IMFILE_TESTS +DISTCHECK_CONFIGURE_FLAGS+= --enable-imfile-tests +else +DISTCHECK_CONFIGURE_FLAGS+= --disable-imfile-tests +endif + +if ENABLE_IMPCAP +DISTCHECK_CONFIGURE_FLAGS+= --enable-impcap +endif + if ENABLE_IMDOCKER DISTCHECK_CONFIGURE_FLAGS+= --enable-imdocker endif diff -Nru rsyslog-8.2001.0/Makefile.in rsyslog-8.2006.0/Makefile.in --- rsyslog-8.2001.0/Makefile.in 2020-01-14 12:59:31.000000000 +0000 +++ rsyslog-8.2006.0/Makefile.in 2020-06-22 12:58:09.000000000 +0000 @@ -169,21 +169,24 @@ # mmkubernetes @ENABLE_MMKUBERNETES_TRUE@am__append_67 = contrib/mmkubernetes +# impcap +@ENABLE_IMPCAP_TRUE@am__append_68 = contrib/impcap + # imtuxedoulog -@ENABLE_IMTUXEDOULOG_TRUE@am__append_68 = contrib/imtuxedoulog +@ENABLE_IMTUXEDOULOG_TRUE@am__append_69 = contrib/imtuxedoulog # improg -@ENABLE_IMPROG_TRUE@am__append_69 = contrib/improg +@ENABLE_IMPROG_TRUE@am__append_70 = contrib/improg # mmtaghostname -@ENABLE_MMTAGHOSTNAME_TRUE@am__append_70 = contrib/mmtaghostname +@ENABLE_MMTAGHOSTNAME_TRUE@am__append_71 = contrib/mmtaghostname # imdb2diag -@ENABLE_PMDB2DIAG_TRUE@am__append_71 = contrib/pmdb2diag +@ENABLE_PMDB2DIAG_TRUE@am__append_72 = contrib/pmdb2diag # currently not supported in make distcheck: # --enable-pgsql-tests # --enable-extended-tests --> should probably never be enabled due to runtime -@ENABLE_DEFAULT_TESTS_TRUE@am__append_72 = \ +@ENABLE_DEFAULT_TESTS_TRUE@am__append_73 = \ @ENABLE_DEFAULT_TESTS_TRUE@ --enable-diagtools \ @ENABLE_DEFAULT_TESTS_TRUE@ --enable-impstats \ @ENABLE_DEFAULT_TESTS_TRUE@ --enable-imptcp \ @@ -209,55 +212,63 @@ @ENABLE_DEFAULT_TESTS_TRUE@ --enable-pmsnare \ @ENABLE_DEFAULT_TESTS_TRUE@ --enable-usertools -@ENABLE_IMPROG_TRUE@am__append_73 = --enable-improg -@ENABLE_OMPROG_TRUE@am__append_74 = --enable-omprog -@ENABLE_GSSAPI_TRUE@am__append_75 = --enable-gssapi-krb5 -@ENABLE_PMNORMALIZE_TRUE@am__append_76 = --enable-pmnormalize -@ENABLE_MMDBLOOKUP_TRUE@am__append_77 = --enable-mmdblookup -@ENABLE_MMDARWIN_TRUE@am__append_78 = --enable-mmdarwin -@ENABLE_MMNORMALIZE_TRUE@am__append_79 = --enable-mmnormalize -@ENABLE_OMMONGODB_TRUE@am__append_80 = --enable-ommongodb -@ENABLE_OMHIREDIS_TRUE@am__append_81 = --enable-omhiredis -@ENABLE_MMSNMPTRAPD_TRUE@am__append_82 = --enable-mmsnmptrapd -@ENABLE_OMLIBDBI_TRUE@am__append_83 = --enable-libdbi -@ENABLE_LIBGCRYPT_TRUE@am__append_84 = --enable-libgcrypt -@ENABLE_OMHTTP_TRUE@am__append_85 = --enable-omhttp -@ENABLE_OMHTTPFS_TRUE@am__append_86 = --enable-omhttpfs -@ENABLE_OMTCL_TRUE@am__append_87 = --enable-omtcl -@ENABLE_SNMP_TRUE@am__append_88 = --enable-snmp -@ENABLE_SNMP_TESTS_TRUE@am__append_89 = --enable-snmp-tests -@ENABLE_FMHTTP_TRUE@am__append_90 = --enable-fmhttp -@ENABLE_OMUDPSPOOF_TRUE@am__append_91 = --enable-omudpspoof -@ENABLE_PGSQL_TRUE@am__append_92 = --enable-pgsql -@ENABLE_GNUTLS_TRUE@am__append_93 = --enable-gnutls -@ENABLE_OPENSSL_TRUE@am__append_94 = --enable-openssl -@ENABLE_MYSQL_TRUE@am__append_95 = --enable-mysql -@ENABLE_MYSQL_TESTS_TRUE@am__append_96 = --enable-mysql-tests -@ENABLE_ELASTICSEARCH_TRUE@am__append_97 = --enable-elasticsearch -@ENABLE_ELASTICSEARCH_TESTS_TRUE@am__append_98 = --enable-elasticsearch-tests -@ENABLE_CLICKHOUSE_TRUE@am__append_99 = --enable-clickhouse -@ENABLE_CLICKHOUSE_TESTS_TRUE@am__append_100 = --enable-clickhouse-tests -@ENABLE_MMGROK_TRUE@am__append_101 = --enable-mmgrok -@ENABLE_RELP_TRUE@am__append_102 = --enable-relp --enable-omrelp-default-port=13515 -@ENABLE_IMKAFKA_TRUE@am__append_103 = --enable-imkafka -@ENABLE_OMKAFKA_TRUE@am__append_104 = --enable-omkafka -@ENABLE_KAFKA_TESTS_TRUE@am__append_105 = --enable-kafka-tests -@ENABLE_IMJOURNAL_TRUE@am__append_106 = --enable-imjournal -@ENABLE_OMJOURNAL_TRUE@am__append_107 = --enable-omjournal -@ENABLE_JOURNAL_TESTS_TRUE@am__append_108 = --enable-journal-tests -@ENABLE_IMCZMQ_TRUE@am__append_109 = --enable-imczmq -@ENABLE_OMCZMQ_TRUE@am__append_110 = --enable-omczmq -@ENABLE_MMTAGHOSTNAME_TRUE@am__append_111 = --enable-mmtaghostname -@ENABLE_IMTUXEDOULOG_TRUE@am__append_112 = --enable-imtuxedolog -@ENABLE_PMDB2DIAG_TRUE@am__append_113 = --enable-pmdb2diag -@ENABLE_IMBATCHREPORT_TRUE@am__append_114 = --enable-imbatchreport -@ENABLE_IMFILE_TRUE@am__append_115 = --enable-imfile -@ENABLE_IMDOCKER_TRUE@am__append_116 = --enable-imdocker -@ENABLE_OMRABBITMQ_TRUE@am__append_117 = --enable-omrabbitmq -@ENABLE_MMKUBERNETES_TRUE@am__append_118 = --enable-mmkubernetes -@ENABLE_OMAMQP1_TRUE@am__append_119 = --enable-omamqp1 -@ENABLE_DISTCHECK_WORKAROUND_TRUE@am__append_120 = --disable-testbench -@ENABLE_DISTCHECK_WORKAROUND_FALSE@am__append_121 = --enable-testbench +@ENABLE_DEFAULT_TESTS_FALSE@am__append_74 = \ +@ENABLE_DEFAULT_TESTS_FALSE@ --disable-default-tests + +@ENABLE_IMPROG_TRUE@am__append_75 = --enable-improg +@ENABLE_OMPROG_TRUE@am__append_76 = --enable-omprog +@ENABLE_GSSAPI_TRUE@am__append_77 = --enable-gssapi-krb5 +@ENABLE_PMNORMALIZE_TRUE@am__append_78 = --enable-pmnormalize +@ENABLE_MMDBLOOKUP_TRUE@am__append_79 = --enable-mmdblookup +@ENABLE_MMDARWIN_TRUE@am__append_80 = --enable-mmdarwin +@ENABLE_MMNORMALIZE_TRUE@am__append_81 = --enable-mmnormalize +@ENABLE_OMMONGODB_TRUE@am__append_82 = --enable-ommongodb +@ENABLE_OMHIREDIS_TRUE@am__append_83 = --enable-omhiredis +@ENABLE_MMSNMPTRAPD_TRUE@am__append_84 = --enable-mmsnmptrapd +@ENABLE_OMLIBDBI_TRUE@am__append_85 = --enable-libdbi +@ENABLE_LIBGCRYPT_TRUE@am__append_86 = --enable-libgcrypt +@ENABLE_OMHTTP_TRUE@am__append_87 = --enable-omhttp +@ENABLE_OMHTTPFS_TRUE@am__append_88 = --enable-omhttpfs +@ENABLE_OMTCL_TRUE@am__append_89 = --enable-omtcl +@ENABLE_SNMP_TRUE@am__append_90 = --enable-snmp +@ENABLE_SNMP_TESTS_TRUE@am__append_91 = --enable-snmp-tests +@ENABLE_FMHTTP_TRUE@am__append_92 = --enable-fmhttp +@ENABLE_OMUDPSPOOF_TRUE@am__append_93 = --enable-omudpspoof +@ENABLE_PGSQL_TRUE@am__append_94 = --enable-pgsql +@ENABLE_GNUTLS_TRUE@am__append_95 = --enable-gnutls +@ENABLE_GNUTLS_TESTS_TRUE@am__append_96 = --enable-gnutls-tests +@ENABLE_GNUTLS_TESTS_FALSE@am__append_97 = --disable-gnutls-tests +@ENABLE_OPENSSL_TRUE@am__append_98 = --enable-openssl +@ENABLE_MYSQL_TRUE@am__append_99 = --enable-mysql +@ENABLE_MYSQL_TESTS_TRUE@am__append_100 = --enable-mysql-tests +@ENABLE_ELASTICSEARCH_TRUE@am__append_101 = --enable-elasticsearch +@ENABLE_ELASTICSEARCH_TESTS_TRUE@am__append_102 = --enable-elasticsearch-tests +@ENABLE_CLICKHOUSE_TRUE@am__append_103 = --enable-clickhouse +@ENABLE_CLICKHOUSE_TESTS_TRUE@am__append_104 = --enable-clickhouse-tests +@ENABLE_MMGROK_TRUE@am__append_105 = --enable-mmgrok +@ENABLE_RELP_TRUE@am__append_106 = --enable-relp --enable-omrelp-default-port=13515 +@ENABLE_IMKAFKA_TRUE@am__append_107 = --enable-imkafka +@ENABLE_OMKAFKA_TRUE@am__append_108 = --enable-omkafka +@ENABLE_KAFKA_TESTS_TRUE@am__append_109 = --enable-kafka-tests +@ENABLE_IMJOURNAL_TRUE@am__append_110 = --enable-imjournal +@ENABLE_OMJOURNAL_TRUE@am__append_111 = --enable-omjournal +@ENABLE_JOURNAL_TESTS_TRUE@am__append_112 = --enable-journal-tests +@ENABLE_IMCZMQ_TRUE@am__append_113 = --enable-imczmq +@ENABLE_OMCZMQ_TRUE@am__append_114 = --enable-omczmq +@ENABLE_MMTAGHOSTNAME_TRUE@am__append_115 = --enable-mmtaghostname +@ENABLE_IMTUXEDOULOG_TRUE@am__append_116 = --enable-imtuxedolog +@ENABLE_PMDB2DIAG_TRUE@am__append_117 = --enable-pmdb2diag +@ENABLE_IMBATCHREPORT_TRUE@am__append_118 = --enable-imbatchreport +@ENABLE_IMFILE_TRUE@am__append_119 = --enable-imfile +@ENABLE_IMFILE_TESTS_TRUE@am__append_120 = --enable-imfile-tests +@ENABLE_IMFILE_TESTS_FALSE@am__append_121 = --disable-imfile-tests +@ENABLE_IMPCAP_TRUE@am__append_122 = --enable-impcap +@ENABLE_IMDOCKER_TRUE@am__append_123 = --enable-imdocker +@ENABLE_OMRABBITMQ_TRUE@am__append_124 = --enable-omrabbitmq +@ENABLE_MMKUBERNETES_TRUE@am__append_125 = --enable-mmkubernetes +@ENABLE_OMAMQP1_TRUE@am__append_126 = --enable-omamqp1 +@ENABLE_DISTCHECK_WORKAROUND_TRUE@am__append_127 = --disable-testbench +@ENABLE_DISTCHECK_WORKAROUND_FALSE@am__append_128 = --enable-testbench subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_define.m4 \ @@ -388,8 +399,8 @@ contrib/mmdarwin plugins/mmfields plugins/mmpstrucdata \ contrib/mmrfc5424addhmac contrib/omhttpfs contrib/omamqp1 \ contrib/imbatchreport contrib/omtcl contrib/mmkubernetes \ - contrib/imtuxedoulog contrib/improg contrib/mmtaghostname \ - contrib/pmdb2diag tests + contrib/impcap contrib/imtuxedoulog contrib/improg \ + contrib/mmtaghostname contrib/pmdb2diag tests am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \ COPYING COPYING.LESSER ChangeLog INSTALL NEWS README TODO \ compile config.guess config.sub install-sh ltmain.sh missing \ @@ -724,7 +735,8 @@ $(am__append_60) $(am__append_61) $(am__append_62) \ $(am__append_63) $(am__append_64) $(am__append_65) \ $(am__append_66) $(am__append_67) $(am__append_68) \ - $(am__append_69) $(am__append_70) $(am__append_71) tests + $(am__append_69) $(am__append_70) $(am__append_71) \ + $(am__append_72) tests # make sure "make distcheck" tries to build all modules. This means that # a developer must always have an environment where every supporting library # is available. If that is not the case, the respective configure option may @@ -734,23 +746,25 @@ DISTCHECK_CONFIGURE_FLAGS = --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \ --enable-silent-rules --enable-rsyslogd --enable-omstdout \ --enable-imdiag --enable-testbench --enable-valgrind \ - $(am__append_72) $(am__append_73) $(am__append_74) \ - $(am__append_75) $(am__append_76) $(am__append_77) \ - $(am__append_78) $(am__append_79) $(am__append_80) \ - $(am__append_81) $(am__append_82) $(am__append_83) \ - $(am__append_84) $(am__append_85) $(am__append_86) \ - $(am__append_87) $(am__append_88) $(am__append_89) \ - $(am__append_90) $(am__append_91) $(am__append_92) \ - $(am__append_93) $(am__append_94) $(am__append_95) \ - $(am__append_96) $(am__append_97) $(am__append_98) \ - $(am__append_99) $(am__append_100) $(am__append_101) \ - $(am__append_102) $(am__append_103) $(am__append_104) \ - $(am__append_105) $(am__append_106) $(am__append_107) \ - $(am__append_108) $(am__append_109) $(am__append_110) \ - $(am__append_111) $(am__append_112) $(am__append_113) \ - $(am__append_114) $(am__append_115) $(am__append_116) \ - $(am__append_117) $(am__append_118) $(am__append_119) \ - $(am__append_120) $(am__append_121) + $(am__append_73) $(am__append_74) $(am__append_75) \ + $(am__append_76) $(am__append_77) $(am__append_78) \ + $(am__append_79) $(am__append_80) $(am__append_81) \ + $(am__append_82) $(am__append_83) $(am__append_84) \ + $(am__append_85) $(am__append_86) $(am__append_87) \ + $(am__append_88) $(am__append_89) $(am__append_90) \ + $(am__append_91) $(am__append_92) $(am__append_93) \ + $(am__append_94) $(am__append_95) $(am__append_96) \ + $(am__append_97) $(am__append_98) $(am__append_99) \ + $(am__append_100) $(am__append_101) $(am__append_102) \ + $(am__append_103) $(am__append_104) $(am__append_105) \ + $(am__append_106) $(am__append_107) $(am__append_108) \ + $(am__append_109) $(am__append_110) $(am__append_111) \ + $(am__append_112) $(am__append_113) $(am__append_114) \ + $(am__append_115) $(am__append_116) $(am__append_117) \ + $(am__append_118) $(am__append_119) $(am__append_120) \ + $(am__append_121) $(am__append_122) $(am__append_123) \ + $(am__append_124) $(am__append_125) $(am__append_126) \ + $(am__append_127) $(am__append_128) ACLOCAL_AMFLAGS = -I m4 all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff -Nru rsyslog-8.2001.0/plugins/imdiag/imdiag.c rsyslog-8.2006.0/plugins/imdiag/imdiag.c --- rsyslog-8.2001.0/plugins/imdiag/imdiag.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imdiag/imdiag.c 2020-05-28 10:29:49.000000000 +0000 @@ -5,7 +5,7 @@ * * File begun on 2008-07-25 by RGerhards * - * Copyright 2008-2018 Adiscon GmbH. + * Copyright 2008-2020 Adiscon GmbH. * * This file is part of rsyslog. * @@ -82,7 +82,7 @@ static prop_t *pRcvDummy = NULL; static prop_t *pRcvIPDummy = NULL; -static int max_empty_checks = 5; /* how often check for queue empty during shutdown? */ +static int max_empty_checks = 3; /* how often check for queue empty during shutdown? */ statsobj_t *diagStats; STATSCOUNTER_DEF(potentialArtificialDelayMs, mutPotentialArtificialDelayMs) @@ -264,18 +264,18 @@ { uchar wordBuf[1024]; int iFrom, nMsgs; - uchar *litteralMsg; + uchar *literalMsg; int i; ratelimit_t *ratelimit = NULL; DEFiRet; - litteralMsg = NULL; + literalMsg = NULL; memset(wordBuf, 0, sizeof(wordBuf)); CHKiRet(ratelimitNew(&ratelimit, "imdiag", "injectmsg")); /* we do not check errors here! */ getFirstWord(&pszCmd, wordBuf, sizeof(wordBuf), TO_LOWERCASE); - if (ustrcmp(UCHAR_CONSTANT("litteral"), wordBuf) == 0) { + if (ustrcmp(UCHAR_CONSTANT("literal"), wordBuf) == 0) { /* user has provided content for a message */ ++pszCmd; /* ignore following space */ CHKiRet(doInjectMsg(pszCmd, ratelimit)); @@ -295,7 +295,7 @@ finalize_it: if(ratelimit != NULL) ratelimitDestruct(ratelimit); - free(litteralMsg); + free(literalMsg); RETiRet; } @@ -316,6 +316,7 @@ { int iPrint = 0; int nempty = 0; + static unsigned lastOverallQueueSize = 1; DEFiRet; while(1) { @@ -331,7 +332,11 @@ nempty = 0; } if(dbgTimeoutToStderr) { /* we abuse this setting a bit ;-) */ - fprintf(stderr, "imdiag: wait q_empty: qsize %d nempty %d\n", OverallQueueSize, nempty); + if(OverallQueueSize != lastOverallQueueSize) { + fprintf(stderr, "imdiag: wait q_empty: qsize %d nempty %d\n", + OverallQueueSize, nempty); + lastOverallQueueSize = OverallQueueSize; + } } if(nempty > max_empty_checks) break; diff -Nru rsyslog-8.2001.0/plugins/imfile/imfile.c rsyslog-8.2006.0/plugins/imfile/imfile.c --- rsyslog-8.2001.0/plugins/imfile/imfile.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imfile/imfile.c 2020-06-22 12:57:15.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,15 @@ #define GLOB_BRACE 0 #endif +typedef struct per_minute_rate_limit_s per_minute_rate_limit_t; + +struct per_minute_rate_limit_s { + uint64_t maxBytesPerMinute; + uint32_t maxLinesPerMinute; + uint64_t bytesThisMinute; /* bytes sent so far this minute */ + uint32_t linesThisMinute; /* lines sent to far this minute */ + time_t rateLimitingMinute; /* minute we are currently rate limiting for */ +}; static struct configSettings_s { uchar *pszFileName; @@ -116,10 +126,13 @@ uchar *pszBindRuleset; int iPollInterval; int iPersistStateInterval; /* how often if state file to be persisted? (default 0->never) */ + int bPersistStateAfterSubmission;/* persist state file after messages have been submitted */ int iFacility; /* local0 */ int iSeverity; /* notice, as of rfc 3164 */ int readMode; /* mode to use for ReadMultiLine call */ int64 maxLinesAtOnce; /* how many lines to process in a row? */ + uint64_t maxBytesPerMinute; /* maximum bytes per minute to send before rate limiting */ + uint64_t maxLinesPerMinute; /* maximum lines per minute to send before rate limiting */ uint32_t trimLineOverBytes; /* 0: never trim line, positive number: trim line if over bytes */ } cs; @@ -133,7 +146,9 @@ uchar *pszStateFile; uchar *pszBindRuleset; int nMultiSub; + per_minute_rate_limit_t perMinuteRateLimits; int iPersistStateInterval; + int bPersistStateAfterSubmission; int iFacility; int iSeverity; int readTimeout; @@ -318,6 +333,7 @@ { "maxsubmitatonce", eCmdHdlrInt, 0 }, { "removestateondelete", eCmdHdlrBinary, 0 }, { "persiststateinterval", eCmdHdlrInt, 0 }, + { "persiststateaftersubmission", eCmdHdlrBinary, 0 }, { "deletestateonfiledelete", eCmdHdlrBinary, 0 }, { "delay.message", eCmdHdlrPositiveInt, 0 }, { "addmetadata", eCmdHdlrBinary, 0 }, @@ -326,7 +342,9 @@ { "readtimeout", eCmdHdlrPositiveInt, 0 }, { "freshstarttail", eCmdHdlrBinary, 0}, { "filenotfounderror", eCmdHdlrBinary, 0}, - { "needparse", eCmdHdlrBinary, 0} + { "needparse", eCmdHdlrBinary, 0}, + { "maxbytesperminute", eCmdHdlrInt, 0}, + { "maxlinesperminute", eCmdHdlrInt, 0} }; static struct cnfparamblk inppblk = { CNFPARAMBLK_VERSION, @@ -714,7 +732,7 @@ } else { /* reporting only in debug for dirs as higher lvl paths are likely blocked by selinux */ DBGPRINTF("imfile: error accessing directory '%s'", name); } - FINALIZE; + ABORT_FINALIZE(RS_RET_NO_FILE_ACCESS); } DBGPRINTF("add new active object '%s' in '%s'\n", name, edge->path); CHKmalloc(act = calloc(sizeof(act_obj_t), 1)); @@ -1144,7 +1162,8 @@ if(!ustrcmp(chld->name, name)) { DBGPRINTF("fs_node_add(%p, '%s') found '%s'\n", chld->node, toFind, name); /* add new instance */ - instanceConf_t **instarr_new = realloc(chld->instarr, sizeof(instanceConf_t*) * chld->ninst+1); + instanceConf_t **instarr_new = realloc(chld->instarr, + sizeof(instanceConf_t*) * (chld->ninst+1)); CHKmalloc(instarr_new); chld->instarr = instarr_new; chld->ninst++; @@ -1258,8 +1277,8 @@ static void ATTR_NONNULL(1) getFileID(act_obj_t *const act) { - /* save the old id for cleaning purposes */ - strncpy(act->file_id_prev, (const char*)act->file_id, FILE_ID_HASH_SIZE); + char tmp_id[FILE_ID_HASH_SIZE]; + strncpy(tmp_id, (const char*)act->file_id, FILE_ID_HASH_SIZE); act->file_id[0] = '\0'; assert(act->fd >= 0); /* fd must have been opened at act_obj_t creation! */ char filedata[FILE_ID_SIZE]; @@ -1270,6 +1289,9 @@ } else { DBGPRINTF("getFileID partial or error read, ret %d\n", r); } + if (strncmp(tmp_id, act->file_id, FILE_ID_HASH_SIZE)) {/* save the old id for cleaning purposes */ + strncpy(act->file_id_prev, tmp_id, FILE_ID_HASH_SIZE); + } DBGPRINTF("getFileID for '%s', file_id_hash '%s'\n", act->name, act->file_id); } @@ -1291,6 +1313,39 @@ return buf; } +static rsRetVal +checkPerMinuteRateLimits(per_minute_rate_limit_t *per_minute_rate_limits, + const size_t msgLen) +{ + DEFiRet; + time_t current_minute = time(NULL)/60; + if(per_minute_rate_limits->maxBytesPerMinute) { + if (per_minute_rate_limits->rateLimitingMinute == current_minute) { + per_minute_rate_limits->bytesThisMinute += msgLen; + /* if we would breach our rate limit then do not send the message. */ + if (per_minute_rate_limits->bytesThisMinute > per_minute_rate_limits->maxBytesPerMinute) { + ABORT_FINALIZE(RS_RET_RATE_LIMITED); + } + } else { + per_minute_rate_limits->rateLimitingMinute = current_minute; + per_minute_rate_limits->bytesThisMinute = msgLen; /* Update count as message will be sent */ + } + } + if(per_minute_rate_limits->maxLinesPerMinute) { + if (per_minute_rate_limits->rateLimitingMinute == current_minute) { + per_minute_rate_limits->linesThisMinute++; + /* if we would breach our rate limit then do not send the message. */ + if (per_minute_rate_limits->linesThisMinute > per_minute_rate_limits->maxLinesPerMinute) { + ABORT_FINALIZE(RS_RET_RATE_LIMITED); + } + } else { + per_minute_rate_limits->rateLimitingMinute = current_minute; + per_minute_rate_limits->linesThisMinute = 1; /* Update count as message will be sent */ + } + } +finalize_it: + RETiRet; +} /* enqueue the read file line as a message. The provided string is * not freed - this must be done by the caller. @@ -1345,6 +1400,10 @@ msgAddMultiMetadata(pMsg, metadata_names, metadata_values, 2); } + if(inst->perMinuteRateLimits.maxBytesPerMinute || inst->perMinuteRateLimits.maxLinesPerMinute) { + CHKiRet(checkPerMinuteRateLimits((per_minute_rate_limit_t *)&inst->perMinuteRateLimits, msgLen)); + } + if(inst->delay_perMsg) { srSleep(inst->delay_perMsg % 1000000, inst->delay_perMsg / 1000000); } @@ -1586,6 +1645,9 @@ finalize_it: multiSubmitFlush(&act->multiSub); + if(inst->bPersistStateAfterSubmission) { + persistStrmState(act); + } if(*pCStr != NULL) { rsCStrDestruct(pCStr); @@ -1635,6 +1697,12 @@ inst->maxLinesAtOnce = 0; inst->trimLineOverBytes = 0; inst->iPersistStateInterval = 0; + inst->perMinuteRateLimits.maxBytesPerMinute = 0; + inst->perMinuteRateLimits.maxLinesPerMinute = 0; + inst->perMinuteRateLimits.rateLimitingMinute = 0; + inst->perMinuteRateLimits.linesThisMinute = 0; + inst->perMinuteRateLimits.bytesThisMinute = 0; + inst->bPersistStateAfterSubmission = 0; inst->readMode = 0; inst->startRegex = NULL; inst->endRegex = NULL; @@ -1788,6 +1856,9 @@ } inst->trimLineOverBytes = cs.trimLineOverBytes; inst->iPersistStateInterval = cs.iPersistStateInterval; + inst->perMinuteRateLimits.maxBytesPerMinute = cs.maxBytesPerMinute; + inst->perMinuteRateLimits.maxLinesPerMinute = cs.maxLinesPerMinute; + inst->bPersistStateAfterSubmission = 0; inst->readMode = cs.readMode; inst->escapeLF = 0; inst->escapeLFString = NULL; @@ -1887,6 +1958,14 @@ inst->trimLineOverBytes = pvals[i].val.d.n; } else if(!strcmp(inppblk.descr[i].name, "persiststateinterval")) { inst->iPersistStateInterval = pvals[i].val.d.n; + } else if(!strcmp(inppblk.descr[i].name, "maxbytesperminute")) { + DBGPRINTF("imfile: enabling maxbytesperminute ratelimiting\n"); + inst->perMinuteRateLimits.maxBytesPerMinute = pvals[i].val.d.n; + } else if(!strcmp(inppblk.descr[i].name, "maxlinesperminute")) { + DBGPRINTF("imfile: enabling maxlinesperminute ratelimiting\n"); + inst->perMinuteRateLimits.maxLinesPerMinute = pvals[i].val.d.n; + } else if(!strcmp(inppblk.descr[i].name, "persiststateaftersubmission")) { + inst->bPersistStateAfterSubmission = pvals[i].val.d.n; } else if(!strcmp(inppblk.descr[i].name, "maxsubmitatonce")) { inst->nMultiSub = pvals[i].val.d.n; } else if(!strcmp(inppblk.descr[i].name, "readtimeout")) { @@ -2330,6 +2409,7 @@ char iobuf[8192]; int rd; int currev; + static int last_timeout = 0; DEFiRet; CHKiRet(wdmapInit()); @@ -2355,6 +2435,7 @@ if(r == 0) { DBGPRINTF("readTimeouts are configured, checking if some apply\n"); fs_node_walk(runModConf->conf_tree, poll_timeouts); + last_timeout = time(NULL); continue; } else if (r == -1) { LogError(errno, RS_RET_INTERNAL_ERROR, @@ -2391,6 +2472,11 @@ in_processEvent(savecast.ev); currev += sizeof(struct inotify_event) + savecast.ev->len; } + int now = time(NULL); + if(last_timeout + (runModConf->timeoutGranularity / 1000) > now) { + fs_node_walk(runModConf->conf_tree, poll_timeouts); + last_timeout = time(NULL); + } } finalize_it: diff -Nru rsyslog-8.2001.0/plugins/imjournal/imjournal.c rsyslog-8.2006.0/plugins/imjournal/imjournal.c --- rsyslog-8.2001.0/plugins/imjournal/imjournal.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imjournal/imjournal.c 2020-06-22 12:57:15.000000000 +0000 @@ -520,24 +520,36 @@ DEFiRet; FILE *sf = NULL; /* state file */ char tmp_sf[MAXFNAME]; - size_t n; DBGPRINTF("Persisting journal position, cursor: %s, at head? %d\n", journalContext.cursor, journalContext.atHead); /* first check that we have valid cursor */ if (!journalContext.cursor) { + DBGPRINTF("Journal cursor is not valid, ok...\n"); ABORT_FINALIZE(RS_RET_OK); } /* we create a temporary name by adding a ".tmp" * suffix to the end of our state file's name + * + * we use snprintf() to safely honor the boundaries + * of the temporary state file name buffer by using + * a precision specifier, which will limit the number + * of bytes taken from cs.stateFile to what will fit + * + * TODO: figure out a better way to avoid the PATH_MAX + * problem. The truncated cs.stateFile with .tmp at the + * end is not optimal */ - n = snprintf(tmp_sf, sizeof(tmp_sf), "%s.tmp", cs.stateFile); - if (n >= sizeof(tmp_sf)) { /* backup in case of too long path name */ - strncpy(tmp_sf, cs.stateFile, sizeof(tmp_sf) - 5); - strcat(tmp_sf, ".tmp"); - } +#define IM_SF_TMP_SUFFIX ".tmp" + snprintf(tmp_sf, sizeof(tmp_sf), "%.*s%s", + /* this calculates the max size for state file name, note that + * sizeof() NOT -1 is intentional - it reserves spaces for the + * NUL terminator. + */ + (int)(sizeof(tmp_sf) - sizeof(IM_SF_TMP_SUFFIX)), + cs.stateFile, IM_SF_TMP_SUFFIX); sf = fopen(tmp_sf, "wb"); if (sf == NULL) { @@ -573,6 +585,8 @@ } } + DBGPRINTF("Persisted journal to '%s'\n", cs.stateFile); + finalize_it: if (sf != NULL) { if (fclose(sf) == EOF) { diff -Nru rsyslog-8.2001.0/plugins/imkafka/dummy.c rsyslog-8.2006.0/plugins/imkafka/dummy.c --- rsyslog-8.2001.0/plugins/imkafka/dummy.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imkafka/dummy.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,171 @@ +/* a dummy module to be loaded if we cannot build this module, but + * configure required it to be "optional". + * + * Copyright 2020 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "config.h" +#include "rsyslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "conf.h" +#include "syslogd-types.h" +#include "srUtils.h" +#include "template.h" +#include "module-template.h" +#include "errmsg.h" +#include "parserif.h" + +#define MODULE_NAME(x) #x + +MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP +MODULE_CNFNAME(MODULE_NAME(MODNAME)) + + +DEF_OMOD_STATIC_DATA + +/* config variables */ +typedef struct _instanceData { + char *dummy; +} instanceData; + +typedef struct wrkrInstanceData { + instanceData *pData; +} wrkrInstanceData_t; + +struct modConfData_s { +}; + +/* modConf ptr to use for the current load process */ +static modConfData_t *loadModConf = NULL; +/* modConf ptr to use for the current exec process */ +static modConfData_t *runModConf = NULL; + + + + +BEGINbeginCnfLoad +CODESTARTbeginCnfLoad + loadModConf = pModConf; +ENDbeginCnfLoad + +BEGINendCnfLoad +CODESTARTendCnfLoad +ENDendCnfLoad + +BEGINcheckCnf +CODESTARTcheckCnf +ENDcheckCnf + +BEGINactivateCnf +CODESTARTactivateCnf + runModConf = pModConf; +ENDactivateCnf + +BEGINfreeCnf +CODESTARTfreeCnf +ENDfreeCnf + + +BEGINcreateWrkrInstance +CODESTARTcreateWrkrInstance +ENDcreateWrkrInstance + + +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature +ENDisCompatibleWithFeature + + +BEGINfreeInstance +CODESTARTfreeInstance +ENDfreeInstance + + +BEGINfreeWrkrInstance +CODESTARTfreeWrkrInstance +ENDfreeWrkrInstance + + +BEGINsetModCnf +CODESTARTsetModCnf + (void) lst; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME(MODNAME)); +ENDsetModCnf + + +BEGINnewActInst +CODESTARTnewActInst + (void) pData; + (void) ppModData; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME(MODNAME)); +ENDnewActInst + + +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo +ENDdbgPrintInstInfo + + +BEGINtryResume +CODESTARTtryResume +ENDtryResume + + +BEGINdoAction_NoStrings +CODESTARTdoAction + (void) pMsgData; +ENDdoAction + + +NO_LEGACY_CONF_parseSelectorAct + + +BEGINmodExit +CODESTARTmodExit +ENDmodExit + + +BEGINqueryEtryPt +CODESTARTqueryEtryPt +CODEqueryEtryPt_STD_OMOD_QUERIES +CODEqueryEtryPt_STD_OMOD8_QUERIES +CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES +CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES +CODEqueryEtryPt_STD_CONF2_QUERIES +ENDqueryEtryPt + + +BEGINmodInit() +CODESTARTmodInit + /* we only support the current interface specification */ + *ipIFVersProvided = CURR_MOD_IF_VERSION; +CODEmodInit_QueryRegCFSLineHdlr + dbgprintf("mmdblookup: module compiled with rsyslog version %s.\n", VERSION); +ENDmodInit diff -Nru rsyslog-8.2001.0/plugins/imkafka/Makefile.am rsyslog-8.2006.0/plugins/imkafka/Makefile.am --- rsyslog-8.2001.0/plugins/imkafka/Makefile.am 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imkafka/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -1,9 +1,13 @@ pkglib_LTLIBRARIES = imkafka.la +if IMKAFKA_USE_DUMMY +imkafka_la_SOURCES = dummy.c +imkafka_la_LDFLAGS = -module -avoid-version +imkafka_la_CPPFLAGS = -I$(top_srcdir) $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -D MODNAME=imkafka +else imkafka_la_SOURCES = imkafka.c -imkafka_la_CPPFLAGS = -I$(top_srcdir) $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -if !ENABLE_KAFKA_STATIC imkafka_la_LDFLAGS = -module -avoid-version $(LIBRDKAFKA_LIBS) +imkafka_la_CPPFLAGS = -I$(top_srcdir) $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) endif if ENABLE_KAFKA_STATIC imkafka_la_LDFLAGS = -module -avoid-version -Wl,--whole-archive -l:librdkafka.a -Wl,--no-whole-archive -lssl -lpthread -lcrypto -lsasl2 -lz -llz4 -lrt # Static Linking now $(LIBRDKAFKA_LIBS) diff -Nru rsyslog-8.2001.0/plugins/imkafka/Makefile.in rsyslog-8.2006.0/plugins/imkafka/Makefile.in --- rsyslog-8.2001.0/plugins/imkafka/Makefile.in 2020-01-14 12:59:33.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imkafka/Makefile.in 2020-06-22 12:58:11.000000000 +0000 @@ -133,7 +133,10 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) imkafka_la_DEPENDENCIES = -am_imkafka_la_OBJECTS = imkafka_la-imkafka.lo +am__imkafka_la_SOURCES_DIST = imkafka.c dummy.c +@IMKAFKA_USE_DUMMY_FALSE@am_imkafka_la_OBJECTS = \ +@IMKAFKA_USE_DUMMY_FALSE@ imkafka_la-imkafka.lo +@IMKAFKA_USE_DUMMY_TRUE@am_imkafka_la_OBJECTS = imkafka_la-dummy.lo imkafka_la_OBJECTS = $(am_imkafka_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -177,7 +180,7 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(imkafka_la_SOURCES) -DIST_SOURCES = $(imkafka_la_SOURCES) +DIST_SOURCES = $(am__imkafka_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -436,10 +439,13 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = imkafka.la -imkafka_la_SOURCES = imkafka.c -imkafka_la_CPPFLAGS = -I$(top_srcdir) $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -@ENABLE_KAFKA_STATIC_FALSE@imkafka_la_LDFLAGS = -module -avoid-version $(LIBRDKAFKA_LIBS) +@IMKAFKA_USE_DUMMY_FALSE@imkafka_la_SOURCES = imkafka.c +@IMKAFKA_USE_DUMMY_TRUE@imkafka_la_SOURCES = dummy.c @ENABLE_KAFKA_STATIC_TRUE@imkafka_la_LDFLAGS = -module -avoid-version -Wl,--whole-archive -l:librdkafka.a -Wl,--no-whole-archive -lssl -lpthread -lcrypto -lsasl2 -lz -llz4 -lrt # Static Linking now $(LIBRDKAFKA_LIBS) +@IMKAFKA_USE_DUMMY_FALSE@imkafka_la_LDFLAGS = -module -avoid-version $(LIBRDKAFKA_LIBS) +@IMKAFKA_USE_DUMMY_TRUE@imkafka_la_LDFLAGS = -module -avoid-version +@IMKAFKA_USE_DUMMY_FALSE@imkafka_la_CPPFLAGS = -I$(top_srcdir) $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) +@IMKAFKA_USE_DUMMY_TRUE@imkafka_la_CPPFLAGS = -I$(top_srcdir) $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -D MODNAME=imkafka imkafka_la_LIBADD = EXTRA_DIST = all: all-am @@ -520,6 +526,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imkafka_la-dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imkafka_la-imkafka.Plo@am__quote@ .c.o: @@ -553,6 +560,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(imkafka_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o imkafka_la-imkafka.lo `test -f 'imkafka.c' || echo '$(srcdir)/'`imkafka.c +imkafka_la-dummy.lo: dummy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(imkafka_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT imkafka_la-dummy.lo -MD -MP -MF $(DEPDIR)/imkafka_la-dummy.Tpo -c -o imkafka_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imkafka_la-dummy.Tpo $(DEPDIR)/imkafka_la-dummy.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy.c' object='imkafka_la-dummy.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(imkafka_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o imkafka_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c + mostlyclean-libtool: -rm -f *.lo diff -Nru rsyslog-8.2001.0/plugins/imudp/imudp.c rsyslog-8.2006.0/plugins/imudp/imudp.c --- rsyslog-8.2001.0/plugins/imudp/imudp.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/imudp/imudp.c 2020-06-05 10:06:07.000000000 +0000 @@ -41,6 +41,9 @@ #ifdef HAVE_SCHED_H # include #endif +#ifdef HAVE_SYS_PRCTL_H +# include +#endif #include "rsyslog.h" #include "dirty.h" #include "net.h" @@ -1205,9 +1208,6 @@ wrkr(void *myself) { struct wrkrInfo_s *pWrkr = (struct wrkrInfo_s*) myself; -# if defined(HAVE_PRCTL) && defined(PR_SET_NAME) - uchar *pszDbgHdr; -# endif uchar thrdName[32]; snprintf((char*)thrdName, sizeof(thrdName), "imudp(w%d)", pWrkr->id); diff -Nru rsyslog-8.2001.0/plugins/mmdblookup/dummy.c rsyslog-8.2006.0/plugins/mmdblookup/dummy.c --- rsyslog-8.2001.0/plugins/mmdblookup/dummy.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/plugins/mmdblookup/dummy.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,172 @@ +/* a dummy module to be loaded if we cannot build this module, but + * configure required it to be "optional". + * + * Copyright 2020 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#define MODULE_NAME "mmdblookup" /* how are we named? */ + +#include "config.h" +#include "rsyslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "conf.h" +#include "syslogd-types.h" +#include "srUtils.h" +#include "template.h" +#include "module-template.h" +#include "errmsg.h" +#include "parserif.h" + + +MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP +MODULE_CNFNAME(MODULE_NAME) + + +DEF_OMOD_STATIC_DATA + +/* config variables */ +typedef struct _instanceData { + char *dummy; +} instanceData; + +typedef struct wrkrInstanceData { + instanceData *pData ATTR_UNUSED; +} wrkrInstanceData_t; + +struct modConfData_s { +}; + +/* modConf ptr to use for the current load process */ +static modConfData_t *loadModConf = NULL; +/* modConf ptr to use for the current exec process */ +static modConfData_t *runModConf = NULL; + + + + +BEGINbeginCnfLoad +CODESTARTbeginCnfLoad + loadModConf = pModConf; +ENDbeginCnfLoad + +BEGINendCnfLoad +CODESTARTendCnfLoad +ENDendCnfLoad + +BEGINcheckCnf +CODESTARTcheckCnf +ENDcheckCnf + +BEGINactivateCnf +CODESTARTactivateCnf + runModConf = pModConf; +ENDactivateCnf + +BEGINfreeCnf +CODESTARTfreeCnf +ENDfreeCnf + + +BEGINcreateWrkrInstance +CODESTARTcreateWrkrInstance +ENDcreateWrkrInstance + + +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature +ENDisCompatibleWithFeature + + +BEGINfreeInstance +CODESTARTfreeInstance +ENDfreeInstance + + +BEGINfreeWrkrInstance +CODESTARTfreeWrkrInstance +ENDfreeWrkrInstance + + +BEGINsetModCnf +CODESTARTsetModCnf + (void) lst; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME); +ENDsetModCnf + + +BEGINnewActInst +CODESTARTnewActInst + (void) pData; + (void) ppModData; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME); +ENDnewActInst + + +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo +ENDdbgPrintInstInfo + + +BEGINtryResume +CODESTARTtryResume +ENDtryResume + + +BEGINdoAction_NoStrings +CODESTARTdoAction + (void) pMsgData; +ENDdoAction + + +NO_LEGACY_CONF_parseSelectorAct + + +BEGINmodExit +CODESTARTmodExit +ENDmodExit + + +BEGINqueryEtryPt +CODESTARTqueryEtryPt +CODEqueryEtryPt_STD_OMOD_QUERIES +CODEqueryEtryPt_STD_OMOD8_QUERIES +CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES +CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES +CODEqueryEtryPt_STD_CONF2_QUERIES +ENDqueryEtryPt + + +BEGINmodInit() +CODESTARTmodInit + /* we only support the current interface specification */ + *ipIFVersProvided = CURR_MOD_IF_VERSION; +CODEmodInit_QueryRegCFSLineHdlr + dbgprintf("mmdblookup: module compiled with rsyslog version %s.\n", VERSION); +ENDmodInit diff -Nru rsyslog-8.2001.0/plugins/mmdblookup/Makefile.am rsyslog-8.2006.0/plugins/mmdblookup/Makefile.am --- rsyslog-8.2001.0/plugins/mmdblookup/Makefile.am 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/plugins/mmdblookup/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -1,8 +1,14 @@ pkglib_LTLIBRARIES = mmdblookup.la +if MMDBLOOKUP_USE_DUMMY +mmdblookup_la_SOURCES = dummy.c +mmdblookup_la_LDFLAGS = -module -avoid-version +else mmdblookup_la_SOURCES = mmdblookup.c -mmdblookup_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) mmdblookup_la_LDFLAGS = -module -avoid-version -lmaxminddb +endif + +mmdblookup_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) mmdblookup_la_LIBADD = EXTRA_DIST = diff -Nru rsyslog-8.2001.0/plugins/mmdblookup/Makefile.in rsyslog-8.2006.0/plugins/mmdblookup/Makefile.in --- rsyslog-8.2001.0/plugins/mmdblookup/Makefile.in 2020-01-14 12:59:34.000000000 +0000 +++ rsyslog-8.2006.0/plugins/mmdblookup/Makefile.in 2020-06-22 12:58:12.000000000 +0000 @@ -133,7 +133,11 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) mmdblookup_la_DEPENDENCIES = -am_mmdblookup_la_OBJECTS = mmdblookup_la-mmdblookup.lo +am__mmdblookup_la_SOURCES_DIST = mmdblookup.c dummy.c +@MMDBLOOKUP_USE_DUMMY_FALSE@am_mmdblookup_la_OBJECTS = \ +@MMDBLOOKUP_USE_DUMMY_FALSE@ mmdblookup_la-mmdblookup.lo +@MMDBLOOKUP_USE_DUMMY_TRUE@am_mmdblookup_la_OBJECTS = \ +@MMDBLOOKUP_USE_DUMMY_TRUE@ mmdblookup_la-dummy.lo mmdblookup_la_OBJECTS = $(am_mmdblookup_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -177,7 +181,7 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(mmdblookup_la_SOURCES) -DIST_SOURCES = $(mmdblookup_la_SOURCES) +DIST_SOURCES = $(am__mmdblookup_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -436,9 +440,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = mmdblookup.la -mmdblookup_la_SOURCES = mmdblookup.c +@MMDBLOOKUP_USE_DUMMY_FALSE@mmdblookup_la_SOURCES = mmdblookup.c +@MMDBLOOKUP_USE_DUMMY_TRUE@mmdblookup_la_SOURCES = dummy.c +@MMDBLOOKUP_USE_DUMMY_FALSE@mmdblookup_la_LDFLAGS = -module -avoid-version -lmaxminddb +@MMDBLOOKUP_USE_DUMMY_TRUE@mmdblookup_la_LDFLAGS = -module -avoid-version mmdblookup_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -mmdblookup_la_LDFLAGS = -module -avoid-version -lmaxminddb mmdblookup_la_LIBADD = EXTRA_DIST = all: all-am @@ -519,6 +525,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmdblookup_la-dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmdblookup_la-mmdblookup.Plo@am__quote@ .c.o: @@ -552,6 +559,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mmdblookup_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmdblookup_la-mmdblookup.lo `test -f 'mmdblookup.c' || echo '$(srcdir)/'`mmdblookup.c +mmdblookup_la-dummy.lo: dummy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mmdblookup_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmdblookup_la-dummy.lo -MD -MP -MF $(DEPDIR)/mmdblookup_la-dummy.Tpo -c -o mmdblookup_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mmdblookup_la-dummy.Tpo $(DEPDIR)/mmdblookup_la-dummy.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy.c' object='mmdblookup_la-dummy.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mmdblookup_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmdblookup_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c + mostlyclean-libtool: -rm -f *.lo diff -Nru rsyslog-8.2001.0/plugins/mmdblookup/mmdblookup.c rsyslog-8.2006.0/plugins/mmdblookup/mmdblookup.c --- rsyslog-8.2001.0/plugins/mmdblookup/mmdblookup.c 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/plugins/mmdblookup/mmdblookup.c 2020-05-28 10:29:49.000000000 +0000 @@ -362,6 +362,11 @@ dbgprintf("Got an error from the maxminddb library: %s\n", MMDB_strerror(mmdb_err)); ABORT_FINALIZE(RS_RET_OK); } + if (!result.found_entry) { + dbgprintf("No entry found in database for '%s'\n", pszValue); + ABORT_FINALIZE(RS_RET_OK); + } + int status = MMDB_get_entry_data_list(&result.entry, &entry_data_list); diff -Nru rsyslog-8.2001.0/plugins/omkafka/dummy.c rsyslog-8.2006.0/plugins/omkafka/dummy.c --- rsyslog-8.2001.0/plugins/omkafka/dummy.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omkafka/dummy.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,171 @@ +/* a dummy module to be loaded if we cannot build this module, but + * configure required it to be "optional". + * + * Copyright 2020 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "config.h" +#include "rsyslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "conf.h" +#include "syslogd-types.h" +#include "srUtils.h" +#include "template.h" +#include "module-template.h" +#include "errmsg.h" +#include "parserif.h" + +#define MODULE_NAME(x) #x + +MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP +MODULE_CNFNAME(MODULE_NAME(MODNAME)) + + +DEF_OMOD_STATIC_DATA + +/* config variables */ +typedef struct _instanceData { + char *dummy; +} instanceData; + +typedef struct wrkrInstanceData { + instanceData *pData; +} wrkrInstanceData_t; + +struct modConfData_s { +}; + +/* modConf ptr to use for the current load process */ +static modConfData_t *loadModConf = NULL; +/* modConf ptr to use for the current exec process */ +static modConfData_t *runModConf = NULL; + + + + +BEGINbeginCnfLoad +CODESTARTbeginCnfLoad + loadModConf = pModConf; +ENDbeginCnfLoad + +BEGINendCnfLoad +CODESTARTendCnfLoad +ENDendCnfLoad + +BEGINcheckCnf +CODESTARTcheckCnf +ENDcheckCnf + +BEGINactivateCnf +CODESTARTactivateCnf + runModConf = pModConf; +ENDactivateCnf + +BEGINfreeCnf +CODESTARTfreeCnf +ENDfreeCnf + + +BEGINcreateWrkrInstance +CODESTARTcreateWrkrInstance +ENDcreateWrkrInstance + + +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature +ENDisCompatibleWithFeature + + +BEGINfreeInstance +CODESTARTfreeInstance +ENDfreeInstance + + +BEGINfreeWrkrInstance +CODESTARTfreeWrkrInstance +ENDfreeWrkrInstance + + +BEGINsetModCnf +CODESTARTsetModCnf + (void) lst; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME(MODNAME)); +ENDsetModCnf + + +BEGINnewActInst +CODESTARTnewActInst + (void) pData; + (void) ppModData; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME(MODNAME)); +ENDnewActInst + + +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo +ENDdbgPrintInstInfo + + +BEGINtryResume +CODESTARTtryResume +ENDtryResume + + +BEGINdoAction_NoStrings +CODESTARTdoAction + (void) pMsgData; +ENDdoAction + + +NO_LEGACY_CONF_parseSelectorAct + + +BEGINmodExit +CODESTARTmodExit +ENDmodExit + + +BEGINqueryEtryPt +CODESTARTqueryEtryPt +CODEqueryEtryPt_STD_OMOD_QUERIES +CODEqueryEtryPt_STD_OMOD8_QUERIES +CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES +CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES +CODEqueryEtryPt_STD_CONF2_QUERIES +ENDqueryEtryPt + + +BEGINmodInit() +CODESTARTmodInit + /* we only support the current interface specification */ + *ipIFVersProvided = CURR_MOD_IF_VERSION; +CODEmodInit_QueryRegCFSLineHdlr + dbgprintf("mmdblookup: module compiled with rsyslog version %s.\n", VERSION); +ENDmodInit diff -Nru rsyslog-8.2001.0/plugins/omkafka/Makefile.am rsyslog-8.2006.0/plugins/omkafka/Makefile.am --- rsyslog-8.2001.0/plugins/omkafka/Makefile.am 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omkafka/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -1,10 +1,15 @@ pkglib_LTLIBRARIES = omkafka.la +if OMKAFKA_USE_DUMMY +omkafka_la_SOURCES = dummy.c +omkafka_la_LDFLAGS = -module -avoid-version +omkafka_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -D MODNAME=omkafka +else omkafka_la_SOURCES = omkafka.c -omkafka_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -if !ENABLE_KAFKA_STATIC omkafka_la_LDFLAGS = -module -avoid-version $(LIBRDKAFKA_LIBS) -lm +omkafka_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) endif + if ENABLE_KAFKA_STATIC omkafka_la_LDFLAGS = -module -avoid-version -Wl,--whole-archive -l:librdkafka.a -Wl,--no-whole-archive -lssl -lpthread -lcrypto -lsasl2 -lz -llz4 -lrt -lm endif diff -Nru rsyslog-8.2001.0/plugins/omkafka/Makefile.in rsyslog-8.2006.0/plugins/omkafka/Makefile.in --- rsyslog-8.2001.0/plugins/omkafka/Makefile.in 2020-01-14 12:59:35.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omkafka/Makefile.in 2020-06-22 12:58:13.000000000 +0000 @@ -133,7 +133,10 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) omkafka_la_DEPENDENCIES = -am_omkafka_la_OBJECTS = omkafka_la-omkafka.lo +am__omkafka_la_SOURCES_DIST = omkafka.c dummy.c +@OMKAFKA_USE_DUMMY_FALSE@am_omkafka_la_OBJECTS = \ +@OMKAFKA_USE_DUMMY_FALSE@ omkafka_la-omkafka.lo +@OMKAFKA_USE_DUMMY_TRUE@am_omkafka_la_OBJECTS = omkafka_la-dummy.lo omkafka_la_OBJECTS = $(am_omkafka_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -177,7 +180,7 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(omkafka_la_SOURCES) -DIST_SOURCES = $(omkafka_la_SOURCES) +DIST_SOURCES = $(am__omkafka_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -436,10 +439,13 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = omkafka.la -omkafka_la_SOURCES = omkafka.c -omkafka_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -@ENABLE_KAFKA_STATIC_FALSE@omkafka_la_LDFLAGS = -module -avoid-version $(LIBRDKAFKA_LIBS) -lm +@OMKAFKA_USE_DUMMY_FALSE@omkafka_la_SOURCES = omkafka.c +@OMKAFKA_USE_DUMMY_TRUE@omkafka_la_SOURCES = dummy.c @ENABLE_KAFKA_STATIC_TRUE@omkafka_la_LDFLAGS = -module -avoid-version -Wl,--whole-archive -l:librdkafka.a -Wl,--no-whole-archive -lssl -lpthread -lcrypto -lsasl2 -lz -llz4 -lrt -lm +@OMKAFKA_USE_DUMMY_FALSE@omkafka_la_LDFLAGS = -module -avoid-version $(LIBRDKAFKA_LIBS) -lm +@OMKAFKA_USE_DUMMY_TRUE@omkafka_la_LDFLAGS = -module -avoid-version +@OMKAFKA_USE_DUMMY_FALSE@omkafka_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) +@OMKAFKA_USE_DUMMY_TRUE@omkafka_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) -D MODNAME=omkafka omkafka_la_LIBADD = EXTRA_DIST = all: all-am @@ -520,6 +526,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omkafka_la-dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omkafka_la-omkafka.Plo@am__quote@ .c.o: @@ -553,6 +560,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(omkafka_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omkafka_la-omkafka.lo `test -f 'omkafka.c' || echo '$(srcdir)/'`omkafka.c +omkafka_la-dummy.lo: dummy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(omkafka_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omkafka_la-dummy.lo -MD -MP -MF $(DEPDIR)/omkafka_la-dummy.Tpo -c -o omkafka_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/omkafka_la-dummy.Tpo $(DEPDIR)/omkafka_la-dummy.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy.c' object='omkafka_la-dummy.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(omkafka_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omkafka_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c + mostlyclean-libtool: -rm -f *.lo diff -Nru rsyslog-8.2001.0/plugins/omlibdbi/dummy.c rsyslog-8.2006.0/plugins/omlibdbi/dummy.c --- rsyslog-8.2001.0/plugins/omlibdbi/dummy.c 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omlibdbi/dummy.c 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,171 @@ +/* a dummy module to be loaded if we cannot build this module, but + * configure required it to be "optional". + * + * Copyright 2020 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "config.h" +#include "rsyslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "conf.h" +#include "syslogd-types.h" +#include "srUtils.h" +#include "template.h" +#include "module-template.h" +#include "errmsg.h" +#include "parserif.h" + +#define MODULE_NAME(x) #x + +MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP +MODULE_CNFNAME(MODULE_NAME(MODNAME)) + + +DEF_OMOD_STATIC_DATA + +/* config variables */ +typedef struct _instanceData { + char *dummy; +} instanceData; + +typedef struct wrkrInstanceData { + instanceData *pData; +} wrkrInstanceData_t; + +struct modConfData_s { +}; + +/* modConf ptr to use for the current load process */ +static modConfData_t *loadModConf = NULL; +/* modConf ptr to use for the current exec process */ +static modConfData_t *runModConf = NULL; + + + + +BEGINbeginCnfLoad +CODESTARTbeginCnfLoad + loadModConf = pModConf; +ENDbeginCnfLoad + +BEGINendCnfLoad +CODESTARTendCnfLoad +ENDendCnfLoad + +BEGINcheckCnf +CODESTARTcheckCnf +ENDcheckCnf + +BEGINactivateCnf +CODESTARTactivateCnf + runModConf = pModConf; +ENDactivateCnf + +BEGINfreeCnf +CODESTARTfreeCnf +ENDfreeCnf + + +BEGINcreateWrkrInstance +CODESTARTcreateWrkrInstance +ENDcreateWrkrInstance + + +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature +ENDisCompatibleWithFeature + + +BEGINfreeInstance +CODESTARTfreeInstance +ENDfreeInstance + + +BEGINfreeWrkrInstance +CODESTARTfreeWrkrInstance +ENDfreeWrkrInstance + + +BEGINsetModCnf +CODESTARTsetModCnf + (void) lst; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME(MODNAME)); +ENDsetModCnf + + +BEGINnewActInst +CODESTARTnewActInst + (void) pData; + (void) ppModData; + parser_errmsg("%s is an optional module which could not be built on your platform " + "please remove it from the configuration or upgrade your platform", MODULE_NAME(MODNAME)); +ENDnewActInst + + +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo +ENDdbgPrintInstInfo + + +BEGINtryResume +CODESTARTtryResume +ENDtryResume + + +BEGINdoAction_NoStrings +CODESTARTdoAction + (void) pMsgData; +ENDdoAction + + +NO_LEGACY_CONF_parseSelectorAct + + +BEGINmodExit +CODESTARTmodExit +ENDmodExit + + +BEGINqueryEtryPt +CODESTARTqueryEtryPt +CODEqueryEtryPt_STD_OMOD_QUERIES +CODEqueryEtryPt_STD_OMOD8_QUERIES +CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES +CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES +CODEqueryEtryPt_STD_CONF2_QUERIES +ENDqueryEtryPt + + +BEGINmodInit() +CODESTARTmodInit + /* we only support the current interface specification */ + *ipIFVersProvided = CURR_MOD_IF_VERSION; +CODEmodInit_QueryRegCFSLineHdlr + dbgprintf("mmdblookup: module compiled with rsyslog version %s.\n", VERSION); +ENDmodInit diff -Nru rsyslog-8.2001.0/plugins/omlibdbi/Makefile.am rsyslog-8.2006.0/plugins/omlibdbi/Makefile.am --- rsyslog-8.2001.0/plugins/omlibdbi/Makefile.am 2018-09-30 09:52:00.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omlibdbi/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -1,6 +1,12 @@ pkglib_LTLIBRARIES = omlibdbi.la +if LIBDBI_USE_DUMMY +omlibdbi_la_SOURCES = dummy.c +omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) -D MODNAME=omlibdbi +omlibdbi_la_LDFLAGS = -module -avoid-version +else omlibdbi_la_SOURCES = omlibdbi.c omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(LIBDBI_CFLAGS) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) omlibdbi_la_LDFLAGS = -module -avoid-version omlibdbi_la_LIBADD = $(LIBDBI_LIBS) +endif diff -Nru rsyslog-8.2001.0/plugins/omlibdbi/Makefile.in rsyslog-8.2006.0/plugins/omlibdbi/Makefile.in --- rsyslog-8.2001.0/plugins/omlibdbi/Makefile.in 2020-01-14 12:59:35.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omlibdbi/Makefile.in 2020-06-22 12:58:13.000000000 +0000 @@ -133,8 +133,12 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = -omlibdbi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_omlibdbi_la_OBJECTS = omlibdbi_la-omlibdbi.lo +@LIBDBI_USE_DUMMY_FALSE@omlibdbi_la_DEPENDENCIES = \ +@LIBDBI_USE_DUMMY_FALSE@ $(am__DEPENDENCIES_1) +am__omlibdbi_la_SOURCES_DIST = omlibdbi.c dummy.c +@LIBDBI_USE_DUMMY_FALSE@am_omlibdbi_la_OBJECTS = \ +@LIBDBI_USE_DUMMY_FALSE@ omlibdbi_la-omlibdbi.lo +@LIBDBI_USE_DUMMY_TRUE@am_omlibdbi_la_OBJECTS = omlibdbi_la-dummy.lo omlibdbi_la_OBJECTS = $(am_omlibdbi_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -178,7 +182,7 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(omlibdbi_la_SOURCES) -DIST_SOURCES = $(omlibdbi_la_SOURCES) +DIST_SOURCES = $(am__omlibdbi_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -437,10 +441,13 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = omlibdbi.la -omlibdbi_la_SOURCES = omlibdbi.c -omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(LIBDBI_CFLAGS) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) -omlibdbi_la_LDFLAGS = -module -avoid-version -omlibdbi_la_LIBADD = $(LIBDBI_LIBS) +@LIBDBI_USE_DUMMY_FALSE@omlibdbi_la_SOURCES = omlibdbi.c +@LIBDBI_USE_DUMMY_TRUE@omlibdbi_la_SOURCES = dummy.c +@LIBDBI_USE_DUMMY_FALSE@omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(LIBDBI_CFLAGS) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) +@LIBDBI_USE_DUMMY_TRUE@omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) -D MODNAME=omlibdbi +@LIBDBI_USE_DUMMY_FALSE@omlibdbi_la_LDFLAGS = -module -avoid-version +@LIBDBI_USE_DUMMY_TRUE@omlibdbi_la_LDFLAGS = -module -avoid-version +@LIBDBI_USE_DUMMY_FALSE@omlibdbi_la_LIBADD = $(LIBDBI_LIBS) all: all-am .SUFFIXES: @@ -519,6 +526,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omlibdbi_la-dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omlibdbi_la-omlibdbi.Plo@am__quote@ .c.o: @@ -552,6 +560,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(omlibdbi_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omlibdbi_la-omlibdbi.lo `test -f 'omlibdbi.c' || echo '$(srcdir)/'`omlibdbi.c +omlibdbi_la-dummy.lo: dummy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(omlibdbi_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omlibdbi_la-dummy.lo -MD -MP -MF $(DEPDIR)/omlibdbi_la-dummy.Tpo -c -o omlibdbi_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/omlibdbi_la-dummy.Tpo $(DEPDIR)/omlibdbi_la-dummy.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy.c' object='omlibdbi_la-dummy.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(omlibdbi_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omlibdbi_la-dummy.lo `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c + mostlyclean-libtool: -rm -f *.lo diff -Nru rsyslog-8.2001.0/plugins/omprog/omprog.c rsyslog-8.2006.0/plugins/omprog/omprog.c --- rsyslog-8.2001.0/plugins/omprog/omprog.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omprog/omprog.c 2020-06-22 12:57:15.000000000 +0000 @@ -67,7 +67,7 @@ #define MAX_FD_TO_CLOSE 65535 typedef struct childProcessCtx { - int bIsRunning; /* is program currently running? 0-no, 1-yes */ + int bIsRunning; /* is the program running? (if 0, next fields are uninitialized) */ pid_t pid; /* pid of currently running child process */ int fdPipeOut; /* fd for sending messages to the program */ int fdPipeIn; /* fd for receiving status messages from the program, or -1 */ @@ -76,16 +76,17 @@ typedef struct outputCaptureCtx { uchar *szFileName; /* name of file to write the program output to, or NULL */ mode_t fCreateMode; /* output file creation permissions */ - int bIsRunning; /* is the output-capture thread running? (if 0, next fields are meaningless) */ + pthread_mutex_t mutStart; /* mutex for starting the output-capture thread */ + pthread_mutex_t mutWrite; /* mutex for reopening the output file on HUP while being written */ + pthread_mutex_t mutTerm; /* mutex for signaling the termination of the thread */ + pthread_cond_t condTerm; /* condition for signaling the termination of the thread */ + int bIsRunning; /* is the thread running? (if 0, next fields are uninitialized) */ pthread_t thrdID; /* ID of the output-capture thread */ int fdPipe[2]; /* pipe for capturing the output of the child processes */ int fdFile; /* fd of the output file (-1 if it could not be opened) */ int bFileErr; /* file open error occurred? (to avoid reporting too many errors) */ int bReadErr; /* read error occurred? (to avoid reporting too many errors) */ int bWriteErr; /* write error occurred? (to avoid reporting too many errors) */ - pthread_mutex_t mutWrite; /* mutex for reopening the output file on HUP while being written */ - pthread_mutex_t mutTerm; /* mutex for signaling the termination of the thread */ - pthread_cond_t condTerm; /* condition for signaling the termination of the thread */ } outputCaptureCtx_t; typedef struct _instanceData { @@ -106,7 +107,7 @@ int bForceSingleInst; /* start only one instance of program, even with multiple workers? */ childProcessCtx_t *pSingleChildCtx; /* child process context when bForceSingleInst=true */ pthread_mutex_t *pSingleChildMut; /* mutex for interacting with single child process */ - outputCaptureCtx_t outputCaptureCtx; /* settings and state for the output capture thread */ + outputCaptureCtx_t *pOutputCaptureCtx; /* settings and state for the output capture thread */ time_t block_if_err; /* time until which interface error is not to be shown */ } instanceData; @@ -160,8 +161,8 @@ goto failed; } - if(pData->outputCaptureCtx.bIsRunning) { - fdOutput = pData->outputCaptureCtx.fdPipe[1]; + if(pData->pOutputCaptureCtx != NULL) { + fdOutput = pData->pOutputCaptureCtx->fdPipe[1]; } else { fdOutput = open("/dev/null", O_WRONLY); if(fdOutput == -1) { @@ -551,13 +552,14 @@ DEFiRet; CHKmalloc(pChildCtx = calloc(1, sizeof(childProcessCtx_t))); + *ppChildCtx = pChildCtx; + pChildCtx->bIsRunning = 0; pChildCtx->pid = -1; pChildCtx->fdPipeOut = -1; pChildCtx->fdPipeIn = -1; finalize_it: - *ppChildCtx = pChildCtx; RETiRet; } @@ -583,6 +585,24 @@ RETiRet; } +static rsRetVal +startSingleChildOnce(instanceData *pData) +{ + DEFiRet; + + assert(pData->bForceSingleInst); + CHKiConcCtrl(pthread_mutex_lock(pData->pSingleChildMut)); + + if(pData->pSingleChildCtx->bIsRunning) + goto finalize_it; /* child process already started: nothing to do */ + + iRet = startChild(pData, pData->pSingleChildCtx); + +finalize_it: + pthread_mutex_unlock(pData->pSingleChildMut); + RETiRet; +} + static void writeOutputToFile(outputCaptureCtx_t *pCtx, char *buf, ssize_t len) { @@ -637,7 +657,6 @@ static void closeOutputFile(outputCaptureCtx_t *pCtx) { - assert(pCtx->bIsRunning); DBGPRINTF("omprog: reopening output file upon reception of HUP signal\n"); pthread_mutex_lock(&pCtx->mutWrite); @@ -708,12 +727,51 @@ } static rsRetVal -startOutputCapture(outputCaptureCtx_t *pCtx) +allocOutputCaptureCtx(outputCaptureCtx_t **ppCtx) +{ + outputCaptureCtx_t *pCtx; + DEFiRet; + + CHKmalloc(pCtx = calloc(1, sizeof(outputCaptureCtx_t))); + *ppCtx = pCtx; + + pCtx->szFileName = NULL; + pCtx->fCreateMode = 0600; + pCtx->bIsRunning = 0; + + CHKiConcCtrl(pthread_mutex_init(&pCtx->mutStart, NULL)); + CHKiConcCtrl(pthread_mutex_init(&pCtx->mutWrite, NULL)); + CHKiConcCtrl(pthread_mutex_init(&pCtx->mutTerm, NULL)); + CHKiConcCtrl(pthread_cond_init(&pCtx->condTerm, NULL)); + +finalize_it: + RETiRet; +} + +static void +freeOutputCaptureCtx(outputCaptureCtx_t *pCtx) { + if(pCtx->szFileName != NULL) { + free(pCtx->szFileName); + } + + pthread_cond_destroy(&pCtx->condTerm); + pthread_mutex_destroy(&pCtx->mutTerm); + pthread_mutex_destroy(&pCtx->mutWrite); + pthread_mutex_destroy(&pCtx->mutStart); + + free(pCtx); +} + +static rsRetVal +startOutputCaptureOnce(outputCaptureCtx_t *pCtx) { int pip[2] = { -1, -1 }; DEFiRet; - assert(!pCtx->bIsRunning); + CHKiConcCtrl(pthread_mutex_lock(&pCtx->mutStart)); + + if(pCtx->bIsRunning) + goto finalize_it; /* output capture thread already started: nothing to do */ /* open a (single) pipe to capture output from (all) child processes */ if(pipe(pip) == -1) { @@ -726,9 +784,6 @@ pCtx->bFileErr = 0; pCtx->bReadErr = 0; pCtx->bWriteErr = 0; - CHKiConcCtrl(pthread_mutex_init(&pCtx->mutWrite, NULL)); - CHKiConcCtrl(pthread_mutex_init(&pCtx->mutTerm, NULL)); - CHKiConcCtrl(pthread_cond_init(&pCtx->condTerm, NULL)); /* start a thread to read lines from the pipe and write them to the output file */ CHKiConcCtrl(pthread_create(&pCtx->thrdID, NULL, captureOutput, (void *)pCtx)); @@ -740,6 +795,7 @@ close(pip[0]); close(pip[1]); } + pthread_mutex_unlock(&pCtx->mutStart); RETiRet; } @@ -778,9 +834,6 @@ } pthread_join(pCtx->thrdID, NULL); - pthread_cond_destroy(&pCtx->condTerm); - pthread_mutex_destroy(&pCtx->mutTerm); - pthread_mutex_destroy(&pCtx->mutWrite); /* close the read end of the output-capture pipe */ close(pCtx->fdPipe[0]); @@ -818,14 +871,12 @@ pData->bForceSingleInst = 0; pData->pSingleChildCtx = NULL; pData->pSingleChildMut = NULL; - pData->outputCaptureCtx.szFileName = NULL; - pData->outputCaptureCtx.fCreateMode = 0600; - pData->outputCaptureCtx.bIsRunning = 0; + pData->pOutputCaptureCtx = NULL; ENDcreateInstance static rsRetVal -startInstance(instanceData *pData) +postInitInstance(instanceData *pData) { DEFiRet; @@ -839,15 +890,18 @@ pData->bKillUnresponsive = pData->bSignalOnClose; } - if(pData->outputCaptureCtx.szFileName != NULL) { - CHKiRet(startOutputCapture(&pData->outputCaptureCtx)); + if(pData->pOutputCaptureCtx != NULL && pData->pOutputCaptureCtx->szFileName == NULL) { + LogError(0, RS_RET_CONF_PARAM_INVLD, "omprog: the 'fileCreateMode' parameter requires " + "specifying the 'output' parameter also"); + ABORT_FINALIZE(RS_RET_CONF_PARAM_INVLD); } if(pData->bForceSingleInst) { - CHKmalloc(pData->pSingleChildMut = malloc(sizeof(pthread_mutex_t))); + CHKmalloc(pData->pSingleChildMut = calloc(1, sizeof(pthread_mutex_t))); CHKiConcCtrl(pthread_mutex_init(pData->pSingleChildMut, NULL)); CHKiRet(allocChildCtx(&pData->pSingleChildCtx)); - CHKiRet(startChild(pData, pData->pSingleChildCtx)); + /* do not start the child here. The config is still being parsed, and the daemon + has not been forked yet. When the daemon is forked, all fds will be closed! */ } finalize_it: @@ -858,7 +912,14 @@ BEGINcreateWrkrInstance CODESTARTcreateWrkrInstance + pWrkrData->pChildCtx = NULL; + + if(pWrkrData->pData->pOutputCaptureCtx != NULL) { + CHKiRet(startOutputCaptureOnce(pWrkrData->pData->pOutputCaptureCtx)); + } + if(pWrkrData->pData->bForceSingleInst) { + CHKiRet(startSingleChildOnce(pWrkrData->pData)); pWrkrData->pChildCtx = pData->pSingleChildCtx; } else { CHKiRet(allocChildCtx(&pWrkrData->pChildCtx)); @@ -1011,15 +1072,17 @@ free(pData->pSingleChildMut); } - if(pData->outputCaptureCtx.bIsRunning) { - endOutputCapture(&pData->outputCaptureCtx, pData->lCloseTimeout); + if(pData->pOutputCaptureCtx != NULL) { + if(pData->pOutputCaptureCtx->bIsRunning) { + endOutputCapture(pData->pOutputCaptureCtx, pData->lCloseTimeout); + } + freeOutputCaptureCtx(pData->pOutputCaptureCtx); } free(pData->szBinary); free(pData->szTemplateName); free(pData->szBeginTransactionMark); free(pData->szCommitTransactionMark); - free(pData->outputCaptureCtx.szFileName); if(pData->aParams != NULL) { for (i = 0; i < pData->iParams; i++) { @@ -1087,9 +1150,15 @@ } else if(!strcmp(actpblk.descr[i].name, "template")) { pData->szTemplateName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "output")) { - pData->outputCaptureCtx.szFileName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); + if(pData->pOutputCaptureCtx == NULL) { + CHKiRet(allocOutputCaptureCtx(&pData->pOutputCaptureCtx)); + } + pData->pOutputCaptureCtx->szFileName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "fileCreateMode")) { - pData->outputCaptureCtx.fCreateMode = (mode_t) pvals[i].val.d.n; + if(pData->pOutputCaptureCtx == NULL) { + CHKiRet(allocOutputCaptureCtx(&pData->pOutputCaptureCtx)); + } + pData->pOutputCaptureCtx->fCreateMode = (mode_t) pvals[i].val.d.n; } else { DBGPRINTF("omprog: program error, non-handled param '%s'\n", actpblk.descr[i].name); } @@ -1099,7 +1168,7 @@ CHKiRet(OMSRsetEntry(*ppOMSR, 0, (uchar*)strdup(pData->szTemplateName == NULL ? "RSYSLOG_FileFormat" : (char*)pData->szTemplateName), OMSR_NO_RQD_TPL_OPTS)); - iRet = startInstance(pData); + iRet = postInitInstance(pData); CODE_STD_FINALIZERnewActInst cnfparamvalsDestruct(pvals, &actpblk); @@ -1129,7 +1198,7 @@ --p; CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, 0, (uchar*) "RSYSLOG_FileFormat")); - iRet = startInstance(pData); + iRet = postInitInstance(pData); CODE_STD_FINALIZERparseSelectorAct ENDparseSelectorAct @@ -1144,8 +1213,8 @@ kill(pData->pSingleChildCtx->pid, pData->iHUPForward); } - if(pData->outputCaptureCtx.bIsRunning) { - closeOutputFile(&pData->outputCaptureCtx); + if(pData->pOutputCaptureCtx != NULL && pData->pOutputCaptureCtx->bIsRunning) { + closeOutputFile(pData->pOutputCaptureCtx); } ENDdoHUP diff -Nru rsyslog-8.2001.0/plugins/omudpspoof/omudpspoof.c rsyslog-8.2006.0/plugins/omudpspoof/omudpspoof.c --- rsyslog-8.2001.0/plugins/omudpspoof/omudpspoof.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/plugins/omudpspoof/omudpspoof.c 2020-06-22 12:57:15.000000000 +0000 @@ -155,8 +155,6 @@ static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */ static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current exec process */ - - BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars cs.tplName = NULL; @@ -174,7 +172,6 @@ /* forward definitions */ static rsRetVal doTryResume(wrkrInstanceData_t *pWrkrData); - /* this function gets the default template. It coordinates action between * old-style and new-style configuration parts. */ @@ -373,7 +370,8 @@ /* hdrOffs = fragmentation flags + offset (in bytes) * divided by 8 */ unsigned msgOffs, hdrOffs; - unsigned maxPktLen, pktLen; + unsigned maxPktLen, pktLen, udpPktLen; + u_int16_t ip_id; DEFiRet; if(pWrkrData->pSockArray == NULL) { @@ -392,8 +390,12 @@ pWrkrData->sourcePort = pData->sourcePortStart; } - inet_pton(AF_INET, (char*)pszSourcename, &(source_ip.sin_addr)); + /* We need a non-zero id number for the IP headers, + * otherwise libnet will increase it after each + * build_ipv4, breaking the fragments */ + ip_id = (u_int16_t)libnet_get_prand(LIBNET_PR16); + inet_pton(AF_INET, (char*)pszSourcename, &(source_ip.sin_addr)); bSendSuccess = RSFALSE; d_pthread_mutex_lock(&mutLibnet); bNeedUnlock = 1; @@ -408,47 +410,54 @@ if(len > (maxPktLen - LIBNET_UDP_H) ) { hdrOffs = IP_MF; pktLen = maxPktLen - LIBNET_UDP_H; + udpPktLen = len; } else { hdrOffs = 0; pktLen = len; + udpPktLen = len; } - DBGPRINTF("omudpspoof: stage 1: MF:%d, hdrOffs %d, pktLen %d\n", - (hdrOffs & IP_MF) >> 13, (hdrOffs & 0x1FFF) << 3, pktLen); + DBGPRINTF("omudpspoof: stage 1: MF:%d, msgOffs %d, hdrOffs %d, pktLen %d, udpPktLen %d, maxPktLen %d\n", + (hdrOffs & IP_MF) >> 13, (hdrOffs & 0x1FFF) << 3, hdrOffs, pktLen, udpPktLen, maxPktLen); libnet_clear_packet(pWrkrData->libnet_handle); + /* note: libnet does need ports in host order NOT in network byte order! -- rgerhards, 2009-11-12 */ udp = libnet_build_udp( - pWrkrData->sourcePort, /* source port */ - ntohs(tempaddr->sin_port),/* destination port */ - pktLen+LIBNET_UDP_H, /* packet length */ - 0, /* checksum */ - (u_char*)msg, /* payload */ - pktLen, /* payload size */ + pWrkrData->sourcePort, /* source port */ + ntohs(tempaddr->sin_port), /* destination port */ + udpPktLen+LIBNET_UDP_H, /* packet length - use the FULL UDP Packet Length here */ + 0, /* checksum */ + (u_char*)msg, /* payload */ + pktLen, /* payload size */ pWrkrData->libnet_handle, /* libnet handle */ - udp); /* libnet id */ + udp); /* libnet id */ if (udp == -1) { DBGPRINTF("omudpspoof: can't build UDP header: %s\n", libnet_geterror(pWrkrData->libnet_handle)); } ip = libnet_build_ipv4( - LIBNET_IPV4_H+LIBNET_UDP_H+pktLen, /* length */ - 0, /* TOS */ - 242, /* IP ID */ - hdrOffs, /* IP Frag */ - 64, /* TTL */ - IPPROTO_UDP, /* protocol */ - 0, /* checksum */ + LIBNET_IPV4_H+LIBNET_UDP_H+pktLen, /* length */ + 0, /* TOS */ + ip_id, /* IP ID */ + hdrOffs, /* IP Frag */ + 64, /* TTL */ + IPPROTO_UDP, /* protocol */ + 0, /* checksum */ source_ip.sin_addr.s_addr, tempaddr->sin_addr.s_addr, - NULL, /* payload */ - 0, /* payload size */ + NULL, /* payload */ + 0, /* payload size */ pWrkrData->libnet_handle, /* libnet handle */ - ip); /* libnet id */ + ip); /* libnet id */ if (ip == -1) { DBGPRINTF("omudpspoof: can't build IP header: %s\n", libnet_geterror(pWrkrData->libnet_handle)); } + // Disable UDP Checksum CALC if Packjet exceeds MTU + if(len > (maxPktLen - LIBNET_UDP_H) ) { + libnet_toggle_checksum(pWrkrData->libnet_handle, udp, 1); + } /* Write it to the wire. */ lsent = libnet_write(pWrkrData->libnet_handle); if(lsent != (int) (LIBNET_IPV4_H+LIBNET_UDP_H+pktLen)) { @@ -488,7 +497,7 @@ ip = libnet_build_ipv4( LIBNET_IPV4_H + pktLen, /* length */ 0, /* TOS */ - 242, /* IP ID */ + ip_id, /* IP ID */ hdrOffs, /* IP Frag */ 64, /* TTL */ IPPROTO_UDP, /* protocol */ @@ -596,7 +605,6 @@ RETiRet; } - BEGINtryResume CODESTARTtryResume iRet = doTryResume(pWrkrData); diff -Nru rsyslog-8.2001.0/rsyslog.service.in rsyslog-8.2006.0/rsyslog.service.in --- rsyslog-8.2001.0/rsyslog.service.in 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/rsyslog.service.in 2020-06-22 12:57:15.000000000 +0000 @@ -1,8 +1,10 @@ [Unit] Description=System Logging Service -Requires=syslog.socket +;Requires=syslog.socket +Wants=network.target network-online.target +After=network.target network-online.target Documentation=man:rsyslogd(8) -Documentation=https://www.rsyslog.com/doc/ +Documentation=http://www.rsyslog.com/doc/ [Service] Type=notify @@ -16,4 +18,4 @@ [Install] WantedBy=multi-user.target -Alias=syslog.service +;Alias=syslog.service diff -Nru rsyslog-8.2001.0/runtime/cfsysline.c rsyslog-8.2006.0/runtime/cfsysline.c --- rsyslog-8.2001.0/runtime/cfsysline.c 2019-12-27 16:19:58.000000000 +0000 +++ rsyslog-8.2006.0/runtime/cfsysline.c 2020-05-28 10:29:49.000000000 +0000 @@ -3,7 +3,7 @@ * * File begun on 2007-07-30 by RGerhards * - * Copyright (C) 2007-2016 Adiscon GmbH. + * Copyright (C) 2007-2020 Adiscon GmbH. * * This file is part of rsyslog. * @@ -41,6 +41,7 @@ #include "errmsg.h" #include "srUtils.h" #include "unicode-helper.h" +#include "rsconf.h" #include "parserif.h" @@ -352,8 +353,13 @@ assert(*pp != NULL); if(getSubString(pp, (char*) szName, sizeof(szName), ' ') != 0) { - LogError(0, RS_RET_NOT_FOUND, "could not extract group name"); - ABORT_FINALIZE(RS_RET_NOT_FOUND); + if(loadConf->globals.abortOnIDResolutionFail) { + fprintf(stderr, "could not extract group name: %s\n", (char*)szName); + exit(1); /* good exit */ + } else { + LogError(0, RS_RET_NOT_FOUND, "could not extract group name"); + ABORT_FINALIZE(RS_RET_NOT_FOUND); + } } do { @@ -374,6 +380,10 @@ LogError(0, RS_RET_NOT_FOUND, "ID for group '%s' could not be found", szName); } iRet = RS_RET_NOT_FOUND; + if(loadConf->globals.abortOnIDResolutionFail) { + fprintf(stderr, "ID for group '%s' could not be found or error\n", szName); + exit(1); /* good exit */ + } } else { if(pSetHdlr == NULL) { /* we should set value directly to var */ @@ -408,15 +418,25 @@ assert(*pp != NULL); if(getSubString(pp, (char*) szName, sizeof(szName), ' ') != 0) { - LogError(0, RS_RET_NOT_FOUND, "could not extract user name"); - ABORT_FINALIZE(RS_RET_NOT_FOUND); + if(loadConf->globals.abortOnIDResolutionFail) { + fprintf(stderr, "could not extract user name: %s\n", (char*)szName); + exit(1); /* good exit */ + } else { + LogError(0, RS_RET_NOT_FOUND, "could not extract user name"); + ABORT_FINALIZE(RS_RET_NOT_FOUND); + } } getpwnam_r((char*)szName, &pwBuf, stringBuf, sizeof(stringBuf), &ppwBuf); if(ppwBuf == NULL) { - LogError(0, RS_RET_NOT_FOUND, "ID for user '%s' could not be found or error", (char*)szName); - iRet = RS_RET_NOT_FOUND; + if(loadConf->globals.abortOnIDResolutionFail) { + fprintf(stderr, "ID for user '%s' could not be found or error\n", (char*)szName); + exit(1); /* good exit */ + } else { + LogError(0, RS_RET_NOT_FOUND, "ID for user '%s' could not be found or error", (char*)szName); + iRet = RS_RET_NOT_FOUND; + } } else { if(pSetHdlr == NULL) { /* we should set value directly to var */ diff -Nru rsyslog-8.2001.0/runtime/errmsg.c rsyslog-8.2006.0/runtime/errmsg.c --- rsyslog-8.2001.0/runtime/errmsg.c 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/runtime/errmsg.c 2020-05-28 10:29:49.000000000 +0000 @@ -270,8 +270,10 @@ errmsgDoHUP(void) { pthread_mutex_lock(&oversizeMsgLogMut); - close(fdOversizeMsgLog); - fdOversizeMsgLog = -1; + if(fdOversizeMsgLog != -1) { + close(fdOversizeMsgLog); + fdOversizeMsgLog = -1; + } pthread_mutex_unlock(&oversizeMsgLogMut); } diff -Nru rsyslog-8.2001.0/runtime/glbl.c rsyslog-8.2006.0/runtime/glbl.c --- rsyslog-8.2001.0/runtime/glbl.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/glbl.c 2020-06-22 12:57:15.000000000 +0000 @@ -7,7 +7,7 @@ * * Module begun 2008-04-16 by Rainer Gerhards * - * Copyright 2008-2019 Rainer Gerhards and Adiscon GmbH. + * Copyright 2008-2020 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -144,6 +144,7 @@ int glblDbgWhitelist = 1; int glblPermitCtlC = 0; int glblInputTimeoutShutdown = 1000; /* input shutdown timeout in ms */ +int glblShutdownQueueDoubleSize = 0; static const uchar * operatingStateFile = NULL; uint64_t glblDevOptions = 0; /* to be used by developers only */ @@ -209,6 +210,7 @@ { "environment", eCmdHdlrArray, 0 }, { "processinternalmessages", eCmdHdlrBinary, 0 }, { "umask", eCmdHdlrFileCreateMode, 0 }, + { "security.abortonidresolutionfail", eCmdHdlrBinary, 0 }, { "internal.developeronly.options", eCmdHdlrInt, 0 }, { "internalmsg.ratelimit.interval", eCmdHdlrPositiveInt, 0 }, { "internalmsg.ratelimit.burst", eCmdHdlrPositiveInt, 0 }, @@ -225,6 +227,7 @@ { "default.ruleset.queue.timeoutworkerthreadshutdown", eCmdHdlrInt, 0 }, { "reverselookup.cache.ttl.default", eCmdHdlrNonNegInt, 0 }, { "reverselookup.cache.ttl.enable", eCmdHdlrBinary, 0 }, + { "shutdown.queue.doublesize", eCmdHdlrBinary, 0 }, { "debug.files", eCmdHdlrArray, 0 }, { "debug.whitelist", eCmdHdlrBinary, 0 } }; @@ -1440,6 +1443,8 @@ glblInputTimeoutShutdown = (int) cnfparamvals[i].val.d.n; } else if(!strcmp(paramblk.descr[i].name, "privdrop.group.keepsupplemental")) { loadConf->globals.gidDropPrivKeepSupplemental = (int) cnfparamvals[i].val.d.n; + } else if(!strcmp(paramblk.descr[i].name, "security.abortonidresolutionfail")) { + loadConf->globals.abortOnIDResolutionFail = (int) cnfparamvals[i].val.d.n; } else if(!strcmp(paramblk.descr[i].name, "net.acladdhostnameonfail")) { *(net.pACLAddHostnameOnFail) = (int) cnfparamvals[i].val.d.n; } else if(!strcmp(paramblk.descr[i].name, "net.aclresolvehostname")) { @@ -1478,6 +1483,8 @@ qsort(glblDbgFiles, glblDbgFilesNum, sizeof(char*), qs_arrcmp_glblDbgFiles); } else if(!strcmp(paramblk.descr[i].name, "debug.whitelist")) { glblDbgWhitelist = (int) cnfparamvals[i].val.d.n; + } else if(!strcmp(paramblk.descr[i].name, "shutdown.queue.doublesize")) { + glblShutdownQueueDoubleSize = (int) cnfparamvals[i].val.d.n; } else if(!strcmp(paramblk.descr[i].name, "umask")) { loadConf->globals.umask = (int) cnfparamvals[i].val.d.n; } else if(!strcmp(paramblk.descr[i].name, "shutdown.enable.ctlc")) { diff -Nru rsyslog-8.2001.0/runtime/glbl.h rsyslog-8.2006.0/runtime/glbl.h --- rsyslog-8.2001.0/runtime/glbl.h 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/runtime/glbl.h 2020-06-22 12:57:15.000000000 +0000 @@ -79,7 +79,6 @@ SIMP_PROP(ParserEscape8BitCharactersOnReceive, int) SIMP_PROP(ParserEscapeControlCharacterTab, int) SIMP_PROP(ParserEscapeControlCharactersCStyle, int) - /* added v3, 2009-06-30 */ rsRetVal (*GenerateLocalHostNameProperty)(void); prop_t* (*GetLocalHostNameProp)(void); @@ -128,6 +127,7 @@ extern int glblInputTimeoutShutdown; extern int glblIntMsgsSeverityFilter; extern int bTerminateInputs; +extern int glblShutdownQueueDoubleSize; #ifndef HAVE_ATOMIC_BUILTINS extern DEF_ATOMIC_HELPER_MUT(mutTerminateInputs); #endif diff -Nru rsyslog-8.2001.0/runtime/lib_ksils12.c rsyslog-8.2006.0/runtime/lib_ksils12.c --- rsyslog-8.2001.0/runtime/lib_ksils12.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/lib_ksils12.c 2020-06-22 12:57:15.000000000 +0000 @@ -90,9 +90,14 @@ /* Worker queue item status identifier */ typedef enum QITEM_status_en { + /* State assigned to any item added to queue (initial state). */ QITEM_WAITING = 0x00, + + /* State assigned to #QITEM_SIGNATURE_REQUEST item when it is sent out. */ QITEM_SENT, - QITEM_DONE, + + /* State assigned to #QITEM_SIGNATURE_REQUEST item when request failed or succeeded. */ + QITEM_DONE } QITEM_status; @@ -102,8 +107,8 @@ QITEM_status status; KSI_DataHash *root; FILE *file; /* To keep track of the target signature file. */ - uint64_t intarg1; - uint64_t intarg2; + uint64_t intarg1; /* Block time limit or record count or not used. */ + uint64_t intarg2; /* Level of the sign request or not used. */ KSI_AsyncHandle *respHandle; int ksi_status; time_t request_time; @@ -113,6 +118,7 @@ static bool queueAddNewFile(rsksictx ctx, ksifile kf); static bool queueAddQuit(rsksictx ctx); static bool queueAddSignRequest(rsksictx ctx, ksifile kf, KSI_DataHash *root, unsigned level); +static int sigblkFinishKSINoSignature(ksifile ksi, const char *reason); void *signer_thread(void *arg); @@ -813,15 +819,29 @@ } } -static void create_signer_thread(rsksictx ctx) { - if (!ctx->thread_started) { +static int +create_signer_thread(rsksictx ctx) { + if (ctx->signer_state != SIGNER_STARTED) { if (pthread_mutex_init(&ctx->module_lock, 0)) report(ctx, "pthread_mutex_init: %s", strerror(errno)); ctx->signer_queue = ProtectedQueue_new(10); - if (pthread_create(&ctx->signer_thread, NULL, signer_thread, ctx)) + + ctx->signer_state = SIGNER_INIT; + if (pthread_create(&ctx->signer_thread, NULL, signer_thread, ctx)) { report(ctx, "pthread_mutex_init: %s", strerror(errno)); - ctx->thread_started = true; + ctx->signer_state = SIGNER_IDLE; + return RSGTE_INTERNAL; + } + + /* Lock until init. */ + while(*((volatile int*)&ctx->signer_state) & SIGNER_INIT); + + if (ctx->signer_state != SIGNER_STARTED) { + return RSGTE_INTERNAL; + } } + + return RSGTE_SUCCESS; } rsksictx @@ -830,7 +850,7 @@ ctx = calloc(1, sizeof (struct rsksictx_s)); KSI_CTX_new(&ctx->ksi_ctx); // TODO: error check (probably via a generic macro?) ctx->hasher = NULL; - ctx->hashAlg = KSI_HASHALG_SHA2_256; + ctx->hashAlg = KSI_getHashAlgorithmByName("default"); ctx->blockTimeLimit = 0; ctx->bKeepTreeHashes = false; ctx->bKeepRecordHashes = true; @@ -844,7 +864,7 @@ ctx->fCreateMode = 0644; ctx->fDirCreateMode = 0700; ctx->syncMode = LOGSIG_SYNCHRONOUS; - ctx->thread_started = false; + ctx->signer_state = SIGNER_IDLE; ctx->disabled = false; ctx->ksi = NULL; @@ -909,15 +929,14 @@ KSI_CTX_setOption(ctx->ksi_ctx, KSI_OPT_AGGR_HMAC_ALGORITHM, (void*)((size_t)ctx->hmacAlg)); - create_signer_thread(ctx); - - return res; + return create_signer_thread(ctx); } /* either returns ksifile object or NULL if something went wrong */ ksifile rsksiCtxOpenFile(rsksictx ctx, unsigned char *logfn) { + int ret = RSGTE_INTERNAL; ksifile ksi; char fn[MAXFNAME+1]; @@ -928,8 +947,14 @@ /* The thread cannot be be created in rsksiCtxNew because in daemon mode the process forks after rsksiCtxNew and the thread disappears */ - if (!ctx->thread_started) - rsksiInitModule(ctx); + if (ctx->signer_state != SIGNER_STARTED) { + ret = rsksiInitModule(ctx); + if (ret != RSGTE_SUCCESS) { + report(ctx, "Unable to init. KSI module, signing service disabled"); + ctx->disabled = true; + return NULL; + } + } if ((ksi = rsksifileConstruct(ctx)) == NULL) goto done; @@ -969,19 +994,23 @@ } -/* returns 0 on succes, 1 if algo is unknown, 2 is algo has been remove - * because it is now considered insecure +/* Returns RSGTE_SUCCESS on success, error code otherwise. If algo is unknown or + * is not trusted, default hash function is used. */ int rsksiSetHashFunction(rsksictx ctx, char *algName) { + if (ctx == NULL || algName == NULL) { + return RSGTE_INTERNAL; + } + int r, id = KSI_getHashAlgorithmByName(algName); if (!KSI_isHashAlgorithmSupported(id)) { report(ctx, "Hash function '%s' is not supported - using default", algName); - ctx->hashAlg = KSI_HASHALG_SHA2_256; + ctx->hashAlg = KSI_getHashAlgorithmByName("default"); } else { if(!KSI_isHashAlgorithmTrusted(id)) { report(ctx, "Hash function '%s' is not trusted - using default", algName); - ctx->hashAlg = KSI_HASHALG_SHA2_256; + ctx->hashAlg = KSI_getHashAlgorithmByName("default"); } else ctx->hashAlg = id; @@ -990,9 +1019,10 @@ if ((r = KSI_DataHasher_open(ctx->ksi_ctx, ctx->hashAlg, &ctx->hasher)) != KSI_OK) { reportKSIAPIErr(ctx, NULL, "KSI_DataHasher_open", r); ctx->disabled = true; + return r; } - return 0; + return RSGTE_SUCCESS; } int @@ -1000,11 +1030,11 @@ int id = KSI_getHashAlgorithmByName(algName); if (!KSI_isHashAlgorithmSupported(id)) { report(ctx, "HMAC function '%s' is not supported - using default", algName); - ctx->hmacAlg = KSI_HASHALG_SHA2_256; + ctx->hmacAlg = KSI_getHashAlgorithmByName("default"); } else { if(!KSI_isHashAlgorithmTrusted(id)) { report(ctx, "HMAC function '%s' is not trusted - using default", algName); - ctx->hmacAlg = KSI_HASHALG_SHA2_256; + ctx->hmacAlg = KSI_getHashAlgorithmByName("default"); } else ctx->hmacAlg = id; @@ -1045,7 +1075,7 @@ return r; } -/* This can only be used when signer thread has terminated. */ +/* This can only be used when signer thread has terminated or within the thread. */ static void rsksifileForceFree(ksifile ksi) { if (ksi == NULL) return; @@ -1059,7 +1089,7 @@ return; } -/* This can only be used when signer thread has terminated. */ +/* This can only be used when signer thread has terminated or within the thread. */ static void rsksictxForceFreeSignatures(rsksictx ctx) { size_t i = 0; @@ -1077,12 +1107,43 @@ return; } +/* This can only be used when signer thread has terminated or within the thread. */ +static int +rsksictxForceCloseWithoutSig(rsksictx ctx, const char *reason) { + size_t i = 0; + if (ctx == NULL || ctx->ksi == NULL) return RSGTE_INTERNAL; + for (i = 0; i < ctx->ksiCount; i++) { + if (ctx->ksi[i] != NULL) { + int ret = RSGTE_INTERNAL; + + /* Only if block contains records, create metadata, close the block and add + * no signature marker. Closing block without record will produce redundant + * blocks that needs to be signed afterward. + */ + if (ctx->ksi[i]->nRecords > 0) { + ret = sigblkFinishKSINoSignature(ctx->ksi[i], reason); + if (ret != RSGTE_SUCCESS) return ret; + } + + /* Free files and remove object from the list. */ + rsksifileForceFree(ctx->ksi[i]); + ctx->ksi[i] = NULL; + } + } + + ctx->ksiCount = 0; + return RSGTE_SUCCESS; +} + void rsksiCtxDel(rsksictx ctx) { if (ctx == NULL) return; - if (ctx->thread_started) { + /* Note that even in sync. mode signer thread is created and needs to be closed + * correctly. + */ + if (ctx->signer_state == SIGNER_STARTED) { queueAddQuit(ctx); /* Wait until thread closes to be able to safely free the resources. */ pthread_join(ctx->signer_thread, NULL); @@ -1397,16 +1458,21 @@ return level; } -int -sigblkFinishKSI(ksifile ksi) -{ - KSI_DataHash *root, *rootDel; - int8_t j; - int ret = 0; - unsigned level = 0; +static int +sigblkFinishTree(ksifile ksi, KSI_DataHash **hsh) { + int ret = RSGTE_INTERNAL; + KSI_DataHash *root = NULL; + KSI_DataHash *rootDel = NULL; + int8_t j = 0; + + if (ksi == NULL || hsh == NULL) { + goto done; + } - if (ksi->nRecords == 0) + if (ksi->nRecords == 0) { + ret = RSGTE_SUCCESS; goto done; + } root = NULL; for(j = 0 ; j < ksi->nRoots ; ++j) { @@ -1415,16 +1481,49 @@ ksi->roots[j] = NULL; } else if (ksi->roots[j] != NULL) { rootDel = root; + root = NULL; ret = sigblkHashTwoNodes(ksi, &root, ksi->roots[j], rootDel, j + 2); KSI_DataHash_free(ksi->roots[j]); ksi->roots[j] = NULL; KSI_DataHash_free(rootDel); - if(ksi->bKeepTreeHashes) + rootDel = NULL; + if(ksi->bKeepTreeHashes) { tlvWriteHashKSI(ksi, 0x0903, root); - if(ret != 0) goto done; /* checks hash_node_ksi() result! */ + } + if(ret != KSI_OK) goto done; /* checks sigblkHashTwoNodes() result! */ } } + *hsh = root; + root = NULL; + ret = RSGTE_SUCCESS; + +done: + KSI_DataHash_free(root); + KSI_DataHash_free(rootDel); + return ret; +} + + +int +sigblkFinishKSI(ksifile ksi) +{ + KSI_DataHash *root = NULL; + int ret = RSGTE_INTERNAL; + unsigned level = 0; + + if (ksi == NULL) { + goto done; + } + + if (ksi->nRecords == 0) { + ret = RSGTE_SUCCESS; + goto done; + } + + ret = sigblkFinishTree(ksi, &root); + if (ret != RSGTE_SUCCESS) goto done; + //Multiplying leaves count by 2 to account for blinding masks level=sigblkCalcLevel(2 * ksi->nRecords); @@ -1433,16 +1532,61 @@ ret = tlvWriteNoSigLS12(ksi->blockFile, ksi->nRecords, root, NULL); if (ret != KSI_OK) { reportKSIAPIErr(ksi->ctx, ksi, "tlvWriteNoSigLS12", ret); - ret = 1; + goto done; } queueAddSignRequest(ksi->ctx, ksi, root, level); + root = NULL; } else { sigblkSign(ksi, root, level); - KSI_DataHash_free(root); //otherwise delete it } + ret = RSGTE_SUCCESS; + +done: + KSI_DataHash_free(root); + free(ksi->IV); + ksi->IV = NULL; + ksi->bInBlk = 0; + return ret; +} + +static int +sigblkFinishKSINoSignature(ksifile ksi, const char *reason) +{ + KSI_DataHash *root = NULL; + int ret = RSGTE_INTERNAL; + + if (ksi == NULL || ksi->ctx == NULL || + (ksi->ctx->syncMode == LOGSIG_ASYNCHRONOUS && ksi->sigFile == NULL) || + ksi->blockFile == NULL || reason == NULL) { + goto done; + } + + ret = sigblkAddMetadata(ksi, blockCloseReason, reason); + if (ret != RSGTE_SUCCESS) goto done; + + ret = sigblkFinishTree(ksi, &root); + if (ret != RSGTE_SUCCESS) goto done; + + ret = tlvWriteNoSigLS12(ksi->blockFile, ksi->nRecords, root, reason); + if (ret != KSI_OK) { + reportKSIAPIErr(ksi->ctx, ksi, "tlvWriteNoSigLS12", ret); + goto done; + } + + if (ksi->ctx->syncMode == LOGSIG_ASYNCHRONOUS) { + ret = tlvWriteNoSigLS12(ksi->sigFile, ksi->nRecords, root, reason); + if (ret != KSI_OK) { + reportKSIAPIErr(ksi->ctx, ksi, "tlvWriteNoSigLS12", ret); + goto done; + } + } + + ret = RSGTE_SUCCESS; + done: + KSI_DataHash_free(root); free(ksi->IV); ksi->IV=NULL; ksi->bInBlk = 0; @@ -1720,6 +1864,45 @@ return ret; } +/* This can only be used when signer thread has terminated or within the thread. */ +static bool +rsksictxCloseAllPendingBlocksWithoutSignature(rsksictx ctx, const char *reason) { + bool ret = false; + QueueItem *item = NULL; + int res = KSI_OK; + + /* Save all consequent fulfilled responses in the front of the queue to the signature file */ + while(ProtectedQueue_count(ctx->signer_queue)) { + item = NULL; + ProtectedQueue_popFront(ctx->signer_queue, (void**) &item); + + if(item == NULL) { + continue; + } + + /* Skip non request queue item. */ + if(item->type == QITEM_SIGNATURE_REQUEST) { + res = tlvWriteNoSigLS12(item->file, item->intarg1, item->root, reason); + if (res != KSI_OK) { + reportKSIAPIErr(ctx, NULL, "tlvWriteNoSigLS12", res); + ret = false; + goto cleanup; + } + fflush(item->file); + } + + KSI_DataHash_free(item->root); + KSI_AsyncHandle_free(item->respHandle); + free(item); + } + + ret = true; + +cleanup: + return ret; +} + + static void request_async_config(rsksictx ctx, KSI_CTX *ksi_ctx, KSI_AsyncService *as) { KSI_Config *cfg = NULL; @@ -1761,13 +1944,13 @@ int res = 0; bool ret = false; int i = 0, endpoints = 0; - ctx->thread_started = true; CHECK_KSI_API(KSI_CTX_new(&ksi_ctx), ctx, "KSI_CTX_new"); CHECK_KSI_API(KSI_CTX_setAggregator(ksi_ctx, ctx->aggregatorUri, ctx->aggregatorId, ctx->aggregatorKey), ctx, "KSI_CTX_setAggregator"); + if(ctx->debugFile) { res = KSI_CTX_setLoggerCallback(ksi_ctx, rsksiStreamLogger, ctx->debugFile); if (res != KSI_OK) @@ -1809,6 +1992,7 @@ KSI_AsyncService_setOption(as, KSI_ASYNC_OPT_REQUEST_CACHE_SIZE, (void*) (ctx->max_requests)); + ctx->signer_state = SIGNER_STARTED; while (true) { timeout = 1; @@ -1853,6 +2037,16 @@ /* renew the config when opening a new file */ } else if (item->type == QITEM_QUIT) { free(item); + + /* Will look into work queue for pending KSI signatures and will output + * unsigned block marker instead of actual KSI signature to finalize this + * thread quickly. + */ + rsksictxCloseAllPendingBlocksWithoutSignature(ctx, + "Signing not finished due to sudden closure of lmsig_ksi-ls12 module."); + rsksictxForceCloseWithoutSig(ctx, + "Block closed due to sudden closure of lmsig_ksi-ls12 module."); + goto cleanup; } free(item); @@ -1860,9 +2054,11 @@ } cleanup: + KSI_AsyncService_free(as); KSI_CTX_free(ksi_ctx); - ctx->thread_started = false; + ctx->signer_state = SIGNER_STOPPED; + return NULL; } #pragma GCC diagnostic push diff -Nru rsyslog-8.2001.0/runtime/lib_ksils12.h rsyslog-8.2006.0/runtime/lib_ksils12.h --- rsyslog-8.2001.0/runtime/lib_ksils12.h 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/lib_ksils12.h 2020-06-05 10:06:07.000000000 +0000 @@ -49,6 +49,25 @@ LOGSIG_SYNCHRONOUS = 0x01 } LOGSIG_SyncMode; +enum { + /* Signer state assigned before the signer thread is initialized. State remains + * until thread initialization begins. In case of system failure to create new + * thread state remains the same. + */ + SIGNER_IDLE = 0x01, + + /* Signer state assigned while signer thread initialization is in progress. + */ + SIGNER_INIT = 0x02, + + /* Signer state assigned when signer thread is initialized and ready to work. + */ + SIGNER_STARTED = 0x04, + + /* Thread state assigned when signer thread is being closed (signer thread returns). + */ + SIGNER_STOPPED = 0x08 +}; /* Max number of roots inside the forest. This permits blocks of up to * 2^MAX_ROOTS records. We assume that 64 is sufficient for all use @@ -90,7 +109,7 @@ pthread_mutex_t module_lock; pthread_t signer_thread; ProtectedQueue *signer_queue; - bool thread_started; + int signer_state; uint8_t disabled; /* permits to disable the plugin --> set to 1 */ ksifile *ksi; /* List of signature files for keeping track of block timeouts. */ diff -Nru rsyslog-8.2001.0/runtime/lmsig_ksi-ls12.c rsyslog-8.2006.0/runtime/lmsig_ksi-ls12.c --- rsyslog-8.2001.0/runtime/lmsig_ksi-ls12.c 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/runtime/lmsig_ksi-ls12.c 2020-06-05 10:06:07.000000000 +0000 @@ -214,14 +214,17 @@ } } - if(rsksiSetHashFunction(pThis->ctx, hash ? hash : (char*) "SHA2-256") != KSI_OK) - goto finalize_it; + if(rsksiSetHashFunction(pThis->ctx, hash ? hash : (char*) "default") != KSI_OK) { + ABORT_FINALIZE(RS_RET_KSI_ERR); + } - if(rsksiSetHmacFunction(pThis->ctx, hmac ? hmac : (char*) "SHA2-256") != KSI_OK) - goto finalize_it; + if(rsksiSetHmacFunction(pThis->ctx, hmac ? hmac : (char*) "default") != KSI_OK) { + ABORT_FINALIZE(RS_RET_KSI_ERR); + } - if(rsksiSetAggregator(pThis->ctx, ag_uri, ag_loginid, ag_key) != KSI_OK) - goto finalize_it; + if(rsksiSetAggregator(pThis->ctx, ag_uri, ag_loginid, ag_key) != KSI_OK) { + ABORT_FINALIZE(RS_RET_KSI_ERR); + } finalize_it: free(ag_uri); diff -Nru rsyslog-8.2001.0/runtime/Makefile.am rsyslog-8.2006.0/runtime/Makefile.am --- rsyslog-8.2001.0/runtime/Makefile.am 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/runtime/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -295,7 +295,3 @@ lmsig_ksi_ls12_la_CPPFLAGS = $(RSRT_CFLAGS) $(GT_KSI_LS12_CFLAGS) lmsig_ksi_ls12_la_LDFLAGS = -module -avoid-version $(GT_KSI_LS12_LIBS) endif - -update-systemd: - curl http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c > sd-daemon.c - curl http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h > sd-daemon.h diff -Nru rsyslog-8.2001.0/runtime/Makefile.in rsyslog-8.2006.0/runtime/Makefile.in --- rsyslog-8.2001.0/runtime/Makefile.in 2020-01-14 12:59:36.000000000 +0000 +++ rsyslog-8.2006.0/runtime/Makefile.in 2020-06-22 12:58:14.000000000 +0000 @@ -1806,10 +1806,6 @@ .PRECIOUS: Makefile -update-systemd: - curl http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c > sd-daemon.c - curl http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h > sd-daemon.h - # 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 -Nru rsyslog-8.2001.0/runtime/modules.c rsyslog-8.2006.0/runtime/modules.c --- rsyslog-8.2001.0/runtime/modules.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/modules.c 2020-05-28 10:29:49.000000000 +0000 @@ -338,8 +338,8 @@ /* Add a module to the loaded module linked list */ -static void -addModToGlblList(modInfo_t *pThis) +static void ATTR_NONNULL() +addModToGlblList(modInfo_t *const pThis) { assert(pThis != NULL); @@ -951,6 +951,7 @@ { modInfo_t *pMod; + pthread_mutex_lock(&mutObjGlobalOp); pMod = GetNxt(NULL); while(pMod != NULL) { if(pMod->eType != eMOD_OUT && pMod->doHUP != NULL) { @@ -959,6 +960,7 @@ } pMod = GetNxt(pMod); /* done, go next */ } + pthread_mutex_unlock(&mutObjGlobalOp); } diff -Nru rsyslog-8.2001.0/runtime/nsd_ossl.c rsyslog-8.2006.0/runtime/nsd_ossl.c --- rsyslog-8.2001.0/runtime/nsd_ossl.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/nsd_ossl.c 2020-06-22 12:57:15.000000000 +0000 @@ -462,7 +462,7 @@ osslLastSSLErrorMsg(0, NULL, LOG_ERR, "osslGlblInit"); ABORT_FINALIZE(RS_RET_TLS_CERT_ERR); } - if(bHaveCert == 1 && SSL_CTX_use_certificate_file(ctx, certFile, SSL_FILETYPE_PEM) != 1) { + if(bHaveCert == 1 && SSL_CTX_use_certificate_chain_file(ctx, certFile) != 1) { LogError(0, RS_RET_TLS_CERT_ERR, "Error: Certificate could not be accessed. " "Check at least: 1) file path is correct, 2) file exist, " "3) permissions are correct, 4) file content is correct. " @@ -578,7 +578,7 @@ } else if(err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) { - DBGPRINTF("osslRecordRecv: SSL_get_error = %d\n", err); + DBGPRINTF("osslRecordRecv: SSL_get_error #1 = %d, lenRcvd=%zd\n", err, lenRcvd); /* Save errno */ local_errno = errno; @@ -593,7 +593,7 @@ ABORT_FINALIZE(RS_RET_NO_ERRCODE); } } else { - DBGPRINTF("osslRecordRecv: SSL_get_error = %d\n", err); + DBGPRINTF("osslRecordRecv: SSL_get_error #2 = %d, lenRcvd=%zd\n", err, lenRcvd); pThis->rtryCall = osslRtry_recv; pThis->rtryOsslErr = err; /* Store SSL ErrorCode into*/ ABORT_FINALIZE(RS_RET_RETRY); @@ -603,8 +603,8 @@ // TODO: Check if MORE retry logic needed? finalize_it: - dbgprintf("osslRecordRecv return. nsd %p, iRet %d, lenRcvd %d, lenRcvBuf %d, ptrRcvBuf %d\n", - pThis, iRet, (int) lenRcvd, pThis->lenRcvBuf, pThis->ptrRcvBuf); + dbgprintf("osslRecordRecv return. nsd %p, iRet %d, lenRcvd %zd, lenRcvBuf %d, ptrRcvBuf %d\n", + pThis, iRet, lenRcvd, pThis->lenRcvBuf, pThis->ptrRcvBuf); RETiRet; } @@ -619,7 +619,11 @@ if(!(pThis->ssl = SSL_new(ctx))) { pThis->ssl = NULL; osslLastSSLErrorMsg(0, pThis->ssl, LOG_ERR, "osslInitSession"); + ABORT_FINALIZE(RS_RET_NO_ERRCODE); } + + // Set SSL_MODE_AUTO_RETRY to SSL obj + SSL_set_mode(pThis->ssl, SSL_MODE_AUTO_RETRY); if (pThis->authMode != OSSL_AUTH_CERTANON) { dbgprintf("osslInitSession: enable certificate checking (Mode=%d, VerifyDepth=%d)\n", @@ -633,7 +637,7 @@ if (bAnonInit == 1) { /* no mutex needed, read-only after init */ /* Allow ANON Ciphers */ - #if OPENSSL_VERSION_NUMBER >= 0x10100000L + #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) /* NOTE: do never use: +eNULL, it DISABLES encryption! */ strncpy(pristringBuf, "ALL:+COMPLEMENTOFDEFAULT:+ADH:+ECDH:+aNULL@SECLEVEL=0", sizeof(pristringBuf)); @@ -968,6 +972,7 @@ { DEFiRet; DBGPRINTF("openssl: entering osslGlblExit\n"); + SSL_CTX_free(ctx); ENGINE_cleanup(); ERR_free_strings(); EVP_cleanup(); @@ -1018,8 +1023,6 @@ /* Session closed */ pThis->bHaveSess = 0; - SSL_free(pThis->ssl); - pThis->ssl = NULL; } RETiRet; @@ -1038,9 +1041,16 @@ PROTOTYPEobjDestruct(nsd_ossl); BEGINobjDestruct(nsd_ossl) /* be sure to specify the object type also in END and CODESTART macros! */ CODESTARTobjDestruct(nsd_ossl) + DBGPRINTF("nsd_ossl_destruct: [%p] Mode %d\n", pThis, pThis->iMode); if(pThis->iMode == 1) { osslEndSess(pThis); } + /* Free SSL obj also if we do not have a session - or are NOT in TLS mode! */ + if (pThis->ssl != NULL) { + DBGPRINTF("nsd_ossl_destruct: [%p] FREE pThis->ssl \n", pThis); + SSL_free(pThis->ssl); + pThis->ssl = NULL; + } if(pThis->pTcp != NULL) { nsd_ptcp.Destruct(&pThis->pTcp); @@ -1713,6 +1723,9 @@ ABORT_FINALIZE(RS_RET_NO_ERRCODE); } + // Set SSL_MODE_AUTO_RETRY to SSL obj + SSL_set_mode(pThis->ssl, SSL_MODE_AUTO_RETRY); + if (pThis->authMode != OSSL_AUTH_CERTANON) { dbgprintf("Connect: enable certificate checking (Mode=%d, VerifyDepth=%d)\n", pThis->authMode, pThis->DrvrVerifyDepth); @@ -1725,7 +1738,7 @@ if (bAnonInit == 1) { /* no mutex needed, read-only after init */ /* Allow ANON Ciphers */ - #if OPENSSL_VERSION_NUMBER >= 0x10100000L + #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) /* NOTE: do never use: +eNULL, it DISABLES encryption! */ strncpy(pristringBuf, "ALL:+COMPLEMENTOFDEFAULT:+ADH:+ECDH:+aNULL@SECLEVEL=0", sizeof(pristringBuf)); @@ -1789,7 +1802,7 @@ RETiRet; } else { dbgprintf("gnutlsPriorityString: set to '%s'\n", gnutlsPriorityString); -#if OPENSSL_VERSION_NUMBER >= 0x10002000L +#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) char *pCurrentPos; char *pNextPos; char *pszCmd; @@ -1859,8 +1872,8 @@ } #else dbgprintf("gnutlsPriorityString: set to '%s'\n", gnutlsPriorityString); - LogError(0, RS_RET_SYS_ERR, "Warning: OpenSSL Version too old to set gnutlsPriorityString ('%s')" - "by SSL_CONF_cmd API. For more see: " + LogError(0, RS_RET_SYS_ERR, "Warning: TLS library does not support SSL_CONF_cmd API" + "(maybe it is too old?). Cannot use gnutlsPriorityString ('%s'). For more see: " "https://www.rsyslog.com/doc/master/configuration/modules/imtcp.html#gnutlsprioritystring", gnutlsPriorityString); #endif diff -Nru rsyslog-8.2001.0/runtime/operatingstate.c rsyslog-8.2006.0/runtime/operatingstate.c --- rsyslog-8.2001.0/runtime/operatingstate.c 2019-10-02 06:22:02.000000000 +0000 +++ rsyslog-8.2006.0/runtime/operatingstate.c 2020-06-22 12:57:15.000000000 +0000 @@ -153,7 +153,7 @@ time(&tt); localtime_r(&tt, &tm); len = snprintf(buf, sizeof(buf)-1, "%d%2.2d%2.2d-%2.2d%2.2d%2.2d: %-5.5s %s\n", - tm.tm_year+1900, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, + tm.tm_year+1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tag, line); if(len > sizeof(buf)-1) { len = sizeof(buf)-1; /* overflow, truncate */ diff -Nru rsyslog-8.2001.0/runtime/queue.c rsyslog-8.2006.0/runtime/queue.c --- rsyslog-8.2001.0/runtime/queue.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/queue.c 2020-06-22 12:57:15.000000000 +0000 @@ -2801,6 +2801,10 @@ BEGINobjDestruct(qqueue) /* be sure to specify the object type also in END and CODESTART macros! */ CODESTARTobjDestruct(qqueue) DBGOPRINT((obj_t*) pThis, "shutdown: begin to destruct queue\n"); + if(glblShutdownQueueDoubleSize) { + pThis->iHighWtrMrk *= 2; + pThis->iMaxQueueSize *= 2; + } if(pThis->bQueueStarted) { /* shut down all workers * We do not need to shutdown workers when we are in enqueue-only mode or we are a @@ -3355,13 +3359,17 @@ "corrected to '%s'", pThis->pszSpoolDir); } } else if(!strcmp(pblk.descr[i].name, "queue.size")) { - pThis->iMaxQueueSize = pvals[i].val.d.n; - if(pThis->iMaxQueueSize > OVERSIZE_QUEUE_WATERMARK) { + if(pvals[i].val.d.n > 0x7fffffff) { + parser_warnmsg("queue.size higher than maximum (2147483647) - " + "corrected to maximum"); + pvals[i].val.d.n = 0x7fffffff; + } else if(pvals[i].val.d.n > OVERSIZE_QUEUE_WATERMARK) { parser_warnmsg("queue.size=%d is very large - is this " "really intended? More info at " "https://www.rsyslog.com/avoid-overly-large-in-memory-queues/", - pThis->iMaxQueueSize); + (int) pvals[i].val.d.n); } + pThis->iMaxQueueSize = pvals[i].val.d.n; } else if(!strcmp(pblk.descr[i].name, "queue.dequeuebatchsize")) { pThis->iDeqBatchSize = pvals[i].val.d.n; } else if(!strcmp(pblk.descr[i].name, "queue.mindequeuebatchsize")) { diff -Nru rsyslog-8.2001.0/runtime/ratelimit.c rsyslog-8.2006.0/runtime/ratelimit.c --- rsyslog-8.2001.0/runtime/ratelimit.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/ratelimit.c 2020-05-28 10:29:49.000000000 +0000 @@ -2,7 +2,7 @@ * support for rate-limiting sources, including "last message * repeated n times" processing. * - * Copyright 2012-2016 Rainer Gerhards and Adiscon GmbH. + * Copyright 2012-2020 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -210,19 +210,24 @@ { DEFiRet; rsRetVal localRet; + int severity = 0; *ppRepMsg = NULL; - if((pMsg->msgFlags & NEEDS_PARSING) != 0) { - if((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK) { - DBGPRINTF("Message discarded, parsing error %d\n", localRet); - ABORT_FINALIZE(RS_RET_DISCARDMSG); + if(ratelimit->bReduceRepeatMsgs || ratelimit->severity > 0) { + /* consider early parsing only if really needed */ + if((pMsg->msgFlags & NEEDS_PARSING) != 0) { + if((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK) { + DBGPRINTF("Message discarded, parsing error %d\n", localRet); + ABORT_FINALIZE(RS_RET_DISCARDMSG); + } + severity = pMsg->iSeverity; } } /* Only the messages having severity level at or below the * treshold (the value is >=) are subject to ratelimiting. */ - if(ratelimit->interval && (pMsg->iSeverity >= ratelimit->severity)) { + if(ratelimit->interval && (severity >= ratelimit->severity)) { char namebuf[512]; /* 256 for FGDN adn 256 for APPNAME should be enough */ snprintf(namebuf, sizeof namebuf, "%s:%s", getHOSTNAME(pMsg), getAPPNAME(pMsg, 0)); diff -Nru rsyslog-8.2001.0/runtime/rsconf.c rsyslog-8.2006.0/runtime/rsconf.c --- rsyslog-8.2001.0/runtime/rsconf.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/rsconf.c 2020-05-28 10:29:49.000000000 +0000 @@ -2,7 +2,7 @@ * * Module begun 2011-04-19 by Rainer Gerhards * - * Copyright 2011-2019 Adiscon GmbH. + * Copyright 2011-2020 Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -156,6 +156,7 @@ pThis->globals.maxErrMsgToStderr = -1; pThis->globals.umask = -1; pThis->globals.gidDropPrivKeepSupplemental = 0; + pThis->globals.abortOnIDResolutionFail = 1; pThis->templates.root = NULL; pThis->templates.last = NULL; pThis->templates.lastStatic = NULL; @@ -438,6 +439,16 @@ dbgprintf("cnf:global:obj: "); cnfobjPrint(o); + + /* We need to check for object disabling as early as here to cover most + * of them at once and avoid needless initializations + * - jvymazal 2020-02-12 + */ + if (nvlstChkDisabled(o->nvlst)) { + dbgprintf("object disabled by configuration\n"); + return; + } + switch(o->objType) { case CNFOBJ_GLOBAL: glblProcessCnf(o); diff -Nru rsyslog-8.2001.0/runtime/rsconf.h rsyslog-8.2006.0/runtime/rsconf.h --- rsyslog-8.2001.0/runtime/rsconf.h 2019-12-27 16:19:58.000000000 +0000 +++ rsyslog-8.2006.0/runtime/rsconf.h 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,6 @@ /* The rsconf object. It models a complete rsyslog configuration. * - * Copyright 2011-2016 Rainer Gerhards and Adiscon GmbH. + * Copyright 2011-2020 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -73,6 +73,7 @@ int uidDropPriv; /* user-id to which priveleges should be dropped to */ int gidDropPriv; /* group-id to which priveleges should be dropped to */ int gidDropPrivKeepSupplemental; /* keep supplemental groups when dropping? */ + int abortOnIDResolutionFail; int umask; /* umask to use */ uchar *pszConfDAGFile; /* name of config DAG file, non-NULL means generate one */ diff -Nru rsyslog-8.2001.0/runtime/stream.c rsyslog-8.2006.0/runtime/stream.c --- rsyslog-8.2001.0/runtime/stream.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/stream.c 2020-06-05 10:06:07.000000000 +0000 @@ -81,6 +81,7 @@ static rsRetVal strmFlushInternal(strm_t *pThis, int bFlushZip); static rsRetVal strmWrite(strm_t *__restrict__ const pThis, const uchar *__restrict__ const pBuf, const size_t lenBuf); +static rsRetVal strmOpenFile(strm_t *pThis); static rsRetVal strmCloseFile(strm_t *pThis); static void *asyncWriterThread(void *pPtr); static rsRetVal doZipWrite(strm_t *pThis, uchar *pBuf, size_t lenBuf, int bFlush); @@ -278,7 +279,10 @@ iFlags |= O_NONBLOCK; } + if(pThis->bAsyncWrite)d_pthread_mutex_lock(&pThis->mut); pThis->fd = open((char*)pThis->pszCurrFName, iFlags | O_LARGEFILE, pThis->tOpenMode); + if(pThis->bAsyncWrite) d_pthread_mutex_unlock(&pThis->mut); + const int errno_save = errno; /* dbgprintf can mangle it! */ DBGPRINTF("file '%s' opened as #%d with mode %d\n", pThis->pszCurrFName, pThis->fd, (int) pThis->tOpenMode); @@ -1136,10 +1140,14 @@ CHKiRet(cstrAppendCStr(pThis->prevMsgSegment, thisLine)); /* we could do this faster, but for now keep it simple */ } else { - len = currLineLen-(len-maxMsgSize); - for(int z=0; zprevMsgSegment, - thisLine->pBuf[z]); + if (cstrLen(pThis->prevMsgSegment) > maxMsgSize) { + len = 0; + } else { + len = currLineLen-(len-maxMsgSize); + for(int z=0; zprevMsgSegment, + thisLine->pBuf[z]); + } } finished = 1; *ppCStr = pThis->prevMsgSegment; @@ -1238,6 +1246,7 @@ */ static rsRetVal strmConstructFinalize(strm_t *pThis) { + pthread_mutexattr_t mutAttr; rsRetVal localRet; int i; DEFiRet; @@ -1283,7 +1292,12 @@ /* if we work asynchronously, we need a couple of synchronization objects */ if(pThis->bAsyncWrite) { - pthread_mutex_init(&pThis->mut, 0); + /* the mutex must be recursive, because objects may call into other + * object identifiers recursively. + */ + pthread_mutexattr_init(&mutAttr); + pthread_mutexattr_settype(&mutAttr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&pThis->mut, &mutAttr); pthread_cond_init(&pThis->notFull, 0); pthread_cond_init(&pThis->notEmpty, 0); pthread_cond_init(&pThis->isEmpty, 0); @@ -1766,8 +1780,6 @@ if(pThis->sType == STREAMTYPE_FILE_CIRCULAR) { CHKiRet(strmCheckNextOutputFile(pThis)); - } else if(pThis->iSizeLimit != 0) { - CHKiRet(doSizeLimitProcessing(pThis)); } finalize_it: @@ -2151,6 +2163,10 @@ if(pThis->iBufPtr == pThis->sIOBufSize) { CHKiRet(strmFlushInternal(pThis, 0)); /* get a new buffer for rest of data */ } + if(pThis->fd != -1 && pThis->iSizeLimit != 0) { /* Only check if fd already set */ + CHKiRet(doSizeLimitProcessing(pThis)); + } + finalize_it: if(pThis->bAsyncWrite) { diff -Nru rsyslog-8.2001.0/runtime/tcpsrv.c rsyslog-8.2006.0/runtime/tcpsrv.c --- rsyslog-8.2001.0/runtime/tcpsrv.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/runtime/tcpsrv.c 2020-05-28 10:29:49.000000000 +0000 @@ -552,6 +552,23 @@ static void RunCancelCleanup(void *arg) { + nspoll_t **ppPoll = (nspoll_t**) arg; + + if (*ppPoll != NULL) + nspoll.Destruct(ppPoll); + + /* Wait for any running workers to finish */ + pthread_mutex_lock(&wrkrMut); + DBGPRINTF("tcpsrv terminating, waiting for %d workers\n", wrkrRunning); + while(wrkrRunning > 0) { + pthread_cond_wait(&wrkrIdle, &wrkrMut); + } + pthread_mutex_unlock(&wrkrMut); +} + +static void +RunSelectCancelCleanup(void *arg) +{ nssel_t **ppSel = (nssel_t**) arg; if(*ppSel != NULL) @@ -684,7 +701,6 @@ // we need to query me->opSrv to avoid clang static // analyzer false positive! -- rgerhards, 2017-10-23 assert(glbl.GetGlobalInputTermState() == 1); - --wrkrRunning; break; } pthread_mutex_unlock(&wrkrMut); @@ -703,6 +719,20 @@ return NULL; } +/* This has been factored out from processWorkset() because + * pthread_cleanup_push() invokes setjmp() and this triggers the -Wclobbered + * warning for the iRet variable. + */ +static void +waitForWorkers(void) +{ + pthread_mutex_lock(&wrkrMut); + pthread_cleanup_push(mutexCancelCleanup, &wrkrMut); + while(wrkrRunning > 0) { + pthread_cond_wait(&wrkrIdle, &wrkrMut); + } + pthread_cleanup_pop(1); +} /* Process a workset, that is handle io. We become activated * from either select or epoll handler. We split the workload @@ -725,6 +755,11 @@ /* process self, save context switch */ iRet = processWorksetItem(pThis, pPoll, workset[numEntries-1].id, workset[numEntries-1].pUsr); } else { + /* No cancel handler needed here, since no cancellation + * points are executed while wrkrMut is locked. + * + * Re-evaluate this if you add a DBGPRINTF or something! + */ pthread_mutex_lock(&wrkrMut); /* check if there is a free worker */ for(i = 0 ; (i < wrkrMax) && ((wrkrInfo[i].pSrv != NULL) || (wrkrInfo[i].enabled == 0)) ; ++i) @@ -758,11 +793,7 @@ * rest of this module can not handle the concurrency introduced * by workers running during the epoll call. */ - pthread_mutex_lock(&wrkrMut); - while(wrkrRunning > 0) { - pthread_cond_wait(&wrkrIdle, &wrkrMut); - } - pthread_mutex_unlock(&wrkrMut); + waitForWorkers(); } finalize_it: @@ -790,11 +821,7 @@ ISOBJ_TYPE_assert(pThis, tcpsrv); - /* this is an endless loop - it is terminated by the framework canelling - * this thread. Thus, we also need to instantiate a cancel cleanup handler - * to prevent us from leaking anything. -- rgerhards, 20080-04-24 - */ - pthread_cleanup_push(RunCancelCleanup, (void*) &pSel); + pthread_cleanup_push(RunSelectCancelCleanup, (void*) &pSel); while(1) { CHKiRet(nssel.Construct(&pSel)); if(pThis->pszDrvrName != NULL) @@ -874,8 +901,7 @@ } } - /* note that this point is usually not reached */ - pthread_cleanup_pop(1); /* remove cleanup handler */ + pthread_cleanup_pop(1); /* execute and remove cleanup handler */ RETiRet; } @@ -892,7 +918,7 @@ { DEFiRet; int i; - int bFailed = FALSE; /* If set to TRUE, accept failed already */ + int bFailed; /* If set to TRUE, accept failed */ nsd_epworkset_t workset[128]; /* 128 is currently fixed num of concurrent requests */ int numEntries; nspoll_t *pPoll = NULL; @@ -910,10 +936,13 @@ } d_pthread_mutex_unlock(&wrkrMut); - /* this is an endless loop - it is terminated by the framework canelling - * this thread. Thus, we also need to instantiate a cancel cleanup handler - * to prevent us from leaking anything. -- rgerhards, 20080-04-24 + /* We try to terminate cleanly, but install a cancellation clean-up + * handler in case we are cancelled. */ + pthread_cleanup_push(RunCancelCleanup, (void*) &pPoll); + /* Reset iRet to avoid warning about it being clobbered by longjmp */ + iRet = RS_RET_OK; + if((localRet = nspoll.Construct(&pPoll)) == RS_RET_OK) { if(pThis->pszDrvrName != NULL) CHKiRet(nspoll.SetDrvrName(pPoll, pThis->pszDrvrName)); @@ -938,6 +967,7 @@ DBGPRINTF("Added listener %d\n", i); } + bFailed = FALSE; while(glbl.GetGlobalInputTermState() == 0) { numEntries = sizeof(workset)/sizeof(nsd_epworkset_t); localRet = nspoll.Wait(pPoll, -1, &numEntries, workset); @@ -978,8 +1008,8 @@ } finalize_it: - if(pPoll != NULL) - nspoll.Destruct(&pPoll); + pthread_cleanup_pop(1); + RETiRet; } diff -Nru rsyslog-8.2001.0/runtime/tcps_sess.c rsyslog-8.2006.0/runtime/tcps_sess.c --- rsyslog-8.2001.0/runtime/tcps_sess.c 2019-12-30 13:07:09.000000000 +0000 +++ rsyslog-8.2006.0/runtime/tcps_sess.c 2020-06-22 12:57:15.000000000 +0000 @@ -424,25 +424,26 @@ pThis->inputState = eInMsg; } } else if(pThis->inputState == eInMsgTruncating) { - if(( ((c == '\n') && !pThis->pSrv->bDisableLFDelim) - || ((pThis->pSrv->addtlFrameDelim != TCPSRV_NO_ADDTL_DELIMITER) - && (c == pThis->pSrv->addtlFrameDelim)) - ) && pThis->eFraming == TCP_FRAMING_OCTET_STUFFING) { - pThis->inputState = eAtStrtFram; + if(pThis->eFraming == TCP_FRAMING_OCTET_COUNTING) { + DBGPRINTF("DEBUG: TCP_FRAMING_OCTET_COUNTING eInMsgTruncating c=%c remain=%d\n", + c, pThis->iOctetsRemain); + + pThis->iOctetsRemain--; + if(pThis->iOctetsRemain < 1) { + pThis->inputState = eAtStrtFram; + } + } else { + if( ((c == '\n') && !pThis->pSrv->bDisableLFDelim) + || ((pThis->pSrv->addtlFrameDelim != TCPSRV_NO_ADDTL_DELIMITER) + && (c == pThis->pSrv->addtlFrameDelim)) + ) { + pThis->inputState = eAtStrtFram; + } } } else { assert(pThis->inputState == eInMsg); - 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 max msg size, we %s it\n", - pThis->pSrv->discardTruncatedMsg == 1 ? "truncate" : "split"); - defaultDoSubmitMessage(pThis, stTime, ttGenTime, pMultiSub); - ++(*pnMsgs); - if(pThis->pSrv->discardTruncatedMsg == 1) { - pThis->inputState = eInMsgTruncating; - FINALIZE; - } - } + DBGPRINTF("DEBUG: processDataRcvd c=%c remain=%d\n", + c, pThis->iOctetsRemain); if(( ((c == '\n') && !pThis->pSrv->bDisableLFDelim) || ((pThis->pSrv->addtlFrameDelim != TCPSRV_NO_ADDTL_DELIMITER) @@ -458,6 +459,23 @@ */ if(pThis->iMsg < iMaxLine) { *(pThis->pMsg + pThis->iMsg++) = c; + } else { + /* emergency, we now need to flush, no matter if we are at end of message or not... */ + DBGPRINTF("error: message received is larger than max msg size, we %s it - c=%x\n", + pThis->pSrv->discardTruncatedMsg == 1 ? "truncate" : "split", c); + defaultDoSubmitMessage(pThis, stTime, ttGenTime, pMultiSub); + ++(*pnMsgs); + if(pThis->pSrv->discardTruncatedMsg == 1) { + if (pThis->eFraming == TCP_FRAMING_OCTET_COUNTING) { + pThis->iOctetsRemain--; + if (pThis->iOctetsRemain == 0) { + pThis->inputState = eAtStrtFram; + FINALIZE; + } + } + pThis->inputState = eInMsgTruncating; + FINALIZE; + } } } diff -Nru rsyslog-8.2001.0/.tarball-version rsyslog-8.2006.0/.tarball-version --- rsyslog-8.2001.0/.tarball-version 2020-01-14 13:00:15.000000000 +0000 +++ rsyslog-8.2006.0/.tarball-version 2020-06-22 12:59:37.000000000 +0000 @@ -1 +1 @@ -8.2001.0 +8.2006.0 diff -Nru rsyslog-8.2001.0/tests/action-tx-errfile.sh rsyslog-8.2006.0/tests/action-tx-errfile.sh --- rsyslog-8.2001.0/tests/action-tx-errfile.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/action-tx-errfile.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,7 +6,7 @@ export SEQ_CHECK_OPTIONS=-i2 check_sql_data_ready() { mysql_get_data - seq_check --check-only + seq_check --check-only 0 $((NUMMESSAGES - 2)) } export QUEUE_EMPTY_CHECK_FUNC=check_sql_data_ready @@ -36,5 +36,5 @@ export EXPECTED="$(cat ${srcdir}/testsuites/action-tx-errfile.result)" cmp_exact ${RSYSLOG2_OUT_LOG} mysql_get_data -seq_check +seq_check 0 $((NUMMESSAGES - 2)) -i2 exit_test diff -Nru rsyslog-8.2001.0/tests/action-tx-single-processing.sh rsyslog-8.2006.0/tests/action-tx-single-processing.sh --- rsyslog-8.2001.0/tests/action-tx-single-processing.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/action-tx-single-processing.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,11 +1,11 @@ #!/bin/bash # part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init -export NUMMESSAGES=5000 +export NUMMESSAGES=2000 export SEQ_CHECK_OPTIONS=-i2 check_sql_data_ready() { mysql_get_data - seq_check --check-only + seq_check --check-only 0 $((NUMMESSAGES - 2)) } export QUEUE_EMPTY_CHECK_FUNC=check_sql_data_ready generate_conf @@ -34,5 +34,5 @@ shutdown_when_empty wait_shutdown mysql_get_data -seq_check +seq_check 0 $((NUMMESSAGES - 2)) exit_test diff -Nru rsyslog-8.2001.0/tests/arrayqueue.sh rsyslog-8.2006.0/tests/arrayqueue.sh --- rsyslog-8.2001.0/tests/arrayqueue.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/arrayqueue.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,12 +3,9 @@ # added 2009-05-20 by rgerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=40000 generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - # set spool locations and switch queue to disk-only mode $MainMsgQueueType FixedArray @@ -17,10 +14,8 @@ :msg, contains, "msgnum:" ?dynfile;outfmt ' startup - -# 40000 messages should be enough -injectmsg 0 40000 +injectmsg shutdown_when_empty wait_shutdown -seq_check 0 39999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/asynwr_deadlock_2.sh rsyslog-8.2006.0/tests/asynwr_deadlock_2.sh --- rsyslog-8.2001.0/tests/asynwr_deadlock_2.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/asynwr_deadlock_2.sh 2020-05-28 10:29:49.000000000 +0000 @@ -2,18 +2,16 @@ # This is test case from practice, with the version we introduced it, it # caused a deadlock on shutdown. I have added it to the test suite to automatically # detect such things in the future. +# a case known to have caused a deadlock in the past # # added 2010-03-17 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo ================================================================================ -echo TEST: \[asynwr_deadlock_2.sh\]: a case known to have caused a deadlock in the past . ${srcdir:=.}/diag.sh init -export CI_SHUTDOWN_QUEUE_EMPTY_CHECKS=20 # this test is notoriously slow... +export NUMMESSAGES=1 generate_conf add_conf ' $ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" @@ -23,17 +21,12 @@ $OMFileAsyncWriting on :msg, contains, "msgnum:" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' -# uncomment for debugging support: -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" -#export RSYSLOG_DEBUGLOG="log" startup -# just send one message -tcpflood -m1 -# sleep is important! need to make sure the instance is inactive -sleep 1 +tcpflood +wait_file_lines # wait to become inactive - important bug trigger contidion # now try shutdown. The actual test is if the process does hang here! echo "processing must continue soon" -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 0 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/asynwr_deadlock4.sh rsyslog-8.2006.0/tests/asynwr_deadlock4.sh --- rsyslog-8.2001.0/tests/asynwr_deadlock4.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/asynwr_deadlock4.sh 2020-05-28 10:29:49.000000000 +0000 @@ -10,7 +10,8 @@ # added 2010-03-18 by Rgerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init -export CI_SHUTDOWN_QUEUE_EMPTY_CHECKS=20 # this test is notoriously slow... +export NUMMESSAGES=20000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $ModLoad ../plugins/imtcp/.libs/imtcp @@ -31,8 +32,9 @@ startup # send 20000 messages, each close to 2K (non-randomized!), so that we can fill # the buffers and hopefully run into the "deadlock". -tcpflood -m20000 -d18 -P129 -i1 -f5 +tcpflood -m20000 -d18 -P129 -f5 shutdown_when_empty wait_shutdown -seq_check 1 20000 -E +export SEQ_CHECK_OPTIONS=-E +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/asynwr_timeout.sh rsyslog-8.2006.0/tests/asynwr_timeout.sh --- rsyslog-8.2001.0/tests/asynwr_timeout.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/asynwr_timeout.sh 2020-05-28 10:29:49.000000000 +0000 @@ -8,7 +8,7 @@ . ${srcdir:=.}/diag.sh init # send 35555 messages, make sure file size is not a multiple of # 10K, the buffer size! -export NUMMESSAGES=35555 +export NUMMESSAGES=15555 generate_conf add_conf ' $ModLoad ../plugins/imtcp/.libs/imtcp @@ -16,7 +16,7 @@ input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! +template(name="dynfile" type="string" string="'$RSYSLOG_OUT_LOG'") $OMFileFlushOnTXEnd off $OMFileFlushInterval 2 $OMFileIOBufferSize 10k @@ -26,10 +26,9 @@ startup tcpflood -m $NUMMESSAGES printf 'waiting for timeout to occur\n' -sleep 6 # GOOD SLEEP - we wait for the timeout! +sleep 15 # GOOD SLEEP - we wait for the timeout! long to take care of slow test machines... printf 'timeout should now have occurred - check file state\n' -seq_check # mow everything MUST be persisted +seq_check shutdown_when_empty wait_shutdown -seq_check # just a double-check that nothing is added twice exit_test diff -Nru rsyslog-8.2001.0/tests/chkseq.c rsyslog-8.2006.0/tests/chkseq.c --- rsyslog-8.2001.0/tests/chkseq.c 2020-01-12 16:28:38.000000000 +0000 +++ rsyslog-8.2006.0/tests/chkseq.c 2020-05-28 10:29:49.000000000 +0000 @@ -125,7 +125,7 @@ exit(1); } - for(i = start ; i < end+1 ; i += increment) { + for(i = start ; i <= end ; i += increment) { if(bHaveExtraData) { if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { scanfOK = 0; @@ -164,7 +164,7 @@ ++i; } if(val != i) { - if(val == i - 1 && dupsPermitted) { + if(val == i - increment && dupsPermitted) { --i; ++nDups; } else { @@ -174,8 +174,8 @@ } } - if(i - 1 != end) { - printf("only %d records in file, expected %d\n", i - 1, end); + if(i - increment != end) { + printf("lastrecord does not match. file: %d, expected %d\n", i - increment, end); exit(1); } diff -Nru rsyslog-8.2001.0/tests/CI/centos6-9.supp rsyslog-8.2006.0/tests/CI/centos6-9.supp --- rsyslog-8.2001.0/tests/CI/centos6-9.supp 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/CI/centos6-9.supp 2020-05-28 10:29:49.000000000 +0000 @@ -14,3 +14,19 @@ fun:destructAllActions fun:main } +{ + libcrypto issue - only seen on Centos 6 so pretty sure false positive + Memcheck:Leak + fun:malloc + fun:CRYPTO_malloc + fun:EC_KEY_new + fun:EC_KEY_new_by_curve_name + fun:osslAnonInit + fun:SetAuthMode + fun:LstnInit + fun:LstnInit + fun:LstnInit + fun:initTCPListener + fun:create_tcp_socket + fun:doOpenLstnSocks +} diff -Nru rsyslog-8.2001.0/tests/complex1.sh rsyslog-8.2006.0/tests/complex1.sh --- rsyslog-8.2001.0/tests/complex1.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/complex1.sh 2020-06-05 10:06:07.000000000 +0000 @@ -14,8 +14,6 @@ add_conf ' $MaxMessageSize 10k -$MainMsgQueueTimeoutEnqueue 5000 - $ModLoad ../plugins/imtcp/.libs/imtcp $MainMsgQueueTimeoutShutdown 10000 @@ -26,7 +24,7 @@ $Ruleset R13514 # queue params: $ActionQueueTimeoutShutdown 60000 -$ActionQueueTimeoutEnqueue 15000 +$ActionQueueTimeoutEnqueue 20000 $ActionQueueSize 5000 $ActionQueueSaveOnShutdown on $ActionQueueHighWaterMark 4900 @@ -50,7 +48,7 @@ $Ruleset R_PORT2 # queue params: $ActionQueueTimeoutShutdown 60000 -$ActionQueueTimeoutEnqueue 5000 +$ActionQueueTimeoutEnqueue 20000 $ActionQueueSize 5000 $ActionQueueSaveOnShutdown on $ActionQueueHighWaterMark 4900 @@ -76,7 +74,7 @@ $Ruleset R_PORT3 # queue params: $ActionQueueTimeoutShutdown 60000 -$ActionQueueTimeoutEnqueue 5000 +$ActionQueueTimeoutEnqueue 20000 $ActionQueueSize 5000 $ActionQueueSaveOnShutdown on $ActionQueueHighWaterMark 4900 diff -Nru rsyslog-8.2001.0/tests/diag.sh rsyslog-8.2006.0/tests/diag.sh --- rsyslog-8.2001.0/tests/diag.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/diag.sh 2020-06-22 12:57:15.000000000 +0000 @@ -451,6 +451,7 @@ fi } + # wait for rsyslogd startup ($1 is the instance) wait_startup() { wait_rsyslog_startup_pid $1 @@ -528,6 +529,33 @@ fi } + +# assign TCPFLOOD_PORT2 from port file +# $1 - port file +assign_tcpflood_port2() { + wait_file_exists "$1" + export TCPFLOOD_PORT2=$(cat "$1") + echo "TCPFLOOD_PORT2 now: $TCPFLOOD_PORT2" + if [ "$TCPFLOOD_PORT2" == "" ]; then + echo "TESTBENCH ERROR: TCPFLOOD_PORT2 not found!" + ls -l $RSYSLOG_DYNNAME* + exit 100 + fi +} +# assign RS_PORT from port file - this is meant as generic way to +# obtain additional port variables +# $1 - port file +assign_rs_port() { + wait_file_exists "$1" + export RS_PORT=$(cat "$1") + echo "RS_PORT now: $RS_PORT" + if [ "$RS_PORT" == "" ]; then + echo "TESTBENCH ERROR: RS_PORT not found!" + ls -l $RSYSLOG_DYNNAME* + exit 100 + fi +} + # wait for a file to exist, then export it's content to env var # intended to be used for very small files, e.g. listenPort files # $1 - env var name @@ -607,6 +635,18 @@ # TODO: some return state checking? (does it really make sense here?) } +# inject literal payload via our inject interface (imdiag) +injectmsg_literal() { + printf 'injecting msg payload: %s\n' "$1" + sed -e 's/^/injectmsg literal /g' <<< "$1" | $TESTTOOL_DIR/diagtalker -p$IMDIAG_PORT || error_exit $? +} + +# inject literal payload via our inject interface (imdiag) +injectmsg_file() { + printf 'injecting msg payload: %s\n' "$1" + sed -e 's/^/injectmsg literal /g' < "$1" | $TESTTOOL_DIR/diagtalker -p$IMDIAG_PORT || error_exit $? +} + # show the current main queue size. $1 is the instance. get_mainqueuesize() { @@ -701,7 +741,7 @@ shutdown_when_empty "" wait_shutdown "" - echo content_check_with_count failed, expected \"$1\" to occur $2 times, but found it "$count" times + echo "$(tb_timestamp)" content_check_with_count failed, expected \"$1\" to occur $2 times, but found it "$count" times echo file $RSYSLOG_OUT_LOG content is: if [ $(wc -l < "$RSYSLOG_OUT_LOG") -gt 10000 ]; then printf 'truncation, we have %d lines, which is way too much\n' \ @@ -715,11 +755,13 @@ fi error_exit 1 else - printf 'content_check_with_count have %d, wait for %d times (%d lines), msg: %s\n' \ - "$count" "$2" $(wc -l < "$RSYSLOG_OUT_LOG") "$1" + printf '%s content_check_with_count have %d, wait for %d times (%d lines), msg: %s\n' \ + "$(tb_timestamp)" "$count" "$2" $(wc -l < "$RSYSLOG_OUT_LOG") "$1" $TESTTOOL_DIR/msleep 1000 fi fi + printf '**** content_check_with_count DEBUG:\n' # rger: REMOVE ME when problems are fixed + cat -n "$RSYSLOG_OUT_LOG" done } @@ -1531,8 +1573,8 @@ dep_zk_url=http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.14/$RS_ZK_DOWNLOAD dep_zk_cached_file=$dep_cache_dir/$RS_ZK_DOWNLOAD -export RS_KAFKA_DOWNLOAD=kafka_2.12-2.2.0.tgz -dep_kafka_url=http://www-us.apache.org/dist/kafka/2.2.0/kafka_2.12-2.2.0.tgz +export RS_KAFKA_DOWNLOAD=kafka_2.12-2.5.0.tgz +dep_kafka_url=http://www-us.apache.org/dist/kafka/2.5.0/kafka_2.12-2.5.0.tgz dep_kafka_cached_file=$dep_cache_dir/$RS_KAFKA_DOWNLOAD if [ -z "$ES_DOWNLOAD" ]; then @@ -2000,7 +2042,7 @@ printf 'ElasticSearch: satisfying dependency %s from system cache.\n' "$ES_DOWNLOAD" cp /local_dep_cache/$ES_DOWNLOAD $dep_es_cached_file else - dep_es_url="https://artifacts.elastic.co/downloads/elasticsearch/$ES_DOWNLOAD" + dep_es_url="https://www.rsyslog.com/files/download/rsyslog/$ES_DOWNLOAD" printf 'ElasticSearch: satisfying dependency %s from %s\n' "$ES_DOWNLOAD" "$dep_es_url" wget -q $dep_es_url -O $dep_es_cached_file fi @@ -2268,8 +2310,8 @@ mysql --user=rsyslog --password=testbench --database $RSYSLOG_DYNNAME \ -e "truncate table SystemEvents;" # TEST ONLY: - mysql -s --user=rsyslog --password=testbench --database $RSYSLOG_DYNNAME \ - -e "select substring(Message,9,8) from SystemEvents;" + #mysql -s --user=rsyslog --password=testbench --database $RSYSLOG_DYNNAME \ + #-e "select substring(Message,9,8) from SystemEvents;" # END TEST printf 'mysql ready for test, database: %s\n' $RSYSLOG_DYNNAME } @@ -2279,14 +2321,16 @@ # note "-s" is required to suppress the select "field header" mysql -s --user=rsyslog --password=testbench --database $RSYSLOG_DYNNAME \ -e "select substring(Message,9,8) from SystemEvents;" \ - > $RSYSLOG_OUT_LOG + > $RSYSLOG_OUT_LOG 2> "$RSYSLOG_DYNNAME.mysqlerr" + grep -iv "Using a password on the command line interface can be insecure." < "$RSYSLOG_DYNNAME.mysqlerr" } # cleanup any temp data from mysql test # if we do not do this, we may run out of disk space # especially in container environment. mysql_cleanup_test() { - mysql --user=rsyslog --password=testbench -e "drop database $RSYSLOG_DYNNAME;" + mysql --user=rsyslog --password=testbench -e "drop database $RSYSLOG_DYNNAME;" \ + 2>&1 | grep -iv "Using a password on the command line interface can be insecure." } @@ -2295,14 +2339,6 @@ # $3 - file name # $4 - expected value first_column_sum_check() { - set -x - echo grep: - grep "$2" < "$3" - echo sed: - grep "$2" < "$3" | sed -e "$1" - echo akw: - grep "$2" < "$3" | sed -e "$1" | awk '{s+=$1} END {print s}' - set +x sum=$(grep "$2" < "$3" | sed -e "$1" | awk '{s+=$1} END {print s}') if [ "x${sum}" != "x$4" ]; then printf '\n============================================================\n' @@ -2384,6 +2420,39 @@ fi } +wait_for_stats_flush() { + echo "will wait for stats push" + emitmsg=0 + while [[ ! -f $1 ]]; do + if [ $((++emitmsg % 10)) == 0 ]; then + echo waiting for stats file "'$1'" to be created + fi + $TESTTOOL_DIR/msleep 100 + done + prev_count=$(grep -c 'BEGIN$' <$1) + new_count=$prev_count + start_loop="$(date +%s)" + emit_waiting=0 + while [[ "x$prev_count" == "x$new_count" ]]; do + # busy spin, because it allows as close timing-coordination + # in actual test run as possible + if [ $(date +%s) -gt $(( TB_STARTTEST + TB_TEST_MAX_RUNTIME )) ]; then + printf '%s ABORT! Timeout waiting on stats push\n' "$(tb_timestamp)" "$1" + error_exit 1 + else + # waiting for 1000 is heuristically "sufficiently but not too + # frequent" enough + if [ $((++emit_waiting)) == 1000 ]; then + printf 'still waiting for stats push...\n' + emit_waiting=0 + fi + fi + new_count=$(grep -c 'BEGIN$' <"$1") + done + echo "stats push registered" +} + + case $1 in 'init') $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason source set-envvars @@ -2419,13 +2488,13 @@ echo "hint: was init accidentally called twice?" exit 2 fi - export RSYSLOG_DYNNAME="rstb_$(./test_id $(basename $0))" + export RSYSLOG_DYNNAME="rstb_$(./test_id $(basename $0))$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 4 | head -n 1)" export RSYSLOG_OUT_LOG="${RSYSLOG_DYNNAME}.out.log" export RSYSLOG2_OUT_LOG="${RSYSLOG_DYNNAME}_2.out.log" export RSYSLOG_PIDBASE="${RSYSLOG_DYNNAME}:" # also used by instance 2! - export IMDIAG_PORT=13500 - export IMDIAG_PORT2=13501 - export TCPFLOOD_PORT=13514 + #export IMDIAG_PORT=13500 DELETE ME + #export IMDIAG_PORT2=13501 DELETE ME + #export TCPFLOOD_PORT=13514 DELETE ME # Extra Variables for Test statistic reporting export RSYSLOG_TESTNAME=$(basename $0) @@ -2503,23 +2572,6 @@ kill -9 $(cat $RSYSLOG_PIDBASE.pid) # note: we do not wait for the actual termination! ;; - 'injectmsg-litteral') # inject litteral-payload via our inject interface (imdiag) - echo injecting msg payload from: $2 - sed -e 's/^/injectmsg litteral /g' < "$2" | $TESTTOOL_DIR/diagtalker -p$IMDIAG_PORT || error_exit $? - # TODO: some return state checking? (does it really make sense here?) - ;; - 'assert-equal') - if [ "x$4" == "x" ]; then - tolerance=0 - else - tolerance=$4 - fi - result=$(echo $2 $3 $tolerance | awk 'function abs(v) { return v > 0 ? v : -v } { print (abs($1 - $2) <= $3) ? "PASSED" : "FAILED" }') - if [ $result != 'PASSED' ]; then - echo "Value '$2' != '$3' (within tolerance of $tolerance)" - error_exit 1 - fi - ;; 'ensure-no-process-exists') ps -ef | grep -v grep | grep -qF "$2" if [ "x$?" == "x0" ]; then @@ -2550,20 +2602,6 @@ echo blocking stats flush echo "awaitStatsReport block_again" | $TESTTOOL_DIR/diagtalker -p$IMDIAG_PORT || error_exit $? ;; - 'wait-for-stats-flush') - echo "will wait for stats push" - while [[ ! -f $2 ]]; do - echo waiting for stats file "'$2'" to be created - $TESTTOOL_DIR/msleep 100 - done - prev_count=$(grep -c 'BEGIN$' <$2) - new_count=$prev_count - while [[ "x$prev_count" == "x$new_count" ]]; do - # busy spin, because it allows as close timing-coordination in actual test run as possible - new_count=$(grep -c 'BEGIN$' <"$2") - done - echo "stats push registered" - ;; 'wait-for-dyn-stats-reset') echo "will wait for dyn-stats-reset" while [[ ! -f $2 ]]; do diff -Nru rsyslog-8.2001.0/tests/discard-rptdmsg.sh rsyslog-8.2006.0/tests/discard-rptdmsg.sh --- rsyslog-8.2001.0/tests/discard-rptdmsg.sh 2020-01-08 15:18:49.000000000 +0000 +++ rsyslog-8.2006.0/tests/discard-rptdmsg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,25 +1,20 @@ #!/bin/bash -# This file is part of the rsyslog project, released under GPLv3 -echo =============================================================================== -echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality +# testing discard-rptdmsg functionality when no repeated message is present +# This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") +template(name="outfmt" type="string" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") $RepeatedMsgReduction on :msg, contains, "00000001" ~ - -$template outfmt,"%msg:F,58:2%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile;outfmt +:msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup tcpflood -m10 -i1 -shutdown_when_empty # shut down rsyslogd when done processing messages +shutdown_when_empty wait_shutdown seq_check 2 10 exit_test diff -Nru rsyslog-8.2001.0/tests/discard-rptdmsg-vg.sh rsyslog-8.2006.0/tests/discard-rptdmsg-vg.sh --- rsyslog-8.2001.0/tests/discard-rptdmsg-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/discard-rptdmsg-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,35 +1,4 @@ #!/bin/bash -# This file is part of the rsyslog project, released under GPLv3 - -uname -if [ $(uname) = "FreeBSD" ] ; then - echo "This test currently does not work on FreeBSD." - exit 77 -fi - -echo =============================================================================== -echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - -$RepeatedMsgReduction on - -:msg, contains, "00000001" ~ - -$template outfmt,"%msg:F,58:2%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile;outfmt -' -startup_vg -tcpflood -m10 -i1 -# we need to give rsyslog a little time to settle the receiver -./msleep 1500 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown_vg -check_exit_vg -seq_check 2 10 -exit_test +# This file is part of the rsyslog project, released under ASL 2.0 +export USE_VALGRIND="YES" +source ${srcdir:-.}/discard-rptdmsg.sh diff -Nru rsyslog-8.2001.0/tests/discard.sh rsyslog-8.2006.0/tests/discard.sh --- rsyslog-8.2001.0/tests/discard.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/discard.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,28 +3,21 @@ # This test checks if discard works. It is not a perfect test but # will find at least segfaults and obviously not discarded messages. # added 2009-07-30 by Rgerhards -# This file is part of the rsyslog project, released under GPLv3 +# This file is part of the rsyslog project, released under ASL 2.0 # uncomment for debugging support: -echo =============================================================================== -echo \[discard.sh\]: testing discard functionality . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=10 generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - -:msg, contains, "00000001" ~ +:msg, contains, "00000000" ~ $template outfmt,"%msg:F,58:2%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! :msg, contains, "msgnum:" ?dynfile;outfmt ' startup -# 20000 messages should be enough - the disk test is slow enough ;) -sleep 4 -tcpflood -m10 -i1 -shutdown_when_empty # shut down rsyslogd when done processing messages +injectmsg +shutdown_when_empty wait_shutdown -seq_check 2 10 +seq_check 1 $((NUMMESSAGES-1)) exit_test diff -Nru rsyslog-8.2001.0/tests/diskqueue-fsync.sh rsyslog-8.2006.0/tests/diskqueue-fsync.sh --- rsyslog-8.2001.0/tests/diskqueue-fsync.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/diskqueue-fsync.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,20 +6,16 @@ # added 2009-06-09 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: -echo \[diskqueue-fsync.sh\]: testing queue disk-only mode, fsync case - -uname +. ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000 # 1000 messages should be enough - the disk fsync test is very slow! +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines if [ $(uname) = "SunOS" ] ; then echo "This test currently does not work on all flavors of Solaris." exit 77 fi -. ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - # set spool locations and switch queue to disk-only mode $WorkDirectory '$RSYSLOG_DYNNAME'.spool $MainMsgQueueSyncQueueFiles on @@ -32,9 +28,8 @@ :msg, contains, "msgnum:" ?dynfile;outfmt ' startup -# 1000 messages should be enough - the disk fsync test is very slow! -injectmsg 0 1000 -shutdown_when_empty # shut down rsyslogd when done processing messages +injectmsg +shutdown_when_empty wait_shutdown -seq_check 0 999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/diskqueue.sh rsyslog-8.2006.0/tests/diskqueue.sh --- rsyslog-8.2001.0/tests/diskqueue.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/diskqueue.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,12 +6,10 @@ # added 2009-04-17 by Rgerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=20000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - # set spool locations and switch queue to disk-only mode $WorkDirectory '$RSYSLOG_DYNNAME'.spool $MainMsgQueueFilename mainq @@ -25,10 +23,9 @@ action(type="omfile" file="'$RSYSLOG_DYNNAME.syslog.log'") ' startup -# 20000 messages should be enough - the disk test is slow enough ;) -tcpflood -m20000 +injectmsg shutdown_when_empty wait_shutdown -seq_check 0 19999 +seq_check check_not_present "spool.* open error" $RSYSLOG_DYNNAME.syslog.log exit_test diff -Nru rsyslog-8.2001.0/tests/dynfile_invalid2.sh rsyslog-8.2006.0/tests/dynfile_invalid2.sh --- rsyslog-8.2001.0/tests/dynfile_invalid2.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynfile_invalid2.sh 2020-05-28 10:29:49.000000000 +0000 @@ -9,9 +9,8 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:3%\n" $template dynfile,"%msg:F,58:2%.log" # complete name is in message @@ -20,9 +19,6 @@ $omfileFlushInterval 1 local0.* ?dynfile;outfmt ' -# uncomment for debugging support: -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" -#export RSYSLOG_DEBUGLOG="log" startup # we send handcrafted message. We have a dynafile cache of 4, and now send one message # each to fill up the cache. diff -Nru rsyslog-8.2001.0/tests/dynfile_invld_async.sh rsyslog-8.2006.0/tests/dynfile_invld_async.sh --- rsyslog-8.2001.0/tests/dynfile_invld_async.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynfile_invld_async.sh 2020-05-28 10:29:49.000000000 +0000 @@ -9,9 +9,8 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:3%\n" $template dynfile,"%msg:F,58:2%.log" # complete name is in message diff -Nru rsyslog-8.2001.0/tests/dynfile_invld_sync.sh rsyslog-8.2006.0/tests/dynfile_invld_sync.sh --- rsyslog-8.2001.0/tests/dynfile_invld_sync.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynfile_invld_sync.sh 2020-05-28 10:29:49.000000000 +0000 @@ -9,9 +9,8 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:3%\n" $template dynfile,"%msg:F,58:2%.log" # complete name is in message diff -Nru rsyslog-8.2001.0/tests/dynstats_ctr_reset.sh rsyslog-8.2006.0/tests/dynstats_ctr_reset.sh --- rsyslog-8.2001.0/tests/dynstats_ctr_reset.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_ctr_reset.sh 2020-05-28 10:29:49.000000000 +0000 @@ -26,11 +26,11 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_2 +injectmsg_file $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_2 wait_queueempty sleep 1 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_3 +injectmsg_file $srcdir/testsuites/dynstats_input_3 wait_queueempty sleep 1 echo doing shutdown diff -Nru rsyslog-8.2001.0/tests/dynstats-json.sh rsyslog-8.2006.0/tests/dynstats-json.sh --- rsyslog-8.2001.0/tests/dynstats-json.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats-json.sh 2020-05-28 10:29:49.000000000 +0000 @@ -26,10 +26,10 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/dynstats-json-vg.sh rsyslog-8.2006.0/tests/dynstats-json-vg.sh --- rsyslog-8.2001.0/tests/dynstats-json-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats-json-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -26,10 +26,10 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup_vg -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/dynstats_nometric.sh rsyslog-8.2006.0/tests/dynstats_nometric.sh --- rsyslog-8.2001.0/tests/dynstats_nometric.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_nometric.sh 2020-05-28 10:29:49.000000000 +0000 @@ -23,11 +23,11 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log wait_queueempty rm $srcdir/${RSYSLOG_DYNNAME}.out.stats.log issue_HUP #reopen stats file -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_empty_input +injectmsg_file $srcdir/testsuites/dynstats_empty_input wait_queueempty rst_msleep 1100 # wait for stats flush echo doing shutdown diff -Nru rsyslog-8.2001.0/tests/dynstats_overflow.sh rsyslog-8.2006.0/tests/dynstats_overflow.sh --- rsyslog-8.2001.0/tests/dynstats_overflow.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_overflow.sh 2020-05-28 10:29:49.000000000 +0000 @@ -25,10 +25,10 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log . $srcdir/diag.sh block-stats-flush -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_more_0 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_more_1 +injectmsg_file $srcdir/testsuites/dynstats_input_more_0 +injectmsg_file $srcdir/testsuites/dynstats_input_more_1 wait_queueempty . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it @@ -49,15 +49,15 @@ . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it . $srcdir/diag.sh await-stats-flush-after-block -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log first_column_sum_check 's/.*metrics_purged=//g' 'metrics_purged=' "${RSYSLOG_DYNNAME}.out.stats.log" 3 rm ${RSYSLOG_DYNNAME}.out.stats.log issue_HUP #reopen stats file -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log . $srcdir/diag.sh block-stats-flush -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_more_2 +injectmsg_file $srcdir/testsuites/dynstats_input_more_2 wait_queueempty . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it diff -Nru rsyslog-8.2001.0/tests/dynstats_overflow-vg.sh rsyslog-8.2006.0/tests/dynstats_overflow-vg.sh --- rsyslog-8.2001.0/tests/dynstats_overflow-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_overflow-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -27,10 +27,10 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup_vg -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log . $srcdir/diag.sh block-stats-flush -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_more_0 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_more_1 +injectmsg_file $srcdir/testsuites/dynstats_input_more_0 +injectmsg_file $srcdir/testsuites/dynstats_input_more_1 wait_queueempty . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it @@ -50,15 +50,15 @@ . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it . $srcdir/diag.sh await-stats-flush-after-block -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log first_column_sum_check 's/.*metrics_purged=\([0-9]*\)/\1/g' 'metrics_purged=' "${RSYSLOG_DYNNAME}.out.stats.log" 3 rm ${RSYSLOG_DYNNAME}.out.stats.log issue_HUP #reopen stats file -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log . $srcdir/diag.sh block-stats-flush -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_more_2 +injectmsg_file $srcdir/testsuites/dynstats_input_more_2 wait_queueempty . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it diff -Nru rsyslog-8.2001.0/tests/dynstats_prevent_premature_eviction.sh rsyslog-8.2006.0/tests/dynstats_prevent_premature_eviction.sh --- rsyslog-8.2001.0/tests/dynstats_prevent_premature_eviction.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_prevent_premature_eviction.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,8 +1,7 @@ #!/bin/bash +# test for ensuring metrics are not evicted before unused-ttl # added 2016-04-13 by singh.janmejay # This file is part of the rsyslog project, released under ASL 2.0 -echo =============================================================================== -echo \[dynstats_prevent_premature_eviction.sh\]: test for ensuring metrics are not evicted before unused-ttl . ${srcdir:=.}/diag.sh init generate_conf add_conf ' @@ -24,25 +23,23 @@ set $.increment_successful = -1; } -action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") +action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log rst_msleep 1000 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 rst_msleep 4000 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_2 +injectmsg_file $srcdir/testsuites/dynstats_input_2 rst_msleep 4000 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_3 +injectmsg_file $srcdir/testsuites/dynstats_input_3 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log content_check "foo 001 0" content_check "foo 006 0" -echo doing shutdown shutdown_when_empty -echo wait on shutdown wait_shutdown - # because dyn-accumulators for existing metrics were posted-to under a second, they should not have been evicted +# because dyn-accumulators for existing metrics were posted-to under a second, they should not have been evicted custom_content_check 'baz=2' "${RSYSLOG_DYNNAME}.out.stats.log" custom_content_check 'bar=1' "${RSYSLOG_DYNNAME}.out.stats.log" custom_content_check 'foo=3' "${RSYSLOG_DYNNAME}.out.stats.log" diff -Nru rsyslog-8.2001.0/tests/dynstats_prevent_premature_eviction-vg.sh rsyslog-8.2006.0/tests/dynstats_prevent_premature_eviction-vg.sh --- rsyslog-8.2001.0/tests/dynstats_prevent_premature_eviction-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_prevent_premature_eviction-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -27,16 +27,16 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup_vg -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log . $srcdir/diag.sh block-stats-flush -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_2 +injectmsg_file $srcdir/testsuites/dynstats_input_2 . $srcdir/diag.sh allow-single-stats-flush-after-block-and-wait-for-it -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_3 +injectmsg_file $srcdir/testsuites/dynstats_input_3 . $srcdir/diag.sh await-stats-flush-after-block wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log content_check "foo 001 0" content_check "foo 006 0" echo doing shutdown diff -Nru rsyslog-8.2001.0/tests/dynstats_reset.sh rsyslog-8.2006.0/tests/dynstats_reset.sh --- rsyslog-8.2001.0/tests/dynstats_reset.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_reset.sh 2020-05-28 10:29:49.000000000 +0000 @@ -25,12 +25,12 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log +injectmsg_file "$srcdir/testsuites/dynstats_input_1" rst_msleep 8100 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_2 +injectmsg_file "$srcdir/testsuites/dynstats_input_2" rst_msleep 8100 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_3 +injectmsg_file "$srcdir/testsuites/dynstats_input_3" rst_msleep 8100 wait_queueempty content_check "foo 001 0" diff -Nru rsyslog-8.2001.0/tests/dynstats_reset-vg.sh rsyslog-8.2006.0/tests/dynstats_reset-vg.sh --- rsyslog-8.2001.0/tests/dynstats_reset-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_reset-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -27,12 +27,12 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup_vg -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log +injectmsg_file $srcdir/testsuites/dynstats_input_1 rst_msleep 8100 #two seconds for unused-metrics to be kept under observation, another two them to be cleared off -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_2 +injectmsg_file $srcdir/testsuites/dynstats_input_2 rst_msleep 8100 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_3 +injectmsg_file $srcdir/testsuites/dynstats_input_3 rst_msleep 8100 wait_queueempty content_check "foo 001 0" diff -Nru rsyslog-8.2001.0/tests/dynstats_reset_without_pstats_reset.sh rsyslog-8.2006.0/tests/dynstats_reset_without_pstats_reset.sh --- rsyslog-8.2001.0/tests/dynstats_reset_without_pstats_reset.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats_reset_without_pstats_reset.sh 2020-05-28 10:29:49.000000000 +0000 @@ -26,11 +26,11 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_2 +injectmsg_file $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_2 wait_queueempty sleep 1 -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_3 +injectmsg_file $srcdir/testsuites/dynstats_input_3 wait_queueempty sleep 1 echo doing shutdown diff -Nru rsyslog-8.2001.0/tests/dynstats.sh rsyslog-8.2006.0/tests/dynstats.sh --- rsyslog-8.2001.0/tests/dynstats.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats.sh 2020-05-28 10:29:49.000000000 +0000 @@ -21,8 +21,8 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log +injectmsg_file $srcdir/testsuites/dynstats_input wait_queueempty content_check "foo 001 0" content_check "bar 002 0" diff -Nru rsyslog-8.2001.0/tests/dynstats-vg.sh rsyslog-8.2006.0/tests/dynstats-vg.sh --- rsyslog-8.2001.0/tests/dynstats-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/dynstats-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -23,8 +23,8 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup_vg -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log +injectmsg_file $srcdir/testsuites/dynstats_input wait_queueempty content_check "foo 001 0" content_check "bar 002 0" diff -Nru rsyslog-8.2001.0/tests/empty-ruleset.sh rsyslog-8.2006.0/tests/empty-ruleset.sh --- rsyslog-8.2001.0/tests/empty-ruleset.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/empty-ruleset.sh 2020-05-28 10:29:49.000000000 +0000 @@ -2,14 +2,17 @@ # Copyright 2014-11-20 by Rainer Gerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init -export TCPFLOOD_PORT2="$(get_free_port)" +custom_wait_file_lines() { + wait_file_lines "$RSYSLOG_OUT_LOG" 10000 +} +export QUEUE_EMPTY_CHECK_FUNC=custom_wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") $MainMsgQueueTimeoutShutdown 10000 input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="real") -input(type="imtcp" port="'$TCPFLOOD_PORT2'" ruleset="empty") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port2" ruleset="empty") $template outfmt,"%msg:F,58:2%\n" @@ -21,10 +24,11 @@ } ' startup +assign_tcpflood_port2 "${RSYSLOG_DYNNAME}.tcpflood_port2" tcpflood -p$TCPFLOOD_PORT2 -m5000 -i0 # these should NOT show up tcpflood -p$TCPFLOOD_PORT -m10000 -i5000 tcpflood -p$TCPFLOOD_PORT2 -m500 -i15000 # these should NOT show up -shutdown_when_empty # shut down rsyslogd when done processing messages +shutdown_when_empty wait_shutdown seq_check 5000 14999 exit_test diff -Nru rsyslog-8.2001.0/tests/es-basic-ha.sh rsyslog-8.2006.0/tests/es-basic-ha.sh --- rsyslog-8.2001.0/tests/es-basic-ha.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/es-basic-ha.sh 2020-05-28 10:29:49.000000000 +0000 @@ -24,7 +24,7 @@ startup injectmsg 0 100 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log shutdown_when_empty wait_shutdown es_getdata 100 19200 diff -Nru rsyslog-8.2001.0/tests/es-bulk-retry.sh rsyslog-8.2006.0/tests/es-bulk-retry.sh --- rsyslog-8.2001.0/tests/es-bulk-retry.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/es-bulk-retry.sh 2020-05-28 10:29:49.000000000 +0000 @@ -124,6 +124,7 @@ success=50 badarg=50 injectmsg 0 $NUMMESSAGES +./msleep 1500; cat $RSYSLOG_OUT_LOG # debuging - we sometimes miss 1 message wait_content '"response.success": 50' $RSYSLOG_DYNNAME.spool/es-stats.log shutdown_when_empty wait_shutdown diff -Nru rsyslog-8.2001.0/tests/es_response_get_msgnum.py rsyslog-8.2006.0/tests/es_response_get_msgnum.py --- rsyslog-8.2001.0/tests/es_response_get_msgnum.py 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/es_response_get_msgnum.py 2020-05-28 10:29:49.000000000 +0000 @@ -5,4 +5,4 @@ json_data = json.load(json_file) json_data = json_data["hits"] for item in json_data["hits"]: - print(item["_source"]["msgnum"]) + print(item["_source"]["msgnum"]) diff -Nru rsyslog-8.2001.0/tests/es-writeoperation.sh rsyslog-8.2006.0/tests/es-writeoperation.sh --- rsyslog-8.2001.0/tests/es-writeoperation.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/es-writeoperation.sh 2020-05-28 10:29:49.000000000 +0000 @@ -86,10 +86,11 @@ ' init_elasticsearch -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" -#export RSYSLOG_DEBUGLOG="debug.log" + +export QUEUE_EMPTY_CHECK_FUNC=es_shutdown_empty_check +export NUMMESSAGES=1 startup -injectmsg 0 1 +injectmsg shutdown_when_empty wait_shutdown es_getdata 1 $ES_PORT diff -Nru rsyslog-8.2001.0/tests/execonlyonce.sh rsyslog-8.2006.0/tests/execonlyonce.sh --- rsyslog-8.2001.0/tests/execonlyonce.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/execonlyonce.sh 2020-05-28 10:29:49.000000000 +0000 @@ -10,9 +10,8 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" template(name="dynfile" type="string" string="'$RSYSLOG_OUT_LOG'") @@ -22,6 +21,7 @@ startup tcpflood -m10 -i1 # now wait until the interval definitely expires (at least we hope so...) +printf 'wainting for interval to expire...\n' sleep 5 # and inject another couple of messages tcpflood -m10 -i100 diff -Nru rsyslog-8.2001.0/tests/fac_authpriv.sh rsyslog-8.2006.0/tests/fac_authpriv.sh --- rsyslog-8.2001.0/tests/fac_authpriv.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_authpriv.sh 2020-05-28 10:29:49.000000000 +0000 @@ -4,17 +4,19 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" authpriv.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 81 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 81 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_ftp.sh rsyslog-8.2006.0/tests/fac_ftp.sh --- rsyslog-8.2001.0/tests/fac_ftp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_ftp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,17 +1,19 @@ #!/bin/bash # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" ftp.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 89 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 89 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_invld1.sh rsyslog-8.2006.0/tests/fac_invld1.sh --- rsyslog-8.2001.0/tests/fac_invld1.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_invld1.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,6 +3,8 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -12,8 +14,8 @@ invld.=debug action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 1011 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 1011 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_invld2.sh rsyslog-8.2006.0/tests/fac_invld2.sh --- rsyslog-8.2001.0/tests/fac_invld2.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_invld2.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,6 +3,8 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -12,8 +14,8 @@ invld.=debug action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 3500000000 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 3500000000 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_invld3.sh rsyslog-8.2006.0/tests/fac_invld3.sh --- rsyslog-8.2001.0/tests/fac_invld3.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_invld3.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,6 +3,8 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -12,8 +14,8 @@ invld.=debug action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P x112 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P x112 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_invld4_rfc5424.sh rsyslog-8.2006.0/tests/fac_invld4_rfc5424.sh --- rsyslog-8.2001.0/tests/fac_invld4_rfc5424.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_invld4_rfc5424.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,6 +3,8 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -12,8 +14,8 @@ invld.=debug action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -y -m1000 -P 8000000000000000000000000000000 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -y -m$NUMMESSAGES -P 8000000000000000000000000000000 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_local0.sh rsyslog-8.2006.0/tests/fac_local0.sh --- rsyslog-8.2001.0/tests/fac_local0.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_local0.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,6 +3,8 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -10,11 +12,11 @@ template(type="string" name="outfmt" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") if $syslogfacility-text == "local0" then - action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") + action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -tcpflood -m1000 -P 129 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 129 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_local0-vg.sh rsyslog-8.2006.0/tests/fac_local0-vg.sh --- rsyslog-8.2001.0/tests/fac_local0-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_local0-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,28 +1,4 @@ #!/bin/bash -# added 2016-10-14 by janmejay.singh - -# This file is part of the rsyslog project, released under ASL 2.0 - -uname -if [ $(uname) = "FreeBSD" ] ; then - echo "This test currently does not work on FreeBSD." - exit 77 -fi - -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - -template(type="string" name="outfmt" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") -if $syslogfacility-text == "local0" then - action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") -' -startup_vg -tcpflood -m1000 -P 129 -shutdown_when_empty -wait_shutdown_vg -check_exit_vg -seq_check 0 999 -exit_test +# addd 2020-01-19 by RGerhards, released under ASL 2.0 +export USE_VALGRIND="YES" +source ${srcdir:=.}/fac_local0.sh diff -Nru rsyslog-8.2001.0/tests/fac_local7.sh rsyslog-8.2006.0/tests/fac_local7.sh --- rsyslog-8.2001.0/tests/fac_local7.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_local7.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,8 +1,9 @@ #!/bin/bash # added 2014-09-24 by Rgerhards - # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -13,8 +14,8 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 185 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 185 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_mail.sh rsyslog-8.2006.0/tests/fac_mail.sh --- rsyslog-8.2001.0/tests/fac_mail.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_mail.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,8 +1,9 @@ #!/bin/bash # added 2014-09-17 by Rgerhards - # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -12,8 +13,8 @@ mail.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 17 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 17 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_news.sh rsyslog-8.2006.0/tests/fac_news.sh --- rsyslog-8.2001.0/tests/fac_news.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_news.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,8 +1,9 @@ #!/bin/bash # added 2014-09-17 by Rgerhards - # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -13,8 +14,8 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 57 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 57 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_ntp.sh rsyslog-8.2006.0/tests/fac_ntp.sh --- rsyslog-8.2001.0/tests/fac_ntp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_ntp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,17 +1,19 @@ #!/bin/bash # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" ntp.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 97 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 97 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/fac_uucp.sh rsyslog-8.2006.0/tests/fac_uucp.sh --- rsyslog-8.2001.0/tests/fac_uucp.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/fac_uucp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,6 +3,8 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=100 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -12,8 +14,8 @@ uucp.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -tcpflood -m1000 -P 65 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 999 +tcpflood -m$NUMMESSAGES -P 65 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/gzipwr_flushOnTXEnd.sh rsyslog-8.2006.0/tests/gzipwr_flushOnTXEnd.sh --- rsyslog-8.2001.0/tests/gzipwr_flushOnTXEnd.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/gzipwr_flushOnTXEnd.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,32 +1,32 @@ #!/bin/bash # This file is part of the rsyslog project, released under ASL 2.0 - -uname -if [ $(uname) = "FreeBSD" ] ; then - echo "This test currently does not work on FreeBSD." - exit 77 -fi - . ${srcdir:=.}/diag.sh init +skip_platform "FreeBSD" "This test currently does not work on FreeBSD" +export NUMMESSAGES=5000 # MUST be an even number generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") -template(name="outfmt" type="string" - string="%msg:F,58:2%\n") -:msg, contains, "msgnum:" action(type="omfile" template="outfmt" +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +:msg, contains, "msgnum:" { action(type="omfile" template="outfmt" zipLevel="6" ioBufferSize="256k" flushOnTXEnd="on" asyncWriting="on" - file=`echo $RSYSLOG_OUT_LOG`) + file="'$RSYSLOG_OUT_LOG'") + action(type="omfile" file="'$RSYSLOG_DYNNAME'.countlog") + } ' startup -tcpflood -m2500 -P129 +tcpflood -m$((NUMMESSAGES / 2)) -P129 wait_queueempty -gzip_seq_check 0 2499 -tcpflood -i2500 -m2500 -P129 +echo test 1 +wait_file_lines "$RSYSLOG_DYNNAME.countlog" $((NUMMESSAGES / 2 )) +gzip_seq_check 0 $((NUMMESSAGES / 2 - 1)) +tcpflood -i$((NUMMESSAGES / 2)) -m$((NUMMESSAGES / 2)) -P129 +echo test 2 +wait_file_lines "$RSYSLOG_DYNNAME.countlog" $NUMMESSAGES shutdown_when_empty wait_shutdown -gzip_seq_check 0 4999 +gzip_seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/gzipwr_hup.sh rsyslog-8.2006.0/tests/gzipwr_hup.sh --- rsyslog-8.2001.0/tests/gzipwr_hup.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/gzipwr_hup.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,6 +5,7 @@ export NUMMESSAGES=${NUMMESSAGES:-2000000} export COUNT_FILE_IS_ZIPPED=yes export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines +export TB_TEST_TIMEOUT=180 # test is slow due to large number of messages generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") diff -Nru rsyslog-8.2001.0/tests/gzipwr_hup_single_file.sh rsyslog-8.2006.0/tests/gzipwr_hup_single_file.sh --- rsyslog-8.2001.0/tests/gzipwr_hup_single_file.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/gzipwr_hup_single_file.sh 2020-05-28 10:29:49.000000000 +0000 @@ -30,9 +30,9 @@ startup ./tcpflood -p$TCPFLOOD_PORT -m$NUMMESSAGES & # TCPFlood needs to run async! for i in $(seq 0 20); do + ./msleep 10 printf '\nsending HUP %d\n' $i issue_HUP - ./msleep 10 done shutdown_when_empty wait_shutdown diff -Nru rsyslog-8.2001.0/tests/gzipwr_hup-vg.sh rsyslog-8.2006.0/tests/gzipwr_hup-vg.sh --- rsyslog-8.2001.0/tests/gzipwr_hup-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/gzipwr_hup-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,4 +1,4 @@ #!/bin/bash export USE_VALGRIND="YES" -export NUMMESSAGES=400000 # reduce for slower valgrind run +export NUMMESSAGES=200000 # reduce for slower valgrind run source ${srcdir:-.}/gzipwr_hup.sh diff -Nru rsyslog-8.2001.0/tests/imdocker-basic.sh rsyslog-8.2006.0/tests/imdocker-basic.sh --- rsyslog-8.2001.0/tests/imdocker-basic.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/imdocker-basic.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,7 +5,6 @@ NUMMESSAGES=1000 export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines export COOKIE=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) -#QUEUE_EMPTY_CHECK_FUNC=wait_seq_check generate_conf add_conf ' diff -Nru rsyslog-8.2001.0/tests/imdocker-long-logline.sh rsyslog-8.2006.0/tests/imdocker-long-logline.sh --- rsyslog-8.2001.0/tests/imdocker-long-logline.sh 2020-01-03 14:50:27.000000000 +0000 +++ rsyslog-8.2006.0/tests/imdocker-long-logline.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,11 +1,9 @@ #!/bin/bash # This is part of the rsyslog testbench, licensed under ASL 2.0 - # imdocker unit tests are enabled with --enable-imdocker-tests . ${srcdir:=.}/diag.sh init export COOKIE=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) SIZE=17000 - generate_conf add_conf ' template(name="outfmt" type="string" string="%msg%\n") @@ -19,16 +17,14 @@ $MaxMessageSize 64k ' - # launch container with a long log line docker run \ --name $COOKIE \ -e size=$SIZE \ alpine /bin/sh -c 'echo "$(yes a | head -n $size | tr -d "\n")";' > /dev/null -#export RS_REDIR=-d startup - +wait_file_lines "$RSYSLOG_OUT_LOG" 1 shutdown_when_empty wait_shutdown diff -Nru rsyslog-8.2001.0/tests/imfile-basic-vgthread.sh rsyslog-8.2006.0/tests/imfile-basic-vgthread.sh --- rsyslog-8.2001.0/tests/imfile-basic-vgthread.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imfile-basic-vgthread.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,13 +3,12 @@ . ${srcdir:=.}/diag.sh init skip_platform "FreeBSD" "This test currently does not work on FreeBSD." export NUMMESSAGES=50000 - -grep '\.el6\.' <<< $(uname -a) -if [ "$?" == "0" ]; then - echo "CentOS 6 detected, adding valgrind suppressions" +if grep -q 'release 6\.' <<< "$(cat /etc/redhat-release 2>/dev/null)"; then + echo "RHEL/CentOS 6 detected, adding valgrind suppressions" export RS_TEST_VALGRIND_EXTRA_OPTS="--suppressions=${srcdir}/imfile-basic-vgthread.supp" fi +exit generate_conf add_conf ' $ModLoad ../plugins/imfile/.libs/imfile @@ -27,7 +26,7 @@ # generate input file first. Note that rsyslog processes it as # soon as it start up (so the file should exist at that point). -./inputfilegen -m 50000 > $RSYSLOG_DYNNAME.input +./inputfilegen -m $NUMMESSAGES > $RSYSLOG_DYNNAME.input ls -l $RSYSLOG_DYNNAME.input startup_vgthread diff -Nru rsyslog-8.2001.0/tests/imfile-endregex-timeout-with-shutdown.sh rsyslog-8.2006.0/tests/imfile-endregex-timeout-with-shutdown.sh --- rsyslog-8.2001.0/tests/imfile-endregex-timeout-with-shutdown.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imfile-endregex-timeout-with-shutdown.sh 2020-05-28 10:29:49.000000000 +0000 @@ -4,9 +4,11 @@ . $srcdir/diag.sh check-inotify-only export IMFILECHECKTIMEOUT="60" +mkdir ${RSYSLOG_DYNNAME}.statefiles generate_conf add_conf ' -module(load="../plugins/imfile/.libs/imfile" timeoutGranularity="1") +module(load="../plugins/imfile/.libs/imfile" timeoutGranularity="1" + statefile.Directory="'${RSYSLOG_DYNNAME}'.statefiles") input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input" Tag="file:" PersistStateInterval="1" readTimeout="2" startmsg.regex="^[^ ]") @@ -18,7 +20,7 @@ } if $msg contains "msgnum:" then - action( type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") + action( type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup @@ -33,8 +35,10 @@ # we now do a stop and restart of rsyslog. This checks that everything # works across restarts. -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! +shutdown_when_empty +wait_shutdown + +# re-start (so we read persisted state file) startup # new data diff -Nru rsyslog-8.2001.0/tests/imfile-escapelf.replacement-empty.sh rsyslog-8.2006.0/tests/imfile-escapelf.replacement-empty.sh --- rsyslog-8.2001.0/tests/imfile-escapelf.replacement-empty.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imfile-escapelf.replacement-empty.sh 2020-03-30 09:33:29.000000000 +0000 @@ -0,0 +1,30 @@ +#!/bin/bash +# Written in 2019 by Rainer Gerhards +# This is part of the rsyslog testbench, licensed under ASL 2.0 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +global(workDirectory="'${RSYSLOG_DYNNAME}'.spool") +module(load="../plugins/imfile/.libs/imfile") +input(type="imfile" ruleset="output" escapelf.replacement="" + File="./'$RSYSLOG_DYNNAME'.input" tag="file:" startmsg.regex="^msg") + +template(name="outfmt" type="string" string="%msg%\n") +ruleset(name="output") { + action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") +} +' +# make sure file exists when rsyslog starts up +echo 'msg 1 part 1 + msg 1 part 2 +msg 2 +msg INVISIBLE by design' > $RSYSLOG_DYNNAME.input +startup +export NUMMESSAGES=2 +shutdown_when_empty +wait_shutdown +export EXPECTED='msg 1 part 1 msg 1 part 2 +msg 2' +cmp_exact +exit_test diff -Nru rsyslog-8.2001.0/tests/imfile-escapelf.replacement.sh rsyslog-8.2006.0/tests/imfile-escapelf.replacement.sh --- rsyslog-8.2001.0/tests/imfile-escapelf.replacement.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imfile-escapelf.replacement.sh 2020-03-30 09:33:29.000000000 +0000 @@ -0,0 +1,30 @@ +#!/bin/bash +# Written in 2019 by Rainer Gerhards +# This is part of the rsyslog testbench, licensed under ASL 2.0 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +global(workDirectory="'${RSYSLOG_DYNNAME}'.spool") +module(load="../plugins/imfile/.libs/imfile") +input(type="imfile" ruleset="output" escapelf.replacement="[LF]" + File="./'$RSYSLOG_DYNNAME'.input" tag="file:" startmsg.regex="^msg") + +template(name="outfmt" type="string" string="%msg%\n") +ruleset(name="output") { + action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") +} +' +# make sure file exists when rsyslog starts up +echo 'msg 1 part 1 + msg 1 part 2 +msg 2 +msg INVISIBLE by design' > $RSYSLOG_DYNNAME.input +startup +export NUMMESSAGES=2 +shutdown_when_empty +wait_shutdown +export EXPECTED='msg 1 part 1[LF] msg 1 part 2 +msg 2' +cmp_exact +exit_test diff -Nru rsyslog-8.2001.0/tests/imjournal-statefile.sh rsyslog-8.2006.0/tests/imjournal-statefile.sh --- rsyslog-8.2001.0/tests/imjournal-statefile.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imjournal-statefile.sh 2020-06-22 12:57:15.000000000 +0000 @@ -25,11 +25,22 @@ echo "SKIP: failed to put test into journal." error_exit 77 fi -journalctl -an 200 | fgrep -qF "$TESTMSG" + +# sleep 1 to get this test to reliably detect the message +sleep 1 + +journalctl -an 200 > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "SKIP: cannot read journal." error_exit 77 fi + +journalctl -an 200 | grep -qF "$TESTMSG" +if [ $? -ne 0 ]; then + echo "SKIP: cannot find '$TESTMSG' in journal." + error_exit 77 +fi + # do first run to process all the stuff already in journal db startup diff -Nru rsyslog-8.2001.0/tests/improg-multiline-test.py rsyslog-8.2006.0/tests/improg-multiline-test.py --- rsyslog-8.2001.0/tests/improg-multiline-test.py 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/improg-multiline-test.py 2020-05-28 10:29:49.000000000 +0000 @@ -1,5 +1,4 @@ -#!/usr/bin/env python - +# call this via "python[3] script name" import sys for _ in range(10): diff -Nru rsyslog-8.2001.0/tests/imptcp_addtlframedelim.sh rsyslog-8.2006.0/tests/imptcp_addtlframedelim.sh --- rsyslog-8.2001.0/tests/imptcp_addtlframedelim.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imptcp_addtlframedelim.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,22 +3,20 @@ # # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=20000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imptcp/.libs/imptcp -$MainMsgQueueTimeoutShutdown 10000 -$InputPTCPServerAddtlFrameDelimiter 0 -$InputPTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" + addtlFrameDelimiter="0") -$template outfmt,"%msg:F,58:2%\n" -$OMFileFlushOnTXEnd off -$OMFileFlushInterval 2 -$OMFileIOBufferSize 256k -local0.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +local0.* action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -tcpflood -m20000 -F0 -P129 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 19999 +tcpflood -m$NUMMESSAGES -F0 -P129 +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/imptcp_conndrop.sh rsyslog-8.2006.0/tests/imptcp_conndrop.sh --- rsyslog-8.2001.0/tests/imptcp_conndrop.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imptcp_conndrop.sh 2020-05-28 10:29:49.000000000 +0000 @@ -10,9 +10,8 @@ add_conf ' $MaxMessageSize 10k -$ModLoad ../plugins/imptcp/.libs/imptcp -$MainMsgQueueTimeoutShutdown 10000 -$InputPTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" template(name="dynfile" type="string" string="'$RSYSLOG_OUT_LOG'") @@ -26,5 +25,6 @@ wait_file_lines shutdown_when_empty wait_shutdown -seq_check 0 $((NUMMESSAGES - 1)) -E +export SEQ_CHECK_OPTIONS=-E +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/imrelp-bigmessage.sh rsyslog-8.2006.0/tests/imrelp-bigmessage.sh --- rsyslog-8.2001.0/tests/imrelp-bigmessage.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imrelp-bigmessage.sh 2020-05-28 10:29:49.000000000 +0000 @@ -0,0 +1,79 @@ +#!/bin/bash +# add 2020-02-11 by alorbach, released under ASL 2.0 +TEST_BYTES_EXPECTED=262152 + +. ${srcdir:=.}/diag.sh init +./have_relpSrvSetOversizeMode +if [ $? -eq 1 ]; then + echo "imrelp parameter oversizeMode not available. Test stopped" + exit 77 +fi; +generate_conf +add_conf ' +global( + workDirectory="'$RSYSLOG_DYNNAME.spool'" + maxMessageSize="256k" +) +module(load="../plugins/imrelp/.libs/imrelp") +input( + type="imrelp" + name="imrelp" + port="'$TCPFLOOD_PORT'" + ruleset="print" + MaxDataSize="260k" +) +#input(type="imrelp" port="'$TCPFLOOD_PORT'" maxdatasize="200" oversizeMode="accept") + +template(name="print_message" type="list"){ + constant(value="inputname: ") + property(name="inputname") + constant(value=", strlen: ") + property(name="$!strlen") + constant(value=", message: ") + property(name="msg") + constant(value="\n") +} +ruleset(name="print") { + set $!strlen = strlen($msg); + action( + type="omfile" template="print_message" + file=`echo $RSYSLOG_OUT_LOG` + ) +# action( +# type="omstdout" +# template="print_message" +# ) +} + +#template(name="outfmt" type="string" string="%msg%\n") +#:msg, contains, "msgnum:" action(type="omfile" template="outfmt" +# file=`echo $RSYSLOG_OUT_LOG`) + +' +startup +tcpflood -Trelp-plain -p'$TCPFLOOD_PORT' -m1 -d 262144 +# would also works well: +# tcpflood -Trelp-plain -p'$TCPFLOOD_PORT' -R 1 -I "imrelp-bigmessage.log" +shutdown_when_empty # shut down rsyslogd when done processing messages +wait_shutdown + +# We need the ^-sign to symbolize the beginning and the $-sign to symbolize the end +# because otherwise we won't know if it was truncated at the right length. + +content_check "inputname: imrelp, strlen: 262107, message: msgnum:00000000:262144:" +count=$(wc -c < $RSYSLOG_OUT_LOG) +if [ $count -lt $TEST_BYTES_EXPECTED ]; then + echo + echo "FAIL: expected bytes count $count did not match $TEST_BYTES_EXPECTED. " + echo + echo "First 100 bytes of $RSYSLOG_OUT_LOG are: " + head -c 100 $RSYSLOG_OUT_LOG + echo + echo "Last 100 bytes of $RSYSLOG_OUT_LOG are: " + tail -c 100 $RSYSLOG_OUT_LOG + error_exit 1 +else + echo "Found $count bytes in $RSYSLOG_OUT_LOG" +fi + +exit_test diff -Nru rsyslog-8.2001.0/tests/imrelp-sessionbreak-vg.sh rsyslog-8.2006.0/tests/imrelp-sessionbreak-vg.sh --- rsyslog-8.2001.0/tests/imrelp-sessionbreak-vg.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imrelp-sessionbreak-vg.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,74 @@ +#!/bin/bash +# added 2020-04-10 by alorbach, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000000 +export USE_VALGRIND="YES" +# TODO remote leak check skip and fix memory leaks caused by session break +export RS_TESTBENCH_LEAK_CHECK=no + +mkdir $RSYSLOG_DYNNAME.workdir +generate_conf +add_conf ' +module(load="../plugins/imrelp/.libs/imrelp") + +global( + workDirectory="'$RSYSLOG_DYNNAME.workdir'" + maxMessageSize="256k" +) +main_queue(queue.type="Direct") + +$LocalHostName test +$AbortOnUncleanConfig on +$PreserveFQDN on + +input( type="imrelp" + name="imrelp" + port="'$TCPFLOOD_PORT'" + ruleset="spool" + MaxDataSize="256k" + KeepAlive="on" +) +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +ruleset(name="spool" queue.type="direct") { + if $msg contains "msgnum:" then { + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") + } +} +' +startup +# How many tcpfloods we run at the same tiem +for ((i=1;i<=5;i++)); do + # How many times tcpflood runs in each threads + ./tcpflood -Trelp-plain -p$TCPFLOOD_PORT -m$NUMMESSAGES -s & + tcpflood_pid=$! + + echo "started tcpflood instance $i (PID $tcpflood_pid)" + + # Give it time to actually connect + ./msleep 500; + + kill -9 $tcpflood_pid # >/dev/null 2>&1; + echo "killed tcpflood instance $i (PID $tcpflood_pid)" +done; + +wait_queueempty + +netstatresult=$(netstat --all --program 2>&1 | grep "ESTABLISHED" | grep $(cat $RSYSLOG_PIDBASE.pid) | grep $TCPFLOOD_PORT) +openfd=$(ls -l "/proc/$(cat $RSYSLOG_PIDBASE$1.pid)/fd" | wc -l) + +shutdown_when_empty +wait_shutdown + +if [[ "$netstatresult" == "" ]] +then + echo "OK!" +else + echo "STILL OPENED Connections: " + echo $netstatresult + echo "Open files at the end: " + echo $openfd + error_exit 1 +fi + +exit_test diff -Nru rsyslog-8.2001.0/tests/imrelp-tls-cfgcmd.sh rsyslog-8.2006.0/tests/imrelp-tls-cfgcmd.sh --- rsyslog-8.2001.0/tests/imrelp-tls-cfgcmd.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/imrelp-tls-cfgcmd.sh 2020-06-22 12:57:15.000000000 +0000 @@ -1,6 +1,7 @@ #!/bin/bash # addd 2019-11-14 by alorbach, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +require_relpEngineSetTLSLibByName export NUMMESSAGES=1000 export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout" export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" @@ -27,21 +28,21 @@ shutdown_when_empty wait_shutdown -content_check --check-only "parameter tls.tlslib ignored" ${RSYSLOG_DEBUGLOG} +content_check --check-only "relpTcpTLSSetPrio_gtls" ${RSYSLOG_DEBUGLOG} ret=$? if [ $ret == 0 ]; then - echo "SKIP: Parameter tls.tlslib not supported" + echo "SKIP: LIBRELP was build without OPENSSL Support" + skip_test +fi + +content_check --check-only "OpenSSL Version too old" ${RSYSLOG_DEBUGLOG} +ret=$? +if [ $ret == 0 ]; then + echo "SKIP: OpenSSL Version too old" skip_test else - content_check --check-only "OpenSSL Version too old" ${RSYSLOG_DEBUGLOG} - ret=$? - if [ $ret == 0 ]; then - echo "SKIP: OpenSSL Version too old" - skip_test - else - # Kindly check for a failed session - content_check "relp connect failed with return 10031" ${RSYSLOG_DYNNAME}.tcpflood - fi + # Kindly check for a failed session + content_check "relp connect failed with return 10031" ${RSYSLOG_DYNNAME}.tcpflood fi exit_test \ No newline at end of file diff -Nru rsyslog-8.2001.0/tests/imtcp_addtlframedelim.sh rsyslog-8.2006.0/tests/imtcp_addtlframedelim.sh --- rsyslog-8.2001.0/tests/imtcp_addtlframedelim.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp_addtlframedelim.sh 2020-05-28 10:29:49.000000000 +0000 @@ -4,6 +4,7 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init export NUMMESSAGES=20000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp" addtlframedelimiter="0") diff -Nru rsyslog-8.2001.0/tests/imtcp-basic.sh rsyslog-8.2006.0/tests/imtcp-basic.sh --- rsyslog-8.2001.0/tests/imtcp-basic.sh 2020-01-13 08:48:17.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp-basic.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,8 @@ #!/bin/bash # addd 2016-05-13 by RGerhards, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=10000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imtcp/.libs/imtcp") @@ -8,11 +10,11 @@ template(name="outfmt" type="string" string="%msg:F,58:2%\n") :msg, contains, "msgnum:" action(type="omfile" template="outfmt" - file=`echo $RSYSLOG_OUT_LOG`) + file="'$RSYSLOG_OUT_LOG'") ' startup -tcpflood -p$TCPFLOOD_PORT -m10000 +tcpflood -m $NUMMESSAGES shutdown_when_empty wait_shutdown -seq_check 0 9999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/imtcp-bigmessage-octetcounting.sh rsyslog-8.2006.0/tests/imtcp-bigmessage-octetcounting.sh --- rsyslog-8.2001.0/tests/imtcp-bigmessage-octetcounting.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp-bigmessage-octetcounting.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,65 @@ +#!/bin/bash +# add 2020-05-14 by alorbach, released under ASL 2.0 +export NUMMESSAGES=10 +export TEST_BYTES_SENDSIZE=4037 +export TEST_BYTES_EXPECTED=$(((TEST_BYTES_SENDSIZE/2 - 420) * NUMMESSAGES)) # 262152 +. ${srcdir:=.}/diag.sh init + +generate_conf +add_conf ' +global( + workDirectory="'$RSYSLOG_DYNNAME.spool'" + maxMessageSize="4k" +) +module( load="../plugins/imtcp/.libs/imtcp" + MaxSessions="10000" + discardTruncatedMsg="on" +) +input( + type="imtcp" + name="imtcp" + port="'$TCPFLOOD_PORT'" + ruleset="print" +) + +template(name="print_message" type="list"){ + constant(value="inputname: ") + property(name="inputname") + constant(value=", strlen: ") + property(name="$!strlen") + constant(value=", message: ") + property(name="msg") + constant(value="\n") +} +ruleset(name="print") { + set $!strlen = strlen($msg); + action( + type="omfile" template="print_message" + file=`echo $RSYSLOG_OUT_LOG` + ) +} +' +startup +tcpflood -p'$TCPFLOOD_PORT' -m$NUMMESSAGES -d $TEST_BYTES_SENDSIZE -O + +shutdown_when_empty # shut down rsyslogd when done processing messages +wait_shutdown + +content_count_check --regex "inputname: imtcp, strlen:" ${NUMMESSAGES} + +count=$(wc -c < $RSYSLOG_OUT_LOG) +if [ $count -lt $TEST_BYTES_EXPECTED ]; then + echo + echo "FAIL: expected bytes count $count did not match $TEST_BYTES_EXPECTED. " + echo + echo "First 100 bytes of $RSYSLOG_OUT_LOG are: " + head -c 100 $RSYSLOG_OUT_LOG + echo + echo "Last 100 bytes of $RSYSLOG_OUT_LOG are: " + tail -c 100 $RSYSLOG_OUT_LOG + error_exit 1 +else + echo "Found $count bytes (Expected $TEST_BYTES_EXPECTED) in $RSYSLOG_OUT_LOG" +fi + +exit_test \ No newline at end of file diff -Nru rsyslog-8.2001.0/tests/imtcp-bigmessage-octetstuffing.sh rsyslog-8.2006.0/tests/imtcp-bigmessage-octetstuffing.sh --- rsyslog-8.2001.0/tests/imtcp-bigmessage-octetstuffing.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp-bigmessage-octetstuffing.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,65 @@ +#!/bin/bash +# add 2020-05-14 by alorbach, released under ASL 2.0 +export NUMMESSAGES=10 +export TEST_BYTES_SENDSIZE=4037 +export TEST_BYTES_EXPECTED=$(((TEST_BYTES_SENDSIZE/2 - 420) * NUMMESSAGES)) # 262152 +. ${srcdir:=.}/diag.sh init + +generate_conf +add_conf ' +global( + workDirectory="'$RSYSLOG_DYNNAME.spool'" + maxMessageSize="4k" +) +module( load="../plugins/imtcp/.libs/imtcp" + MaxSessions="10000" + discardTruncatedMsg="on" +) +input( + type="imtcp" + name="imtcp" + port="'$TCPFLOOD_PORT'" + ruleset="print" +) + +template(name="print_message" type="list"){ + constant(value="inputname: ") + property(name="inputname") + constant(value=", strlen: ") + property(name="$!strlen") + constant(value=", message: ") + property(name="msg") + constant(value="\n") +} +ruleset(name="print") { + set $!strlen = strlen($msg); + action( + type="omfile" template="print_message" + file=`echo $RSYSLOG_OUT_LOG` + ) +} +' +startup +tcpflood -p'$TCPFLOOD_PORT' -m$NUMMESSAGES -d $TEST_BYTES_SENDSIZE + +shutdown_when_empty # shut down rsyslogd when done processing messages +wait_shutdown + +content_count_check --regex "inputname: imtcp, strlen:" ${NUMMESSAGES} + +count=$(wc -c < $RSYSLOG_OUT_LOG) +if [ $count -lt $TEST_BYTES_EXPECTED ]; then + echo + echo "FAIL: expected bytes count $count did not match $TEST_BYTES_EXPECTED. " + echo + echo "First 100 bytes of $RSYSLOG_OUT_LOG are: " + head -c 100 $RSYSLOG_OUT_LOG + echo + echo "Last 100 bytes of $RSYSLOG_OUT_LOG are: " + tail -c 100 $RSYSLOG_OUT_LOG + error_exit 1 +else + echo "Found $count bytes (Expected $TEST_BYTES_EXPECTED) in $RSYSLOG_OUT_LOG" +fi + +exit_test \ No newline at end of file diff -Nru rsyslog-8.2001.0/tests/imtcp_conndrop.sh rsyslog-8.2006.0/tests/imtcp_conndrop.sh --- rsyslog-8.2001.0/tests/imtcp_conndrop.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp_conndrop.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,36 +3,28 @@ # added 2010-08-10 by Rgerhards # # This file is part of the rsyslog project, released under GPLv3 - -uname -if [ $(uname) = "FreeBSD" ] ; then - echo "This test currently does not work on FreeBSD." - exit 77 -fi - -echo ==================================================================================== -echo TEST: \[imtcp_conndrop.sh\]: test imtcp with random connection drops . ${srcdir:=.}/diag.sh init +skip_platform "FreeBSD" "This test currently does not work on FreeBSD" +export NUMMESSAGES=50000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $MaxMessageSize 10k -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! -$OMFileFlushOnTXEnd off $OMFileFlushInterval 2 $OMFileIOBufferSize 256k local0.* ?dynfile;outfmt ' startup # 100 byte messages to gain more practical data use -tcpflood -c20 -m50000 -r -d100 -P129 -D -sleep 10 # due to large messages, we need this time for the tcp receiver to settle... -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 49999 -E +tcpflood -c20 -m$NUMMESSAGES -r -d100 -P129 -D +shutdown_when_empty +wait_shutdown +export SEQ_CHECK_OPTIONS=-E +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/imtcp_conndrop_tls.sh rsyslog-8.2006.0/tests/imtcp_conndrop_tls.sh --- rsyslog-8.2001.0/tests/imtcp_conndrop_tls.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp_conndrop_tls.sh 2020-05-28 10:29:49.000000000 +0000 @@ -8,31 +8,27 @@ export QUEUE_EMPTY_CHECK_FUNC=wait_seq_check generate_conf add_conf ' -$MaxMessageSize 10k +global( maxMessageSize="10k" + defaultNetstreamDriverCAFile="'$srcdir'/tls-certs/ca.pem" + defaultNetstreamDriverCertFile="'$srcdir'/tls-certs/cert.pem" + defaultNetstreamDriverKeyFile="'$srcdir'/tls-certs/key.pem" + defaultNetstreamDriver="gtls" + debug.whitelist="on" + debug.files=["nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"] +) -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 +module(load="../plugins/imtcp/.libs/imtcp" maxSessions="1100" + streamDriver.mode="1" streamDriver.authMode="anon") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") -# TLS Stuff - certificate files - just CA for a client -$DefaultNetstreamDriver gtls -$IncludeConfig '$RSYSLOG_DYNNAME'.rsyslog.conf.tlscert -$InputTCPServerStreamDriverMode 1 -$InputTCPServerStreamDriverAuthMode anon -$InputTCPServerRun '$TCPFLOOD_PORT' - -$template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! -$OMFileIOBufferSize 256k -local0.* ?dynfile;outfmt +template(name="outfmt" type="string" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") +local0.* action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' -echo \$DefaultNetstreamDriverCAFile $srcdir/tls-certs/ca.pem >$RSYSLOG_DYNNAME.rsyslog.conf.tlscert -echo \$DefaultNetstreamDriverCertFile $srcdir/tls-certs/cert.pem >>$RSYSLOG_DYNNAME.rsyslog.conf.tlscert -echo \$DefaultNetstreamDriverKeyFile $srcdir/tls-certs/key.pem >>$RSYSLOG_DYNNAME.rsyslog.conf.tlscert startup # 100 byte messages to gain more practical data use tcpflood -c20 -p$TCPFLOOD_PORT -m$NUMMESSAGES -r -d100 -P129 -D -l0.995 -Ttls -x$srcdir/tls-certs/ca.pem -Z$srcdir/tls-certs/cert.pem -z$srcdir/tls-certs/key.pem -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate +shutdown_when_empty +wait_shutdown export SEQ_CHECK_OPTIONS=-E seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/imtcp_conndrop_tls-vg.sh rsyslog-8.2006.0/tests/imtcp_conndrop_tls-vg.sh --- rsyslog-8.2001.0/tests/imtcp_conndrop_tls-vg.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp_conndrop_tls-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,9 +3,3 @@ export USE_VALGRIND="YES" export NUMMESSAGES=10000 # reduce for slower valgrind run source ${srcdir:-.}/imtcp_conndrop_tls.sh - -uname -if [ $(uname) = "FreeBSD" ] ; then - echo "This test currently does not work on FreeBSD." - exit 77 -fi diff -Nru rsyslog-8.2001.0/tests/imtcp-multiport.sh rsyslog-8.2006.0/tests/imtcp-multiport.sh --- rsyslog-8.2001.0/tests/imtcp-multiport.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp-multiport.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,24 +5,25 @@ # added 2009-05-22 by Rgerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init -export TCPFLOOD_PORT2="$(get_free_port)" -export TCPFLOOD_PORT3="$(get_free_port)" +export NUMMESSAGES=30000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' -$InputTCPServerRun '$TCPFLOOD_PORT2' -$InputTCPServerRun '$TCPFLOOD_PORT3' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port2") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port3") $template outfmt,"%msg:F,58:2%\n" :msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -tcpflood -p'$TCPFLOOD_PORT' -m10000 -tcpflood -p'$TCPFLOOD_PORT2' -i10000 -m10000 -tcpflood -p'$TCPFLOOD_PORT3' -i20000 -m10000 -shutdown_when_empty # shut down rsyslogd when done processing messages +assign_tcpflood_port2 "$RSYSLOG_DYNNAME.tcpflood_port2" +assign_rs_port "$RSYSLOG_DYNNAME.tcpflood_port3" +tcpflood -p$TCPFLOOD_PORT -m10000 +tcpflood -p$TCPFLOOD_PORT2 -i10000 -m10000 +tcpflood -p$RS_PORT -i20000 -m10000 +shutdown_when_empty wait_shutdown -seq_check 0 29999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/imtcp-tls-ossl-basic-brokenhandshake-vg.sh rsyslog-8.2006.0/tests/imtcp-tls-ossl-basic-brokenhandshake-vg.sh --- rsyslog-8.2001.0/tests/imtcp-tls-ossl-basic-brokenhandshake-vg.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp-tls-ossl-basic-brokenhandshake-vg.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,40 @@ +#!/bin/bash +# This file is part of the rsyslog project, released under ASL 2.0 +if [ "$(valgrind --version)" == "valgrind-3.11.0" ]; then + printf 'This test does NOT work with valgrind-3.11.0 - valgrind always reports\n' + printf 'a valgrind-internal bug. So we need to skip it.\n' + exit 77 +fi +. ${srcdir:=.}/diag.sh init +export USE_VALGRIND="YES" +export NUMMESSAGES=1 +generate_conf +add_conf ' +global( defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'" + defaultNetstreamDriverCertFile="'$srcdir/tls-certs/cert.pem'" + defaultNetstreamDriverKeyFile="'$srcdir/tls-certs/key.pem'" +# debug.whitelist="on" +# debug.files=["nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"] +) + +module( load="../plugins/imtcp/.libs/imtcp" + StreamDriver.Name="ossl" + StreamDriver.Mode="1" + StreamDriver.AuthMode="anon" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") + +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +:msg, contains, "msgnum:" action( type="omfile" + template="outfmt" + file=`echo $RSYSLOG_OUT_LOG`) +' +# Begin actual testcase | send one msg without TLS to force a handshake failure, send second msg with TLS to make the test PASS +startup +tcpflood -p$TCPFLOOD_PORT -m$NUMMESSAGES +tcpflood -p$TCPFLOOD_PORT -m$NUMMESSAGES -Ttls -x$srcdir/tls-certs/ca.pem -Z$srcdir/tls-certs/cert.pem -z$srcdir/tls-certs/key.pem + +wait_file_lines +shutdown_when_empty +wait_shutdown +seq_check +exit_test diff -Nru rsyslog-8.2001.0/tests/imtcp-tls-ossl-basic-tlscommands.sh rsyslog-8.2006.0/tests/imtcp-tls-ossl-basic-tlscommands.sh --- rsyslog-8.2001.0/tests/imtcp-tls-ossl-basic-tlscommands.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/imtcp-tls-ossl-basic-tlscommands.sh 2020-06-05 10:06:07.000000000 +0000 @@ -32,9 +32,9 @@ shutdown_when_empty wait_shutdown -if content_check --check-only "OpenSSL Version too old" +if content_check --check-only "TLS library does not support SSL_CONF_cmd" then - echo "SKIP: OpenSSL Version too old" + echo "SKIP: TLS library does not support SSL_CONF_cmd" skip_test else # Kindly check for a failed session diff -Nru rsyslog-8.2001.0/tests/imuxsock_ccmiddle_root.sh rsyslog-8.2006.0/tests/imuxsock_ccmiddle_root.sh --- rsyslog-8.2001.0/tests/imuxsock_ccmiddle_root.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_ccmiddle_root.sh 2020-05-28 10:29:49.000000000 +0000 @@ -27,9 +27,6 @@ ./msleep 100 shutdown_when_empty # shut down rsyslogd when done processing messages wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_ccmiddle.log -if [ ! $? -eq 0 ]; then -echo "imuxsock_ccmiddle_root.sh failed" -exit 1 -fi; +export EXPECTED=" test 1#0112" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_ccmiddle.sh rsyslog-8.2006.0/tests/imuxsock_ccmiddle.sh --- rsyslog-8.2001.0/tests/imuxsock_ccmiddle.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_ccmiddle.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,30 +1,28 @@ #!/bin/bash -echo \[imuxsock_ccmiddle.sh\]: test trailing LF handling in imuxsock +# test trailing LF handling in imuxsock +. ${srcdir:=.}/diag.sh init ./syslog_caller -fsyslog_inject-l -m0 > /dev/null 2>&1 no_liblogging_stdlog=$? if [ $no_liblogging_stdlog -ne 0 ];then echo "liblogging-stdlog not available - skipping test" exit 77 fi -. ${srcdir:=.}/diag.sh init + +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" sysSock.use="off") input(type="imuxsock" Socket="'$RSYSLOG_DYNNAME'-testbench_socket") template(name="outfmt" type="string" string="%msg:%\n") -local1.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") +local1.* action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup # send a message with trailing LF ./syslog_caller -fsyslog_inject-c -m1 -C "uxsock:$RSYSLOG_DYNNAME-testbench_socket" -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_ccmiddle.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_ccmiddle_root.sh failed" - error_exit 1 -fi; +shutdown_when_empty +wait_shutdown +export EXPECTED=" test 1#0112" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_ccmiddle_syssock.sh rsyslog-8.2006.0/tests/imuxsock_ccmiddle_syssock.sh --- rsyslog-8.2001.0/tests/imuxsock_ccmiddle_syssock.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_ccmiddle_syssock.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,7 @@ #!/bin/bash -echo \[imuxsock_ccmiddle_syssock.sh\]: test trailing LF handling in imuxsock - +# test trailing LF handling in imuxsock +# part of rsyslog, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init uname if [ $(uname) = "SunOS" ] ; then echo "Solaris: FIX ME" @@ -13,7 +14,9 @@ echo "liblogging-stdlog not available - skipping test" exit 77 fi -. ${srcdir:=.}/diag.sh init + +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" @@ -25,15 +28,8 @@ startup # send a message with trailing LF ./syslog_caller -fsyslog_inject-c -m1 -C "uxsock:$RSYSLOG_DYNNAME-testbench_socket" -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_ccmiddle.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_ccmiddle_syssock.sh failed" - echo "contents of $RSYSLOG_OUT_LOG:" - echo \"$(cat $RSYSLOG_OUT_LOG)\" - exit 1 -fi; +shutdown_when_empty +wait_shutdown +export EXPECTED=" test 1#0112" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_hostname.sh rsyslog-8.2006.0/tests/imuxsock_hostname.sh --- rsyslog-8.2001.0/tests/imuxsock_hostname.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_hostname.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,12 +1,16 @@ #!/bin/bash -echo \[imuxsock_hostname.sh\]: test set hostname +# test set hostname +. ${srcdir:=.}/diag.sh init + ./syslog_caller -fsyslog_inject-l -m0 > /dev/null 2>&1 no_liblogging_stdlog=$? if [ $no_liblogging_stdlog -ne 0 ];then echo "liblogging-stdlog not available - skipping test" exit 77 fi -. ${srcdir:=.}/diag.sh init + +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' global(localHostName="rsyslog-testbench-hostname") @@ -21,13 +25,8 @@ # the message itself is irrelevant. The only important thing is # there is one ./syslog_caller -m1 -C "uxsock:$RSYSLOG_DYNNAME-testbench_socket" -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_hostname.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_hostname.sh failed" - exit 1 -fi; +shutdown_when_empty +wait_shutdown +export EXPECTED="rsyslog-testbench-hostname" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_logger_parserchain.sh rsyslog-8.2006.0/tests/imuxsock_logger_parserchain.sh --- rsyslog-8.2001.0/tests/imuxsock_logger_parserchain.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_logger_parserchain.sh 2020-05-28 10:29:49.000000000 +0000 @@ -2,6 +2,8 @@ # Copyright (C) 2015-03-04 by rainer gerhards, released under ASL 2.0 . ${srcdir:=.}/diag.sh init check_logger_has_option_d +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" sysSock.use="off") @@ -17,15 +19,8 @@ if [ ! $? -eq 0 ]; then logger -d -u $RSYSLOG_DYNNAME-testbench_socket test fi; -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 shutdown_when_empty wait_shutdown -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_logger.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_logger_parserchain.sh failed" - echo "contents of $RSYSLOG_OUT_LOG:" - echo \"$(cat $RSYSLOG_OUT_LOG)\" - exit 1 -fi; +export EXPECTED=" test" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_logger.sh rsyslog-8.2006.0/tests/imuxsock_logger.sh --- rsyslog-8.2001.0/tests/imuxsock_logger.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_logger.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,8 @@ #!/bin/bash . ${srcdir:=.}/diag.sh init check_logger_has_option_d +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" sysSock.use="off") @@ -10,17 +12,9 @@ *.notice action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -# send a message with trailing LF logger -d -u $RSYSLOG_DYNNAME-testbench_socket test -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_logger.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_logger.sh failed" - echo "contents of $RSYSLOG_OUT_LOG:" - echo \"$(cat $RSYSLOG_OUT_LOG)\" - error_exit 1 -fi; +shutdown_when_empty +wait_shutdown +export EXPECTED=" test" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_logger_syssock.sh rsyslog-8.2006.0/tests/imuxsock_logger_syssock.sh --- rsyslog-8.2001.0/tests/imuxsock_logger_syssock.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_logger_syssock.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,26 +5,20 @@ # is pretty close to it. -- rgerhards, 201602-19 . ${srcdir:=.}/diag.sh init check_logger_has_option_d +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" SysSock.name="'$RSYSLOG_DYNNAME'-testbench_socket") $template outfmt,"%msg:%\n" -*.notice action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") +*.notice action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -# send a message with trailing LF logger -d -u $RSYSLOG_DYNNAME-testbench_socket test -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_logger.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_logger_syssock.sh failed" - echo "contents of $RSYSLOG_OUT_LOG:" - echo \"$(cat $RSYSLOG_OUT_LOG)\" - error_exit 1 -fi; +shutdown_when_empty +wait_shutdown +export EXPECTED=" test" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_traillf.sh rsyslog-8.2006.0/tests/imuxsock_traillf.sh --- rsyslog-8.2001.0/tests/imuxsock_traillf.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_traillf.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,11 +1,13 @@ #!/bin/bash +. ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines ./syslog_caller -fsyslog_inject-l -m0 > /dev/null 2>&1 no_liblogging_stdlog=$? if [ $no_liblogging_stdlog -ne 0 ];then echo "liblogging-stdlog not available - skipping test" exit 77 fi -. ${srcdir:=.}/diag.sh init generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" sysSock.use="off") @@ -15,19 +17,9 @@ local1.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -# send a message with trailing LF ./syslog_caller -fsyslog_inject-l -m1 -C "uxsock:$RSYSLOG_DYNNAME-testbench_socket" -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_traillf.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_traillf.sh failed" - echo "contents of $RSYSLOG_OUT_LOG:" - echo \"$(cat $RSYSLOG_OUT_LOG)\" - echo expected: - echo \"$(cat $srcdir/resultdata/imuxsock_traillf.log)\" - error_exit 1 -fi; +shutdown_when_empty +wait_shutdown +export EXPECTED=" test" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/imuxsock_traillf_syssock.sh rsyslog-8.2006.0/tests/imuxsock_traillf_syssock.sh --- rsyslog-8.2001.0/tests/imuxsock_traillf_syssock.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/imuxsock_traillf_syssock.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,10 +1,6 @@ #!/bin/bash - -uname -if [ $(uname) = "SunOS" ] ; then - echo "Solaris: FIX ME" - exit 77 -fi +. ${srcdir:=.}/diag.sh init +skip_platform "SunOS" "This test does not work on Solaris" ./syslog_caller -fsyslog_inject-l -m0 > /dev/null 2>&1 no_liblogging_stdlog=$? @@ -12,7 +8,9 @@ echo "liblogging-stdlog not available - skipping test" exit 77 fi -. ${srcdir:=.}/diag.sh init + +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' module(load="../plugins/imuxsock/.libs/imuxsock" @@ -22,19 +20,8 @@ local1.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") ' startup -# send a message with trailing LF ./syslog_caller -fsyslog_inject-l -m1 -C "uxsock:$RSYSLOG_DYNNAME-testbench_socket" -# the sleep below is needed to prevent too-early termination of rsyslogd -./msleep 100 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -cmp $RSYSLOG_OUT_LOG $srcdir/resultdata/imuxsock_traillf.log -if [ ! $? -eq 0 ]; then - echo "imuxsock_traillf_syssock failed" - echo "contents of $RSYSLOG_OUT_LOG:" - echo \"$(cat $RSYSLOG_OUT_LOG)\" - echo expected: - echo \"$(cat $srcdir/resultdata/imuxsock_traillf.log)\" - exit 1 -fi; -exit_test +shutdown_when_empty +wait_shutdown +export EXPECTED=" test" +cmp_exact diff -Nru rsyslog-8.2001.0/tests/include-obj-text-from-file-noexist.sh rsyslog-8.2006.0/tests/include-obj-text-from-file-noexist.sh --- rsyslog-8.2001.0/tests/include-obj-text-from-file-noexist.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/include-obj-text-from-file-noexist.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/bash +# added 2018-01-22 by Rainer Gerhards; Released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +if $msg contains "msgnum:" then { + include(text=`cat '${srcdir}'/testsuites/DOES-NOT-EXIST`) +} +action(type="omfile" file="'$RSYSLOG_OUT_LOG'") +' +startup +shutdown_when_empty +wait_shutdown +content_check --regex 'file could not be accessed for `cat .*/testsuites/DOES-NOT-EXIST' +exit_test diff -Nru rsyslog-8.2001.0/tests/inputname-imtcp.sh rsyslog-8.2006.0/tests/inputname-imtcp.sh --- rsyslog-8.2001.0/tests/inputname-imtcp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/inputname-imtcp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,32 +5,28 @@ add_conf ' module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" name="12514" port="12514" ruleset="ruleset1") -input(type="imtcp" name="12515" port="12515" ruleset="ruleset1") -input(type="imtcp" name="12516" port="12516" ruleset="ruleset1") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="ruleset1" name="l1") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port2" ruleset="ruleset1" name="l2") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port3" ruleset="ruleset1" name="l3") template(name="outfmt" type="string" string="%inputname%\n") ruleset(name="ruleset1") { - action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` - template="outfmt") + action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") } ' startup -tcpflood -p12514 -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 %PIX-7-710005: MSG\"" -tcpflood -p12515 -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 %PIX-7-710005: MSG\"" -tcpflood -p12516 -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 %PIX-7-710005: MSG\"" +assign_tcpflood_port2 "$RSYSLOG_DYNNAME.tcpflood_port2" +assign_rs_port "$RSYSLOG_DYNNAME.tcpflood_port3" +tcpflood -p $TCPFLOOD_PORT -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 %PIX-7-710005: MSG\"" +tcpflood -p $TCPFLOOD_PORT2 -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 %PIX-7-710005: MSG\"" +tcpflood -p $RS_PORT -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 %PIX-7-710005: MSG\"" shutdown_when_empty wait_shutdown -echo '12514 -12515 -12516' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - +export EXPECTED='l1 +l2 +l3' +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/known_issues.supp rsyslog-8.2006.0/tests/known_issues.supp --- rsyslog-8.2001.0/tests/known_issues.supp 2019-10-02 06:22:05.000000000 +0000 +++ rsyslog-8.2006.0/tests/known_issues.supp 2020-05-28 10:29:49.000000000 +0000 @@ -21,3 +21,13 @@ fun:initAll fun:main } + +{ + + Memcheck:Param + pselect6(sig) + fun:pselect + fun:wait_timeout + fun:mainloop + fun:main +} diff -Nru rsyslog-8.2001.0/tests/linkedlistqueue.sh rsyslog-8.2006.0/tests/linkedlistqueue.sh --- rsyslog-8.2001.0/tests/linkedlistqueue.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/linkedlistqueue.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,14 +3,10 @@ # added 2009-05-20 by rgerhards # This file is part of the rsyslog project, released under GPLv3 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=40000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - -$ErrorMessagesToStderr off - # set spool locations and switch queue to disk-only mode $MainMsgQueueType LinkedList @@ -19,8 +15,8 @@ :msg, contains, "msgnum:" ?dynfile;outfmt ' startup -injectmsg 0 40000 +injectmsg shutdown_when_empty wait_shutdown -seq_check 0 39999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/loadbalance.sh rsyslog-8.2006.0/tests/loadbalance.sh --- rsyslog-8.2001.0/tests/loadbalance.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/loadbalance.sh 2020-05-28 10:29:49.000000000 +0000 @@ -0,0 +1,44 @@ +#!/bin/bash +# a test to check load balancing via global variables +# note: for simplicity, we use omfile output; in practice this will usually +# be some kind of network output, e.g. omfwd or omrelp. From the method's +# point of view, the actual output does not matter. +# added by Rainer Gerhards 2020-01-03 +# part of the rsyslog project, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1000 # sufficient for our needs +export QUEUE_EMPTY_CHECK_FUNC=wait_seq_check +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +# note: do NOT initialize $/lbcntr - it starts at "", which becomes 0 after cnum() +if $msg contains "msgnum" then { + set $.actnbr = cnum($/lbcntr) % 4; + if $.actnbr == 0 then { + action(type="omfile" file="'$RSYSLOG_DYNNAME'0.log" template="outfmt") + } else if $.actnbr == 1 then { + action(type="omfile" file="'$RSYSLOG_DYNNAME'1.log" template="outfmt") + } else if $.actnbr == 2 then { + action(type="omfile" file="'$RSYSLOG_DYNNAME'2.log" template="outfmt") + } else { + action(type="omfile" file="'$RSYSLOG_DYNNAME'3.log" template="outfmt") + } + set $/lbcntr = cnum($/lbcntr) + 1; +action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") +} +' +startup +injectmsg +shutdown_when_empty +wait_shutdown +seq_check # validate test result as such +export SEQ_CHECK_FILE="${RSYSLOG_DYNNAME}0.log" +seq_check 0 $((NUMMESSAGES -4)) -i 4 +printf 'Checking file 1\n' +export SEQ_CHECK_FILE="${RSYSLOG_DYNNAME}1.log" +printf 'Checking file 2\n' +export SEQ_CHECK_FILE="${RSYSLOG_DYNNAME}2.log" +printf 'Checking file 3\n' +export SEQ_CHECK_FILE="${RSYSLOG_DYNNAME}3.log" +exit_test diff -Nru rsyslog-8.2001.0/tests/Makefile.am rsyslog-8.2006.0/tests/Makefile.am --- rsyslog-8.2001.0/tests/Makefile.am 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/Makefile.am 2020-06-22 12:57:15.000000000 +0000 @@ -159,7 +159,13 @@ operatingstate-empty.sh \ operatingstate-unclean.sh \ smtradfile.sh \ + loadbalance.sh \ empty-hostname.sh \ + timestamp-3164.sh \ + timestamp-3339.sh \ + timestamp-mysql.sh \ + timestamp-pgsql.sh \ + timestamp-subseconds.sh \ hostname-getaddrinfo-fail.sh \ msleep_usage_output.sh \ mangle_qi_usage_output.sh \ @@ -185,6 +191,7 @@ glbl_setenv_err.sh \ glbl_setenv_err_too_long.sh \ glbl_setenv.sh \ + mmexternal-SegFault.sh \ nested-call-shutdown.sh \ dnscache-TTL-0.sh \ invalid_nested_include.sh \ @@ -270,8 +277,10 @@ imtcp-msg-truncation-on-number2.sh \ imtcp-NUL.sh \ imtcp-NUL-rawmsg.sh \ - imtcp-multiport.sh \ imtcp_incomplete_frame_at_end.sh \ + imtcp-multiport.sh \ + imtcp-bigmessage-octetcounting.sh \ + imtcp-bigmessage-octetstuffing.sh \ da-queue-persist.sh \ daqueue-persist.sh \ daqueue-invld-qi.sh \ @@ -434,6 +443,7 @@ lookup_table_rscript_reload.sh \ lookup_table_rscript_reload_without_stub.sh \ include-obj-text-from-file.sh \ + include-obj-text-from-file-noexist.sh \ multiple_lookup_tables.sh \ parsertest-parse1.sh \ parsertest-parse1-udp.sh \ @@ -451,6 +461,7 @@ parsertest-parse-nodate-udp.sh \ parsertest-snare_ccoff_udp.sh \ parsertest-snare_ccoff_udp2.sh + if ENABLE_LIBGCRYPT TESTS += \ queue-encryption-disk.sh \ @@ -473,7 +484,6 @@ rscript_backticks_empty_envvar-vg.sh \ rscript-config_enable-off-vg.sh \ prop-jsonmesg-vg.sh \ - mmexternal-SegFault-vg.sh \ mmexternal-InvldProg-vg.sh \ internal-errmsg-memleak-vg.sh \ glbl-oversizeMsg-log-vg.sh \ @@ -838,7 +848,9 @@ omhttp-batch-lokirest-retry.sh \ omhttp-batch-lokirest.sh \ omhttp-batch-newline.sh \ - omhttp-retry.sh + omhttp-retry.sh \ + omhttp-httpheaderkey.sh \ + omhttp-multiplehttpheaders.sh if HAVE_VALGRIND TESTS += \ omhttp-auth-vg.sh \ @@ -996,7 +1008,8 @@ rscript_random.sh \ rscript_hash32.sh \ rscript_hash64.sh \ - rscript_replace.sh + rscript_replace.sh \ + omfile-outchannel-many.sh if HAVE_VALGRIND TESTS += \ imptcp_conndrop-vg.sh @@ -1135,7 +1148,7 @@ endif endif -if ENABLE_GNUTLS +if ENABLE_GNUTLS_TESTS TESTS += \ imtcp-tls-basic.sh \ imtcp-tls-basic-verifydepth.sh \ @@ -1186,11 +1199,12 @@ imtcp-tls-ossl-error-key2.sh if HAVE_VALGRIND TESTS += \ - imtcp-tls-ossl-basic-vg.sh + imtcp-tls-ossl-basic-vg.sh \ + imtcp-tls-ossl-basic-brokenhandshake-vg.sh endif endif -if ENABLE_GNUTLS +if ENABLE_GNUTLS_TESTS if ENABLE_OPENSSL TESTS += \ sndrcv_tls_ossl_servercert_gtls_clientanon.sh \ @@ -1217,6 +1231,7 @@ imrelp-oversizeMode-truncate.sh \ imrelp-oversizeMode-accept.sh \ imrelp-invld-tlslib.sh \ + imrelp-bigmessage.sh \ omrelp-invld-tlslib.sh \ sndrcv_relp_dflt_pt.sh \ glbl-oversizeMsg-log.sh \ @@ -1239,6 +1254,7 @@ if HAVE_VALGRIND TESTS += \ imrelp-basic-vg.sh \ + imrelp-sessionbreak-vg.sh \ imrelp-manyconn-vg.sh endif # HAVE_VALGRIND endif @@ -1247,6 +1263,7 @@ TESTS += \ omudpspoof_errmsg_no_params.sh \ sndrcv_omudpspoof.sh \ + sndrcv_omudpspoof-bigmsg.sh \ sndrcv_omudpspoof_nonstdpt.sh endif @@ -1266,17 +1283,7 @@ proprepltest-nolimittag-udp.sh \ proprepltest-nolimittag.sh \ proprepltest-rfctag-udp.sh \ - proprepltest-rfctag.sh \ - timestamp-3164-udp.sh \ - timestamp-3164.sh \ - timestamp-3339-udp.sh \ - timestamp-3339.sh \ - timestamp-mysql-udp.sh \ - timestamp-mysql.sh \ - timestamp-pgsql-udp.sh \ - timestamp-pgsql.sh \ - timestamp-subseconds-udp.sh \ - timestamp-subseconds.sh + proprepltest-rfctag.sh endif @@ -1500,6 +1507,7 @@ urlencode.py \ dnscache-TTL-0.sh \ dnscache-TTL-0-vg.sh \ + loadbalance.sh \ smtradfile.sh \ smtradfile-vg.sh \ immark.sh \ @@ -1558,7 +1566,7 @@ imbatchreport_delete_toolarge.sh \ imbatchreport_rename_toolarge.sh \ imbatchreport_errmsg_no_params-vg.sh \ - mmexternal-SegFault-vg.sh \ + mmexternal-SegFault.sh \ mmexternal-SegFault-empty-jroot-vg.sh \ testsuites/mmexternal-SegFault-mm-python.py \ mmexternal-InvldProg-vg.sh \ @@ -1626,15 +1634,10 @@ proprepltest-nolimittag.sh \ proprepltest-rfctag-udp.sh \ proprepltest-rfctag.sh \ - timestamp-3164-udp.sh \ timestamp-3164.sh \ - timestamp-3339-udp.sh \ timestamp-3339.sh \ - timestamp-mysql-udp.sh \ timestamp-mysql.sh \ - timestamp-pgsql-udp.sh \ timestamp-pgsql.sh \ - timestamp-subseconds-udp.sh \ timestamp-subseconds.sh \ rsf_getenv.sh \ diskq-rfc5424.sh \ @@ -1644,6 +1647,7 @@ diskqueue-non-unique-prefix.sh \ arrayqueue.sh \ include-obj-text-from-file.sh \ + include-obj-text-from-file-noexist.sh \ include-obj-outside-control-flow-vg.sh \ include-obj-in-if-vg.sh \ include-obj-text-vg.sh \ @@ -1744,6 +1748,7 @@ omfile-whitespace-filename.sh \ omfile-read-only.sh \ omfile-outchannel.sh \ + omfile-outchannel-many.sh \ omfile_both_files_set.sh \ omfile_hup.sh \ omrabbitmq_no_params.sh \ @@ -1965,6 +1970,8 @@ imtcp-tls-basic-vg.sh \ imtcp_incomplete_frame_at_end.sh \ imtcp-multiport.sh \ + imtcp-bigmessage-octetcounting.sh \ + imtcp-bigmessage-octetstuffing.sh \ udp-msgreduc-orgmsg-vg.sh \ udp-msgreduc-vg.sh \ manytcp-too-few-tls-vg.sh \ @@ -1982,6 +1989,7 @@ imtcp-tls-ossl-x509name.sh \ imtcp-tls-ossl-x509fingerprint.sh \ imtcp-tls-ossl-basic-vg.sh \ + imtcp-tls-ossl-basic-brokenhandshake-vg.sh \ imtcp-tls-ossl-error-ca.sh \ imtcp-tls-ossl-error-cert.sh \ imtcp-tls-ossl-error-key.sh \ @@ -2069,6 +2077,8 @@ imrelp-oversizeMode-truncate.sh \ imrelp-oversizeMode-accept.sh \ imrelp-invld-tlslib.sh \ + imrelp-bigmessage.sh \ + imrelp-sessionbreak-vg.sh \ omrelp-invld-tlslib.sh \ glbl-oversizeMsg-log.sh \ glbl-oversizeMsg-truncate.sh \ @@ -2090,6 +2100,7 @@ sndrcv_udp_nonstdpt_v6.sh \ omudpspoof_errmsg_no_params.sh \ sndrcv_omudpspoof.sh \ + sndrcv_omudpspoof-bigmsg.sh \ sndrcv_omudpspoof_nonstdpt.sh \ sndrcv_gzip.sh \ action-tx-single-processing.sh \ @@ -2118,6 +2129,8 @@ omhttp-batch-lokirest.sh \ omhttp-batch-newline.sh \ omhttp-retry.sh \ + omhttp-httpheaderkey.sh \ + omhttp-multiplehttpheaders.sh \ omhttp-auth-vg.sh \ omhttp-basic-vg.sh \ omhttp-batch-jsonarray-compress-vg.sh \ @@ -2218,6 +2231,8 @@ imfile-endregex-timeout-none.sh \ imfile-endregex-timeout-with-shutdown.sh \ imfile-endregex-timeout-with-shutdown-polling.sh \ + imfile-escapelf.replacement.sh \ + imfile-escapelf.replacement-empty.sh \ imfile-endmsg.regex.sh \ imfile-endmsg.regex-vg.sh \ imfile-endmsg.regex-with-example.sh \ @@ -2286,18 +2301,14 @@ imuxsock_logger_err.sh \ imuxsock_logger_root.sh \ imuxsock_logger_syssock.sh \ - resultdata/imuxsock_logger.log \ imuxsock_traillf.sh \ imuxsock_traillf_root.sh \ imuxsock_traillf_syssock.sh \ - resultdata/imuxsock_traillf.log \ imuxsock_ccmiddle.sh \ imuxsock_ccmiddle_root.sh \ imklog_permitnonkernelfacility_root.sh \ imuxsock_ccmiddle_syssock.sh \ - resultdata/imuxsock_ccmiddle.log \ imuxsock_hostname.sh \ - resultdata/imuxsock_hostname.log \ testsuites/mysql-truncate.sql \ testsuites/mysql-select-msg.sql \ libdbi-basic.sh \ diff -Nru rsyslog-8.2001.0/tests/Makefile.in rsyslog-8.2006.0/tests/Makefile.in --- rsyslog-8.2001.0/tests/Makefile.in 2020-01-14 12:59:36.000000000 +0000 +++ rsyslog-8.2006.0/tests/Makefile.in 2020-06-22 12:58:14.000000000 +0000 @@ -202,7 +202,13 @@ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ operatingstate-empty.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ operatingstate-unclean.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ smtradfile.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ loadbalance.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ empty-hostname.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-3164.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-3339.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-mysql.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-pgsql.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-subseconds.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ hostname-getaddrinfo-fail.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ msleep_usage_output.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mangle_qi_usage_output.sh \ @@ -228,6 +234,7 @@ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ glbl_setenv_err.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ glbl_setenv_err_too_long.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ glbl_setenv.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mmexternal-SegFault.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ nested-call-shutdown.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ dnscache-TTL-0.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ invalid_nested_include.sh \ @@ -313,8 +320,10 @@ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-msg-truncation-on-number2.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-NUL.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-NUL-rawmsg.sh \ -@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-multiport.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp_incomplete_frame_at_end.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-multiport.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-bigmessage-octetcounting.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-bigmessage-octetstuffing.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ da-queue-persist.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ daqueue-persist.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ daqueue-invld-qi.sh \ @@ -477,6 +486,7 @@ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ lookup_table_rscript_reload.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ lookup_table_rscript_reload_without_stub.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ include-obj-text-from-file.sh \ +@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ include-obj-text-from-file-noexist.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ multiple_lookup_tables.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ parsertest-parse1.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ parsertest-parse1-udp.sh \ @@ -515,7 +525,6 @@ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ rscript_backticks_empty_envvar-vg.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ rscript-config_enable-off-vg.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ prop-jsonmesg-vg.sh \ -@ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mmexternal-SegFault-vg.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mmexternal-InvldProg-vg.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ internal-errmsg-memleak-vg.sh \ @ENABLE_DEFAULT_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ glbl-oversizeMsg-log-vg.sh \ @@ -759,7 +768,9 @@ @ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-batch-lokirest-retry.sh \ @ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-batch-lokirest.sh \ @ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-batch-newline.sh \ -@ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-retry.sh +@ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-retry.sh \ +@ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-httpheaderkey.sh \ +@ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@ omhttp-multiplehttpheaders.sh @ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_45 = \ @ENABLE_OMHTTP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ omhttp-auth-vg.sh \ @@ -873,7 +884,8 @@ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_random.sh \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_hash32.sh \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_hash64.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_replace.sh +@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_replace.sh \ +@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ omfile-outchannel-many.sh @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_56 = \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imptcp_conndrop-vg.sh @@ -982,30 +994,30 @@ @ENABLE_MMDBLOOKUP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mmdb-vg.sh \ @ENABLE_MMDBLOOKUP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mmdb-multilevel-vg.sh -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_76 = \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-basic.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-basic-verifydepth.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp_conndrop_tls.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_rebind.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_hostname.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_ipv4.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_ipv6.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_certless_clientonly.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_servercert_gtls_clientanon.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_servercert_gtls_clientanon_legacy.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_serveranon_gtls_clientanon.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_priorityString.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_certvalid.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_certvalid_expired.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509fingerprint-invld.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509fingerprint.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509name-invld.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509name.sh - -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_77 = \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp-tls-basic-vg.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp_conndrop_tls-vg.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ manytcp-too-few-tls-vg.sh +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_76 = \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-basic.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-basic-verifydepth.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp_conndrop_tls.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_rebind.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_hostname.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_ipv4.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_anon_ipv6.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_certless_clientonly.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_servercert_gtls_clientanon.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_servercert_gtls_clientanon_legacy.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_serveranon_gtls_clientanon.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_priorityString.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_certvalid.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_certvalid_expired.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509fingerprint-invld.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509fingerprint.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509name-invld.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-gtls-x509name.sh + +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_77 = \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp-tls-basic-vg.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp_conndrop_tls-vg.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ manytcp-too-few-tls-vg.sh @ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_78 = \ @ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-ossl-basic.sh \ @@ -1029,13 +1041,14 @@ @ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-tls-ossl-error-key2.sh @ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_79 = \ -@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp-tls-ossl-basic-vg.sh +@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp-tls-ossl-basic-vg.sh \ +@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp-tls-ossl-basic-brokenhandshake-vg.sh -@ENABLE_GNUTLS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_80 = \ -@ENABLE_GNUTLS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_ossl_servercert_gtls_clientanon.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_ossl_serveranon_gtls_clientanon.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_servercert_ossl_clientanon.sh \ -@ENABLE_GNUTLS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_serveranon_ossl_clientanon.sh +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_80 = \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_ossl_servercert_gtls_clientanon.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_ossl_serveranon_gtls_clientanon.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_servercert_ossl_clientanon.sh \ +@ENABLE_GNUTLS_TESTS_TRUE@@ENABLE_OPENSSL_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_tls_gtls_serveranon_ossl_clientanon.sh @ENABLE_OMUXSOCK_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_81 = uxsock_simple.sh @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_82 = sndrcv_relp.sh \ @@ -1050,6 +1063,7 @@ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ imrelp-oversizeMode-truncate.sh \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ imrelp-oversizeMode-accept.sh \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ imrelp-invld-tlslib.sh \ +@ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ imrelp-bigmessage.sh \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ omrelp-invld-tlslib.sh \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_relp_dflt_pt.sh \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@ glbl-oversizeMsg-log.sh \ @@ -1070,11 +1084,13 @@ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_85 = \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imrelp-basic-vg.sh \ +@ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imrelp-sessionbreak-vg.sh \ @ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imrelp-manyconn-vg.sh @ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_86 = \ @ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ omudpspoof_errmsg_no_params.sh \ @ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_omudpspoof.sh \ +@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_omudpspoof-bigmsg.sh \ @ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_omudpspoof_nonstdpt.sh @@ -1093,17 +1109,7 @@ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest-nolimittag-udp.sh \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest-nolimittag.sh \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest-rfctag-udp.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest-rfctag.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-3164-udp.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-3164.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-3339-udp.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-3339.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-mysql-udp.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-mysql.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-pgsql-udp.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-pgsql.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-subseconds-udp.sh \ -@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp-subseconds.sh +@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest-rfctag.sh @ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_88 = \ @ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@ omruleset.sh \ @@ -1953,6 +1959,7 @@ urlencode.py \ dnscache-TTL-0.sh \ dnscache-TTL-0-vg.sh \ + loadbalance.sh \ smtradfile.sh \ smtradfile-vg.sh \ immark.sh \ @@ -2011,7 +2018,7 @@ imbatchreport_delete_toolarge.sh \ imbatchreport_rename_toolarge.sh \ imbatchreport_errmsg_no_params-vg.sh \ - mmexternal-SegFault-vg.sh \ + mmexternal-SegFault.sh \ mmexternal-SegFault-empty-jroot-vg.sh \ testsuites/mmexternal-SegFault-mm-python.py \ mmexternal-InvldProg-vg.sh \ @@ -2079,15 +2086,10 @@ proprepltest-nolimittag.sh \ proprepltest-rfctag-udp.sh \ proprepltest-rfctag.sh \ - timestamp-3164-udp.sh \ timestamp-3164.sh \ - timestamp-3339-udp.sh \ timestamp-3339.sh \ - timestamp-mysql-udp.sh \ timestamp-mysql.sh \ - timestamp-pgsql-udp.sh \ timestamp-pgsql.sh \ - timestamp-subseconds-udp.sh \ timestamp-subseconds.sh \ rsf_getenv.sh \ diskq-rfc5424.sh \ @@ -2097,6 +2099,7 @@ diskqueue-non-unique-prefix.sh \ arrayqueue.sh \ include-obj-text-from-file.sh \ + include-obj-text-from-file-noexist.sh \ include-obj-outside-control-flow-vg.sh \ include-obj-in-if-vg.sh \ include-obj-text-vg.sh \ @@ -2197,6 +2200,7 @@ omfile-whitespace-filename.sh \ omfile-read-only.sh \ omfile-outchannel.sh \ + omfile-outchannel-many.sh \ omfile_both_files_set.sh \ omfile_hup.sh \ omrabbitmq_no_params.sh \ @@ -2418,6 +2422,8 @@ imtcp-tls-basic-vg.sh \ imtcp_incomplete_frame_at_end.sh \ imtcp-multiport.sh \ + imtcp-bigmessage-octetcounting.sh \ + imtcp-bigmessage-octetstuffing.sh \ udp-msgreduc-orgmsg-vg.sh \ udp-msgreduc-vg.sh \ manytcp-too-few-tls-vg.sh \ @@ -2435,6 +2441,7 @@ imtcp-tls-ossl-x509name.sh \ imtcp-tls-ossl-x509fingerprint.sh \ imtcp-tls-ossl-basic-vg.sh \ + imtcp-tls-ossl-basic-brokenhandshake-vg.sh \ imtcp-tls-ossl-error-ca.sh \ imtcp-tls-ossl-error-cert.sh \ imtcp-tls-ossl-error-key.sh \ @@ -2522,6 +2529,8 @@ imrelp-oversizeMode-truncate.sh \ imrelp-oversizeMode-accept.sh \ imrelp-invld-tlslib.sh \ + imrelp-bigmessage.sh \ + imrelp-sessionbreak-vg.sh \ omrelp-invld-tlslib.sh \ glbl-oversizeMsg-log.sh \ glbl-oversizeMsg-truncate.sh \ @@ -2543,6 +2552,7 @@ sndrcv_udp_nonstdpt_v6.sh \ omudpspoof_errmsg_no_params.sh \ sndrcv_omudpspoof.sh \ + sndrcv_omudpspoof-bigmsg.sh \ sndrcv_omudpspoof_nonstdpt.sh \ sndrcv_gzip.sh \ action-tx-single-processing.sh \ @@ -2571,6 +2581,8 @@ omhttp-batch-lokirest.sh \ omhttp-batch-newline.sh \ omhttp-retry.sh \ + omhttp-httpheaderkey.sh \ + omhttp-multiplehttpheaders.sh \ omhttp-auth-vg.sh \ omhttp-basic-vg.sh \ omhttp-batch-jsonarray-compress-vg.sh \ @@ -2671,6 +2683,8 @@ imfile-endregex-timeout-none.sh \ imfile-endregex-timeout-with-shutdown.sh \ imfile-endregex-timeout-with-shutdown-polling.sh \ + imfile-escapelf.replacement.sh \ + imfile-escapelf.replacement-empty.sh \ imfile-endmsg.regex.sh \ imfile-endmsg.regex-vg.sh \ imfile-endmsg.regex-with-example.sh \ @@ -2739,18 +2753,14 @@ imuxsock_logger_err.sh \ imuxsock_logger_root.sh \ imuxsock_logger_syssock.sh \ - resultdata/imuxsock_logger.log \ imuxsock_traillf.sh \ imuxsock_traillf_root.sh \ imuxsock_traillf_syssock.sh \ - resultdata/imuxsock_traillf.log \ imuxsock_ccmiddle.sh \ imuxsock_ccmiddle_root.sh \ imklog_permitnonkernelfacility_root.sh \ imuxsock_ccmiddle_syssock.sh \ - resultdata/imuxsock_ccmiddle.log \ imuxsock_hostname.sh \ - resultdata/imuxsock_hostname.log \ testsuites/mysql-truncate.sql \ testsuites/mysql-select-msg.sql \ libdbi-basic.sh \ diff -Nru rsyslog-8.2001.0/tests/manyptcp.sh rsyslog-8.2006.0/tests/manyptcp.sh --- rsyslog-8.2001.0/tests/manyptcp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/manyptcp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,25 +1,22 @@ #!/bin/bash +# test imptcp with large connection count # test many concurrent tcp connections -echo ==================================================================================== -echo TEST: \[manyptcp.sh\]: test imptcp with large connection count +# released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=40000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imptcp/.libs/imptcp -$MainMsgQueueTimeoutShutdown 10000 $MaxOpenFiles 2000 -$InputPTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") -$template outfmt,"%msg:F,58:2%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile;outfmt +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +:msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -# the config file specifies exactly 1100 connections -tcpflood -c1000 -m40000 -# the sleep below is needed to prevent too-early termination of the tcp listener -sleep 1 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # we need to wait until rsyslogd is finished! -seq_check 0 39999 +tcpflood -c1000 -m$NUMMESSAGES +shutdown_when_empty +wait_shutdown +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/manytcp.sh rsyslog-8.2006.0/tests/manytcp.sh --- rsyslog-8.2001.0/tests/manytcp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/manytcp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -7,11 +7,9 @@ export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 $MaxOpenFiles 2100 -$InputTCPMaxSessions 1100 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp" maxSessions="2100") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! diff -Nru rsyslog-8.2001.0/tests/manytcp-too-few-tls-vg.sh rsyslog-8.2006.0/tests/manytcp-too-few-tls-vg.sh --- rsyslog-8.2001.0/tests/manytcp-too-few-tls-vg.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/manytcp-too-few-tls-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -7,22 +7,19 @@ export TB_TEST_MAX_RUNTIME=1800 # this test is VERY slow, so we need to override max runtime generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 $MaxOpenFiles 200 -$InputTCPMaxSessions 1100 global( defaultNetstreamDriverCAFile="'$srcdir'/testsuites/x.509/ca.pem" - defaultNetstreamDriverCertFile="'$srcdir/testsuites'/x.509/client-cert.pem" - defaultNetstreamDriverKeyFile="'$srcdir/testsuites'/x.509/client-key.pem" + defaultNetstreamDriverCertFile="'$srcdir'/testsuites/x.509/client-cert.pem" + defaultNetstreamDriverKeyFile="'$srcdir'/testsuites/x.509/client-key.pem" defaultNetstreamDriver="gtls" debug.whitelist="on" debug.files=["nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"] ) -$InputTCPServerStreamDriverMode 1 -$InputTCPServerStreamDriverAuthMode anon -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp" maxSessions="1100" + streamDriver.mode="1" streamDriver.authMode="anon") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! @@ -32,7 +29,8 @@ # the config file specifies exactly 1100 connections tcpflood -c1000 -m$NUMMESSAGES -Ttls -x$srcdir/testsuites/x.509/ca.pem -Z$srcdir/testsuites/x.509/client-cert.pem -z$srcdir/testsuites/x.509/client-key.pem # the sleep below is needed to prevent too-early termination of the tcp listener -sleep 2 +# note: this must not be precise, as message loss is acceptable +sleep 5 shutdown_when_empty wait_shutdown_vg check_exit_vg diff -Nru rsyslog-8.2001.0/tests/mmexternal-SegFault-empty-jroot-vg.sh rsyslog-8.2006.0/tests/mmexternal-SegFault-empty-jroot-vg.sh --- rsyslog-8.2001.0/tests/mmexternal-SegFault-empty-jroot-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmexternal-SegFault-empty-jroot-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,32 +1,23 @@ #!/bin/bash # add 2017-11-06 by PascalWithopf, released under ASL 2.0 - . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") module(load="../plugins/mmexternal/.libs/mmexternal") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="-%$!%-\n") if $msg contains "msgnum:" then { action(type="mmexternal" interface.input="fulljson" - binary="testsuites/mmexternal-SegFault-mm-python.py") + binary="'$PYTHON' '${srcdir}'/testsuites/mmexternal-SegFault-mm-python.py") action(type="omfile" template="outfmt" file=`echo $RSYSLOG_OUT_LOG`) } ' startup_vg -tcpflood -m1 -M "\"<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1\"" +injectmsg litteral "<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1" shutdown_when_empty wait_shutdown_vg check_exit_vg - -echo '-{ "sometag": "somevalue" }-' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - +export EXPECTED='-{ "sometag": "somevalue" }-' +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/mmexternal-SegFault.sh rsyslog-8.2006.0/tests/mmexternal-SegFault.sh --- rsyslog-8.2001.0/tests/mmexternal-SegFault.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmexternal-SegFault.sh 2020-05-28 10:29:49.000000000 +0000 @@ -0,0 +1,25 @@ +#!/bin/bash +# a case that actually caused a segfault +# add 2017-11-06 by PascalWithopf, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/mmexternal/.libs/mmexternal") +set $!x = "a"; + +template(name="outfmt" type="string" string="-%$!%-\n") + +if $msg contains "msgnum:" then { + action(type="mmexternal" interface.input="fulljson" + binary="'$PYTHON' '${srcdir}'/testsuites/mmexternal-SegFault-mm-python.py") + action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'") +} +' +startup +injectmsg literal "<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1" +shutdown_when_empty +wait_shutdown + +export EXPECTED='-{ "x": "a", "sometag": "somevalue" }-' +cmp_exact +exit_test diff -Nru rsyslog-8.2001.0/tests/mmexternal-SegFault-vg.sh rsyslog-8.2006.0/tests/mmexternal-SegFault-vg.sh --- rsyslog-8.2001.0/tests/mmexternal-SegFault-vg.sh 2020-01-13 17:41:18.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmexternal-SegFault-vg.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -#!/bin/bash -# a case that actually caused a segfault -# add 2017-11-06 by PascalWithopf, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -module(load="../plugins/mmexternal/.libs/mmexternal") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") -set $!x = "a"; - -template(name="outfmt" type="string" string="-%$!%-\n") - -if $msg contains "msgnum:" then { - action(type="mmexternal" interface.input="fulljson" - binary="'$PYTHON' '${srcdir}'/testsuites/mmexternal-SegFault-mm-python.py") - action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'") -} -' -startup -#startup_vg -tcpflood -m1 -M "\"<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1\"" -shutdown_when_empty -wait_shutdown -#wait_shutdown_vg -#check_exit_vg - -export EXPECTED='-{ "x": "a", "sometag": "somevalue" }-' -cmp_exact -exit_test diff -Nru rsyslog-8.2001.0/tests/mmjsonparse_cim2.sh rsyslog-8.2006.0/tests/mmjsonparse_cim2.sh --- rsyslog-8.2001.0/tests/mmjsonparse_cim2.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmjsonparse_cim2.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,8 @@ #!/bin/bash # add 2018-04-16 by Pascal Withopf, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' template(name="outfmt" type="string" string="%$!cim!msgnum%\n") @@ -15,9 +17,9 @@ } ' startup -tcpflood -m 5000 -j "@cim: " +tcpflood -m $NUMMESSAGES -j "@cim: " shutdown_when_empty wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/mmjsonparse_cim.sh rsyslog-8.2006.0/tests/mmjsonparse_cim.sh --- rsyslog-8.2001.0/tests/mmjsonparse_cim.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmjsonparse_cim.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,9 +1,10 @@ #!/bin/bash # added 2014-07-15 by rgerhards +# basic test for mmjsonparse module with "cim" cookie # This file is part of the rsyslog project, released under ASL 2.0 -echo =============================================================================== -echo \[mmjsonparse_cim.sh\]: basic test for mmjsonparse module with "cim" cookie . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' template(name="outfmt" type="string" string="%$!cim!msgnum%\n") @@ -18,10 +19,8 @@ } ' startup -tcpflood -m 5000 -j "@cim: " -echo doing shutdown +tcpflood -m $NUMMESSAGES -j "@cim: " shutdown_when_empty -echo wait on shutdown wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/mmjsonparse_localvar.sh rsyslog-8.2006.0/tests/mmjsonparse_localvar.sh --- rsyslog-8.2001.0/tests/mmjsonparse_localvar.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmjsonparse_localvar.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,8 @@ #!/bin/bash # added 2018-04-16 by Rainer Gerhards, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' template(name="outfmt" type="string" string="%$.msgnum%\n") @@ -15,9 +17,9 @@ } ' startup -tcpflood -m 5000 -j "@cim: " +tcpflood -m $NUMMESSAGES -j "@cim: " shutdown_when_empty wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/mmjsonparse_simple.sh rsyslog-8.2006.0/tests/mmjsonparse_simple.sh --- rsyslog-8.2001.0/tests/mmjsonparse_simple.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmjsonparse_simple.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,9 +1,10 @@ #!/bin/bash # added 2014-07-15 by rgerhards +# basic test for mmjsonparse module with defaults # This file is part of the rsyslog project, released under ASL 2.0 -echo =============================================================================== -echo \[mmjsonparse_simple.sh\]: basic test for mmjsonparse module with defaults . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' template(name="outfmt" type="string" string="%$!msgnum%\n") @@ -18,10 +19,8 @@ } ' startup -tcpflood -m 5000 -j "@cee: " -echo doing shutdown +tcpflood -m $NUMMESSAGES -j "@cee: " shutdown_when_empty -echo wait on shutdown wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/mmjsonparse-w-o-cookie-multi-spaces.sh rsyslog-8.2006.0/tests/mmjsonparse-w-o-cookie-multi-spaces.sh --- rsyslog-8.2001.0/tests/mmjsonparse-w-o-cookie-multi-spaces.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmjsonparse-w-o-cookie-multi-spaces.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,8 @@ #!/bin/bash # addd 2016-03-22 by RGerhards, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' template(name="outfmt" type="string" string="%$!msgnum%\n") @@ -16,8 +18,8 @@ ' rm -f $RSYSLOG_OUT_LOG # do cleanup of previous subtest startup -tcpflood -m 5000 "-j \" \"" +tcpflood -m $NUMMESSAGES "-j \" \"" shutdown_when_empty wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/mmjsonparse-w-o-cookie.sh rsyslog-8.2006.0/tests/mmjsonparse-w-o-cookie.sh --- rsyslog-8.2001.0/tests/mmjsonparse-w-o-cookie.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmjsonparse-w-o-cookie.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,6 +1,8 @@ #!/bin/bash # addd 2016-03-22 by RGerhards, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' template(name="outfmt" type="string" string="%$!msgnum%\n") @@ -16,8 +18,8 @@ ' rm -f $RSYSLOG_OUT_LOG # do cleanup of previous subtest startup -tcpflood -m 5000 "-j \" \"" +tcpflood -m $NUMMESSAGES "-j \" \"" shutdown_when_empty wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/mmpstrucdata-escaping.sh rsyslog-8.2006.0/tests/mmpstrucdata-escaping.sh --- rsyslog-8.2001.0/tests/mmpstrucdata-escaping.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/mmpstrucdata-escaping.sh 2020-05-28 10:29:49.000000000 +0000 @@ -13,7 +13,7 @@ action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral '<85>1 2019-08-27T13:02:58.000+01:00 A/B-896747 ABC LMBNI SUCCESS [origin software="ABC" swVersion="47.1"][ABC@32473 eventType="XYZ:IPIP,9:\"free -m\";" remoteIp="192.0.2.1" singleTick="D'"'"'E" bracket="1\]2"] TESTMESSAGE' +injectmsg literal '<85>1 2019-08-27T13:02:58.000+01:00 A/B-896747 ABC LMBNI SUCCESS [origin software="ABC" swVersion="47.1"][ABC@32473 eventType="XYZ:IPIP,9:\"free -m\";" remoteIp="192.0.2.1" singleTick="D'"'"'E" bracket="1\]2"] TESTMESSAGE' shutdown_when_empty wait_shutdown export EXPECTED='{ "origin": { "software": "ABC", "swversion": "47.1" }, "abc@32473": { "eventtype": "XYZ:IPIP,9:\"free -m\";", "remoteip": "192.0.2.1", "singletick": "D'"'"'E", "bracket": "1]2" } }' diff -Nru rsyslog-8.2001.0/tests/mysql-actq-mt-withpause.sh rsyslog-8.2006.0/tests/mysql-actq-mt-withpause.sh --- rsyslog-8.2001.0/tests/mysql-actq-mt-withpause.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/mysql-actq-mt-withpause.sh 2020-05-28 10:29:49.000000000 +0000 @@ -14,7 +14,7 @@ queue.workerthreads="5" queue.workerthreadMinimumMessages="500" queue.timeoutWorkerthreadShutdown="1000" - queue.timeoutEnqueue="10000" + queue.timeoutEnqueue="20000" ) } ' diff -Nru rsyslog-8.2001.0/tests/no-dynstats-json.sh rsyslog-8.2006.0/tests/no-dynstats-json.sh --- rsyslog-8.2001.0/tests/no-dynstats-json.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/no-dynstats-json.sh 2020-05-28 10:29:49.000000000 +0000 @@ -15,7 +15,7 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG`) ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/no-dynstats.sh rsyslog-8.2006.0/tests/no-dynstats.sh --- rsyslog-8.2001.0/tests/no-dynstats.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/no-dynstats.sh 2020-05-28 10:29:49.000000000 +0000 @@ -15,7 +15,7 @@ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG`) ' startup -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/now_family_utc.sh rsyslog-8.2006.0/tests/now_family_utc.sh --- rsyslog-8.2001.0/tests/now_family_utc.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/now_family_utc.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,13 +1,14 @@ #!/bin/bash -# test many concurrent tcp connections +# test $NOW family of system properties # addd 2016-01-12 by RGerhards, released under ASL 2.0 # requires faketime -echo \[now_family_utc\]: test \$NOW family of system properties . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=1 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%$hour%:%$minute%,%$hour-utc%:%$minute-utc%\n") @@ -25,12 +26,7 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "01:00,07:30" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; - +export EXPECTED="01:00,07:30" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/now-utc-casecmp.sh rsyslog-8.2006.0/tests/now-utc-casecmp.sh --- rsyslog-8.2001.0/tests/now-utc-casecmp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/now-utc-casecmp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -11,8 +11,8 @@ generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%$Now%:%$Year%-%$Month%-%$Day%,%$Now-utc%:%$Year-utc%-%$Month-utc%-%$Day-utc%\n") @@ -29,7 +29,7 @@ if [ ! $? -eq 0 ]; then echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" cat $RSYSLOG_OUT_LOG - exit 1 + error-exit 1 fi; diff -Nru rsyslog-8.2001.0/tests/now-utc.sh rsyslog-8.2006.0/tests/now-utc.sh --- rsyslog-8.2001.0/tests/now-utc.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/now-utc.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,8 +6,8 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%$now%,%$now-utc%\n") @@ -25,12 +25,6 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "2016-01-01,2015-12-31" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; - - +export EXPECTED="2016-01-01,2015-12-31" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/now-utc-ymd.sh rsyslog-8.2006.0/tests/now-utc-ymd.sh --- rsyslog-8.2001.0/tests/now-utc-ymd.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/now-utc-ymd.sh 2020-05-28 10:29:49.000000000 +0000 @@ -11,8 +11,8 @@ generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%$year%-%$month%-%$day%,%$year-utc%-%$month-utc%-%$day-utc%\n") @@ -25,12 +25,5 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "2016-01-01,2015-12-31" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; - - +export EXPECTED="2016-01-01,2015-12-31" exit_test diff -Nru rsyslog-8.2001.0/tests/omfile_hup-vg.sh rsyslog-8.2006.0/tests/omfile_hup-vg.sh --- rsyslog-8.2001.0/tests/omfile_hup-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omfile_hup-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,4 +1,4 @@ #!/bin/bash export USE_VALGRIND="YES" -export NUMMESSAGES=400000 # reduce for slower valgrind run +export NUMMESSAGES=200000 # reduce for slower valgrind run source ${srcdir:-.}/omfile_hup.sh diff -Nru rsyslog-8.2001.0/tests/omfile-outchannel-many.sh rsyslog-8.2006.0/tests/omfile-outchannel-many.sh --- rsyslog-8.2001.0/tests/omfile-outchannel-many.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/omfile-outchannel-many.sh 2020-06-05 10:06:07.000000000 +0000 @@ -0,0 +1,54 @@ +#!/bin/bash +# addd 2018-08-02 by RGerhards, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +export NUMMESSAGES=500000 +echo "ls -l $RSYSLOG_DYNNAME.channel.* +mv -f $RSYSLOG_DYNNAME.channel.log.prev.9 $RSYSLOG_DYNNAME.channel.log.prev.10 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.8 $RSYSLOG_DYNNAME.channel.log.prev.9 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.7 $RSYSLOG_DYNNAME.channel.log.prev.8 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.6 $RSYSLOG_DYNNAME.channel.log.prev.7 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.5 $RSYSLOG_DYNNAME.channel.log.prev.6 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.4 $RSYSLOG_DYNNAME.channel.log.prev.5 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.3 $RSYSLOG_DYNNAME.channel.log.prev.4 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.2 $RSYSLOG_DYNNAME.channel.log.prev.3 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev.1 $RSYSLOG_DYNNAME.channel.log.prev.2 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log.prev $RSYSLOG_DYNNAME.channel.log.prev.1 2>/dev/null +mv -f $RSYSLOG_DYNNAME.channel.log $RSYSLOG_DYNNAME.channel.log.prev +" > $RSYSLOG_DYNNAME.rotate.sh +chmod +x $RSYSLOG_DYNNAME.rotate.sh +generate_conf +add_conf ' +main_queue( + queue.workerthreads="4" + queue.timeoutWorkerthreadShutdown="-1" + queue.workerThreadMinimumMessages="10" +) +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="tcp") +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +module(load="builtin:omfile" template="outfmt") +$outchannel log_rotation,'$RSYSLOG_DYNNAME.channel.log', $NUMMESSAGES,./'$RSYSLOG_DYNNAME.rotate.sh' + +if $msg contains "msgnum:" then { +# if $/num % 2 == 0 then + :omfile:$log_rotation +# else +# :omfile:$log_rotation2 +# set $/num = $/num + 1; +} + +ruleset(name="tcp") { + :omfile:$log_rotation2 +} +' +startup +./tcpflood -p$TCPFLOOD_PORT -m$NUMMESSAGES & # TCPFlood needs to run async! +#./msleep 2500 +injectmsg +sleep 1 +shutdown_when_empty +wait_shutdown +ls -l $RSYSLOG_DYNNAME.channel.* +cat $RSYSLOG_DYNNAME.channel.* > $RSYSLOG_OUT_LOG +seq_check +exit_test diff -Nru rsyslog-8.2001.0/tests/omfile-read-only.sh rsyslog-8.2006.0/tests/omfile-read-only.sh --- rsyslog-8.2001.0/tests/omfile-read-only.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/omfile-read-only.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,22 +1,18 @@ #!/bin/bash # addd 2016-06-16 by RGerhards, released under ASL 2.0 - +. ${srcdir:=.}/diag.sh init messages=20000 # how many messages to inject? # Note: we need to inject a somewhat larger number of messages in order # to ensure that we receive some messages in the actual output file, # as batching can (validly) cause a larger loss in the non-writable # file -. ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%msg:F,58:2%\n") :msg, contains, "msgnum:" { - action(type="omfile" template="outfmt" file=`echo $RSYSLOG2_OUT_LOG`) - action(type="omfile" template="outfmt" file=`echo $RSYSLOG_OUT_LOG` + action(type="omfile" template="outfmt" file="'$RSYSLOG2_OUT_LOG'") + action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'" action.execOnlyWhenPreviousIsSuspended="on" ) } diff -Nru rsyslog-8.2001.0/tests/omhttp-batch-jsonarray.sh rsyslog-8.2006.0/tests/omhttp-batch-jsonarray.sh --- rsyslog-8.2001.0/tests/omhttp-batch-jsonarray.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omhttp-batch-jsonarray.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,7 +3,6 @@ # Starting actual testbench . ${srcdir:=.}/diag.sh init - export NUMMESSAGES=50000 port="$(get_free_port)" diff -Nru rsyslog-8.2001.0/tests/omhttp-httpheaderkey.sh rsyslog-8.2006.0/tests/omhttp-httpheaderkey.sh --- rsyslog-8.2001.0/tests/omhttp-httpheaderkey.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/omhttp-httpheaderkey.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,44 @@ +#!/bin/bash +# This file is part of the rsyslog project, released under ASL 2.0 + +# Starting actual testbench +. ${srcdir:=.}/diag.sh init + +export NUMMESSAGES=1000 + +port="$(get_free_port)" +omhttp_start_server $port + +generate_conf +add_conf ' +template(name="tpl" type="string" + string="{\"msgnum\":\"%msg:F,58:2%\"}") + +module(load="../contrib/omhttp/.libs/omhttp") + +if $msg contains "msgnum:" then + action( + # Payload + name="my_http_action" + type="omhttp" + errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'" + template="tpl" + httpheaderkey="X-Insert-Key" + httpheadervalue="dummy-value" + server="localhost" + serverport="'$port'" + restpath="my/endpoint" + batch="off" + + # Auth + usehttps="off" + ) +' +startup +injectmsg +shutdown_when_empty +wait_shutdown +omhttp_get_data $port my/endpoint +omhttp_stop_server +seq_check +exit_test diff -Nru rsyslog-8.2001.0/tests/omhttp-multiplehttpheaders.sh rsyslog-8.2006.0/tests/omhttp-multiplehttpheaders.sh --- rsyslog-8.2001.0/tests/omhttp-multiplehttpheaders.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/omhttp-multiplehttpheaders.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,46 @@ +#!/bin/bash +# This file is part of the rsyslog project, released under ASL 2.0 + +# Starting actual testbench +. ${srcdir:=.}/diag.sh init + +export NUMMESSAGES=1000 + +port="$(get_free_port)" +omhttp_start_server $port + +generate_conf +add_conf ' +template(name="tpl" type="string" + string="{\"msgnum\":\"%msg:F,58:2%\"}") + +module(load="../contrib/omhttp/.libs/omhttp") + +if $msg contains "msgnum:" then + action( + # Payload + name="my_http_action" + type="omhttp" + errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'" + template="tpl" + httpheaders=[ + "X-Insert-Key: dummy-value", + "X-Event-Source: logs" + ] + server="localhost" + serverport="'$port'" + restpath="my/endpoint" + batch="off" + + # Auth + usehttps="off" + ) +' +startup +injectmsg +shutdown_when_empty +wait_shutdown +omhttp_get_data $port my/endpoint +omhttp_stop_server +seq_check +exit_test diff -Nru rsyslog-8.2001.0/tests/omhttp_server.py rsyslog-8.2006.0/tests/omhttp_server.py --- rsyslog-8.2001.0/tests/omhttp_server.py 2019-10-30 17:45:57.000000000 +0000 +++ rsyslog-8.2006.0/tests/omhttp_server.py 2020-05-28 10:29:49.000000000 +0000 @@ -1,5 +1,4 @@ -#!/usr/bin/env python - +# call this via "python[3] script name" import argparse import json import os diff -Nru rsyslog-8.2001.0/tests/omkafkadynakey.sh rsyslog-8.2006.0/tests/omkafkadynakey.sh --- rsyslog-8.2001.0/tests/omkafkadynakey.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omkafkadynakey.sh 2020-05-28 10:29:49.000000000 +0000 @@ -96,17 +96,19 @@ count=$(wc -l < ${RSYSLOG_OUT_LOG}) if [ $count -eq $TESTMESSAGESFULL ]; then printf '**** wait-kafka-lines success, have %d lines ****\n\n' "$TESTMESSAGESFULL" - kafkacat -b localhost:29092 -e -C -o beginning -t HNyjt9vf -f '%p %k\n' | sort | uniq > $RSYSLOG_OUT_LOG - count=$(wc -l < ${RSYSLOG_OUT_LOG}) + kafkacat -b localhost:29092 -e -C -o beginning -t $RANDTOPIC -f '%p %k\n' | sort | uniq > "$RSYSLOG_OUT_LOG.extra" + count=$(wc -l < "${RSYSLOG_OUT_LOG}.extra") if [ $count -eq 10 ]; then printf '**** partition check success, have 10 partition-key combinations ****\n\n' break else - echo partition check failed, expected 10 got $count - echo details: - kafkacat -b localhost:29092 -e -C -o beginning -t HNyjt9vf -f '%p %k\n' | sort | uniq shutdown_when_empty wait_shutdown + printf '\n\nERROR: partition check failed, expected 10 got %s\n' "$count" + printf '\ņRAW DATA:\n' + kafkacat -b localhost:29092 -e -C -o beginning -t $RANDTOPIC -f '%p %k\n' + printf '\nCHECKED OUTPUT:\n' + cat "$RSYSLOG_OUT_LOG.extra" error_exit 1 fi else @@ -118,12 +120,15 @@ else echo wait-file-lines not yet there, currently $count lines printf 'pstats data:\n' - cat $RSYSLOG_DYNNAME.pstats + # we use tail below to guard against overwhelming the + # logs if things go wild + tail -n 500 < $RSYSLOG_DYNNAME.pstats printf '\n' $TESTTOOL_DIR/msleep 1000 fi fi +echo end iteration $timecounter done unset count diff -Nru rsyslog-8.2001.0/tests/omprog-output-capture-mt.sh rsyslog-8.2006.0/tests/omprog-output-capture-mt.sh --- rsyslog-8.2001.0/tests/omprog-output-capture-mt.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/omprog-output-capture-mt.sh 2020-06-22 12:57:15.000000000 +0000 @@ -20,14 +20,13 @@ export NUMMESSAGES=20000 if [[ "$(uname)" == "Linux" ]]; then - LINE_LENGTH=4095 # 4KB minus 1 byte (for the newline char) + export LINE_LENGTH=4095 # 4KB minus 1 byte (for the newline char) else - LINE_LENGTH=511 # 512 minus 1 byte (for the newline char) + export LINE_LENGTH=511 # 512 minus 1 byte (for the newline char) fi -export command_line="$PYTHON $srcdir/testsuites/omprog-output-capture-mt-bin.py $LINE_LENGTH" empty_check() { - if [ $(wc -l < "$RSYSLOG_OUT_LOG") -eq $((NUMMESSAGES * 2)) ]; then + if [ $(wc -l < "$RSYSLOG_OUT_LOG") -ge $((NUMMESSAGES * 2)) ]; then return 0 fi return 1 @@ -47,7 +46,7 @@ :msg, contains, "msgnum:" { action( type="omprog" - binary=`echo $command_line` + binary="'$PYTHON' '$srcdir'/testsuites/omprog-output-capture-mt-bin.py '$LINE_LENGTH'" template="outfmt" name="omprog_action" queue.type="LinkedList" # use a dedicated queue @@ -60,9 +59,15 @@ } ' startup + +# Issue a HUP signal when the output-capture thread has not started yet, +# to check that this case is handled correctly (the output file has not +# been opened yet, so omprog must not try to reopen it). +issue_HUP + injectmsg 0 $NUMMESSAGES -# Issue some HUP signals to cause the output file to be reopened during +# Issue more HUP signals to cause the output file to be reopened during # writing (not a complete test of this feature, but at least we check it # doesn't break the output). issue_HUP diff -Nru rsyslog-8.2001.0/tests/omprog-restart-terminated-vg.sh rsyslog-8.2006.0/tests/omprog-restart-terminated-vg.sh --- rsyslog-8.2001.0/tests/omprog-restart-terminated-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omprog-restart-terminated-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,75 +1,4 @@ #!/bin/bash -# This file is part of the rsyslog project, released under ASL 2.0 - -# Same test than 'omprog-restart-terminated.sh', but checking for memory -# problems using valgrind. Note it is not necessary to repeat the -# rest of checks (this simplifies the maintenance of the tests). - -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/omprog/.libs/omprog") - -template(name="outfmt" type="string" string="%msg%\n") - -:msg, contains, "msgnum:" { - action( - type="omprog" - binary="'$RSYSLOG_DYNNAME'.omprog-restart-terminated-bin.sh" - template="outfmt" - name="omprog_action" - queue.type="Direct" # the default; facilitates sync with the child process - confirmMessages="on" # facilitates sync with the child process - action.resumeRetryCount="3" - action.resumeInterval="1" - action.reportSuspensionContinuation="on" - signalOnClose="off" - ) -} -' - -# We need a test-specific program name, as the test needs to signal the child process -cp -f $srcdir/testsuites/omprog-restart-terminated-bin.sh $RSYSLOG_DYNNAME.omprog-restart-terminated-bin.sh - -# On Solaris 10, the output of ps is truncated for long process names; use /usr/ucb/ps instead: -if [[ $(uname) = "SunOS" && $(uname -r) = "5.10" ]]; then - function get_child_pid { - /usr/ucb/ps -awwx | grep "$RSYSLOG_DYNNAME.[o]mprog-restart-terminated-bin.sh" | awk '{ print $1 }' - } -else - function get_child_pid { - ps -ef | grep "$RSYSLOG_DYNNAME.[o]mprog-restart-terminated-bin.sh" | awk '{ print $2 }' - } -fi - -startup_vg -injectmsg 0 1 -injectmsg 1 1 -injectmsg 2 1 -wait_queueempty - -kill -s USR1 $(get_child_pid) -./msleep 100 - -injectmsg 3 1 -injectmsg 4 1 -wait_queueempty - -kill -s TERM $(get_child_pid) -./msleep 100 - -injectmsg 5 1 -injectmsg 6 1 -injectmsg 7 1 -wait_queueempty - -kill -s KILL $(get_child_pid) -./msleep 100 - -injectmsg 8 1 -injectmsg 9 1 - -shutdown_when_empty -wait_shutdown_vg -check_exit_vg -exit_test +# addd 2019-04-15 by RGerhards, released under ASL 2.0 +export USE_VALGRIND="YES" +source ${srcdir:=.}/omprog-restart-terminated.sh diff -Nru rsyslog-8.2001.0/tests/omprog-single-instance-outfile.sh rsyslog-8.2006.0/tests/omprog-single-instance-outfile.sh --- rsyslog-8.2001.0/tests/omprog-single-instance-outfile.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/omprog-single-instance-outfile.sh 2020-06-22 12:57:15.000000000 +0000 @@ -5,48 +5,34 @@ # parameter. Checks that the output of the program is correctly captured # when the 'forceSingleInstance' flag is enabled. -NUMBER_OF_MESSAGES=10000 # number of logs to send - . ${srcdir:=.}/diag.sh init - -uname -if [ $(uname) = "SunOS" ] ; then - # On Solaris, this test causes rsyslog to hang for unknown reasons - echo "Solaris: FIX ME" - exit 77 -fi - +skip_platform "SunOS" "This test currently does not work on Solaris" +export NUMMESSAGES=10000 # number of logs to send +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") module(load="../plugins/omprog/.libs/omprog") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%msg%\n") -main_queue( - queue.timeoutShutdown="30000" # long shutdown timeout for the main queue -) - :msg, contains, "msgnum:" { action( type="omprog" - binary=`echo $srcdir/testsuites/omprog-single-instance-bin.sh` + binary="'$srcdir'/testsuites/omprog-single-instance-bin.sh" template="outfmt" name="omprog_action" confirmMessages="on" forceSingleInstance="on" queue.type="LinkedList" # use a dedicated queue queue.workerThreads="10" # ...with multiple workers - queue.size="10000" # ...high capacity (default is 1000) + queue.size="5000" # ...high capacity (default is 1000) queue.timeoutShutdown="30000" # ...and a long shutdown timeout - output=`echo $RSYSLOG2_OUT_LOG` + output="'$RSYSLOG2_OUT_LOG'" ) } ' startup -tcpflood -m$NUMBER_OF_MESSAGES +injectmsg shutdown_when_empty wait_shutdown @@ -54,12 +40,12 @@ line_num=0 while IFS= read -r line; do ((line_num++)) - if [[ $line_num == 1 ]]; then + if (( line_num == 1 )); then if [[ "$line" != "[stderr] Starting" ]]; then echo "unexpected first line in captured stderr: $line" error_exit 1 fi - elif [[ $line_num == $(($NUMBER_OF_MESSAGES + 2)) ]]; then + elif (( line_num == NUMMESSAGES + 2 )); then if [[ "$line" != "[stderr] Terminating" ]]; then echo "unexpected last line in captured stderr: $line" error_exit 1 @@ -70,15 +56,15 @@ fi done < $RSYSLOG2_OUT_LOG -if (( $line_num != $(($NUMBER_OF_MESSAGES + 2)) )); then - echo "unexpected line count in captured stderr: $line_num (expected: $(($NUMBER_OF_MESSAGES + 2)))" +if (( line_num != NUMMESSAGES + 2 )); then + echo "unexpected line count in captured stderr: $line_num (expected: $((NUMMESSAGES + 2)))" error_exit 1 fi # Note: we use awk here to remove leading spaces returned by wc on FreeBSD line_count=$(wc -l < ${RSYSLOG_OUT_LOG} | awk '{print $1}') -if (( $line_count != $(($NUMBER_OF_MESSAGES + 2)) )); then - echo "unexpected line count in output: $line_count (expected: $(($NUMBER_OF_MESSAGES + 2)))" +if (( line_count != NUMMESSAGES + 2 )); then + echo "unexpected line count in output: $line_count (expected: $((NUMMESSAGES + 2)))" error_exit 1 fi diff -Nru rsyslog-8.2001.0/tests/omprog-single-instance.sh rsyslog-8.2006.0/tests/omprog-single-instance.sh --- rsyslog-8.2001.0/tests/omprog-single-instance.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/omprog-single-instance.sh 2020-06-22 12:57:15.000000000 +0000 @@ -5,47 +5,33 @@ # that only one instance of the program is started when multiple # workers are in effect. -NUMBER_OF_MESSAGES=10000 # number of logs to send - . ${srcdir:=.}/diag.sh init - -uname -if [ $(uname) = "SunOS" ] ; then - # On Solaris, this test causes rsyslog to hang for unknown reasons - echo "Solaris: FIX ME" - exit 77 -fi - +skip_platform "SunOS" "This test currently does not work on Solaris " +export NUMMESSAGES=10000 # number of logs to send +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") module(load="../plugins/omprog/.libs/omprog") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%msg%\n") -main_queue( - queue.timeoutShutdown="30000" # long shutdown timeout for the main queue -) - :msg, contains, "msgnum:" { action( type="omprog" - binary=`echo $srcdir/testsuites/omprog-single-instance-bin.sh` + binary="'$srcdir'/testsuites/omprog-single-instance-bin.sh" template="outfmt" name="omprog_action" confirmMessages="on" forceSingleInstance="on" queue.type="LinkedList" # use a dedicated queue queue.workerThreads="10" # ...with multiple workers - queue.size="10000" # ...high capacity (default is 1000) + queue.size="5000" # ...high capacity (default is 1000) queue.timeoutShutdown="30000" # ...and a long shutdown timeout ) } ' startup -tcpflood -m$NUMBER_OF_MESSAGES +injectmsg shutdown_when_empty wait_shutdown @@ -53,12 +39,12 @@ line_num=0 while IFS= read -r line; do ((line_num++)) - if [[ $line_num == 1 ]]; then + if (( line_num == 1 )); then if [[ "$line" != "Starting" ]]; then echo "unexpected first line in output: $line" error_exit 1 fi - elif [[ $line_num == $(($NUMBER_OF_MESSAGES + 2)) ]]; then + elif (( line_num == NUMMESSAGES + 2 )); then if [[ "$line" != "Terminating" ]]; then echo "unexpected last line in output: $line" error_exit 1 @@ -69,8 +55,8 @@ fi done < $RSYSLOG_OUT_LOG -if (( $line_num != $(($NUMBER_OF_MESSAGES + 2)) )); then - echo "unexpected line count in output: $line_num (expected: $(($NUMBER_OF_MESSAGES + 2)))" +if (( line_num != NUMMESSAGES + 2 )); then + echo "unexpected line count in output: $line_num (expected: $((NUMMESSAGES + 2)))" error_exit 1 fi diff -Nru rsyslog-8.2001.0/tests/omprog-single-instance-vg.sh rsyslog-8.2006.0/tests/omprog-single-instance-vg.sh --- rsyslog-8.2001.0/tests/omprog-single-instance-vg.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/omprog-single-instance-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,52 +1,4 @@ #!/bin/bash -# This file is part of the rsyslog project, released under ASL 2.0 - -# Same test than 'omprog-force-single-instance.sh', but checking for -# memory problems using valgrind. Note it is not necessary to repeat -# the rest of checks (this simplifies the maintenance of the tests). - -NUMBER_OF_MESSAGES=10000 # number of logs to send - -. ${srcdir:=.}/diag.sh init - -uname -if [ $(uname) = "SunOS" ] ; then - # On Solaris, this test causes rsyslog to hang for unknown reasons - echo "Solaris: FIX ME" - exit 77 -fi - -generate_conf -add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -module(load="../plugins/omprog/.libs/omprog") - -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - -template(name="outfmt" type="string" string="%msg%\n") - -main_queue( - queue.timeoutShutdown="30000" -) - -:msg, contains, "msgnum:" { - action( - type="omprog" - binary=`echo $srcdir/testsuites/omprog-single-instance-bin.sh` - template="outfmt" - name="omprog_action" - confirmMessages="on" - forceSingleInstance="on" - queue.type="LinkedList" - queue.workerThreads="10" - queue.size="10000" - queue.timeoutShutdown="30000" - ) -} -' -startup_vg -tcpflood -m$NUMBER_OF_MESSAGES -shutdown_when_empty -wait_shutdown_vg -check_exit_vg -exit_test +# addd 2019-04-15 by RGerhards, released under ASL 2.0 +export USE_VALGRIND="YES" +source ${srcdir:=.}/omprog-single-instance.sh diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_data_1server.sh rsyslog-8.2006.0/tests/omrabbitmq_data_1server.sh --- rsyslog-8.2001.0/tests/omrabbitmq_data_1server.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_data_1server.sh 2020-05-28 10:29:49.000000000 +0000 @@ -30,7 +30,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED=$(printf 'Exchange:in, routing-key:tag.local4.debug, content-type:rfc5424, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>1 server tag - - - msgrmq') diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_data_2servers.sh rsyslog-8.2006.0/tests/omrabbitmq_data_2servers.sh --- rsyslog-8.2001.0/tests/omrabbitmq_data_2servers.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_data_2servers.sh 2020-05-28 10:29:49.000000000 +0000 @@ -32,7 +32,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED=$(printf 'Exchange:in, routing-key:tag.local4.debug, content-type:rfc5424, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>1 172.20.245.8 tag - - - msgrmq') diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_error_server0.sh rsyslog-8.2006.0/tests/omrabbitmq_error_server0.sh --- rsyslog-8.2001.0/tests/omrabbitmq_error_server0.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_error_server0.sh 2020-05-28 10:29:49.000000000 +0000 @@ -33,7 +33,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED='Exchange:in, routing-key:tag.local4.debug, content-type:plain/text, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq' diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_error_server1.sh rsyslog-8.2006.0/tests/omrabbitmq_error_server1.sh --- rsyslog-8.2001.0/tests/omrabbitmq_error_server1.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_error_server1.sh 2020-05-28 10:29:49.000000000 +0000 @@ -33,7 +33,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED='Exchange:in, routing-key:tag.local4.debug, content-type:plain/text, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq' diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_error_server2.sh rsyslog-8.2006.0/tests/omrabbitmq_error_server2.sh --- rsyslog-8.2001.0/tests/omrabbitmq_error_server2.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_error_server2.sh 2020-05-28 10:29:49.000000000 +0000 @@ -33,7 +33,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED='Exchange:in, routing-key:tag.local4.debug, content-type:plain/text, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq' diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_error_server3.sh rsyslog-8.2006.0/tests/omrabbitmq_error_server3.sh --- rsyslog-8.2001.0/tests/omrabbitmq_error_server3.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_error_server3.sh 2020-05-28 10:29:49.000000000 +0000 @@ -32,7 +32,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED='Exchange:in, routing-key:tag.local4.debug, content-type:plain/text, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq' diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_json.sh rsyslog-8.2006.0/tests/omrabbitmq_json.sh --- rsyslog-8.2001.0/tests/omrabbitmq_json.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_json.sh 2020-05-28 10:29:49.000000000 +0000 @@ -27,7 +27,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown expected=$(printf 'Exchange:in, routing-key:myrouting, content-type:application/json, delivery-mode:transient, expiration:5000, msg:{\"message\":\" msgrmq\",\"fromhost\":\"172.20.245.8\",\"facility\":\"local4\",\"priority\":\"debug\",\"timereported\":.*}') diff -Nru rsyslog-8.2001.0/tests/omrabbitmq_raw.sh rsyslog-8.2006.0/tests/omrabbitmq_raw.sh --- rsyslog-8.2001.0/tests/omrabbitmq_raw.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrabbitmq_raw.sh 2020-05-28 10:29:49.000000000 +0000 @@ -31,7 +31,7 @@ action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" +injectmsg literal "<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq" shutdown_when_empty wait_shutdown export EXPECTED='Exchange:in, routing-key:tag.local4.debug, content-type:plain/text, facility:local4, severity:debug, hostname:172.20.245.8, fromhost:127.0.0.1, delivery-mode:transient, expiration:5000, timestamp:OK, app-id:tag, msg:<167>Mar 1 01:00:00 172.20.245.8 tag msgrmq' diff -Nru rsyslog-8.2001.0/tests/omrelp_wrong_authmode.sh rsyslog-8.2006.0/tests/omrelp_wrong_authmode.sh --- rsyslog-8.2001.0/tests/omrelp_wrong_authmode.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omrelp_wrong_authmode.sh 2020-05-28 10:29:49.000000000 +0000 @@ -4,8 +4,6 @@ generate_conf add_conf ' module(load="../plugins/omrelp/.libs/omrelp") -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="13514" ruleset="ruleset") ruleset(name="ruleset") { action(type="omrelp" target="127.0.0.1" port="'$TCPFLOOD_PORT'" diff -Nru rsyslog-8.2001.0/tests/omruleset-queue.sh rsyslog-8.2006.0/tests/omruleset-queue.sh --- rsyslog-8.2001.0/tests/omruleset-queue.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omruleset-queue.sh 2020-05-28 10:29:49.000000000 +0000 @@ -17,17 +17,16 @@ fi . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=20000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $ModLoad ../plugins/omruleset/.libs/omruleset -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' $ruleset rsinclude # create ruleset main queue with default parameters $RulesetCreateMainQueue on # make sure we do not terminate too early! -$MainMsgQueueTimeoutShutdown 10000 $template outfmt,"%msg:F,58:2%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! :msg, contains, "msgnum:" ?dynfile;outfmt @@ -37,10 +36,10 @@ *.* :omruleset: ' startup -injectmsg 0 20000 +injectmsg echo doing shutdown shutdown_when_empty echo wait on shutdown wait_shutdown -seq_check 0 19999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/omruleset.sh rsyslog-8.2006.0/tests/omruleset.sh --- rsyslog-8.2001.0/tests/omruleset.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omruleset.sh 2020-05-28 10:29:49.000000000 +0000 @@ -10,14 +10,12 @@ # are well enough to test what we want to test. # added 2009-11-02 by rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo =============================================================================== -echo \[omruleset.sh\]: basic test for omruleset functionality . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $ModLoad ../plugins/omruleset/.libs/omruleset -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' $ruleset rsinclude $template outfmt,"%msg:F,58:2%\n" @@ -29,10 +27,8 @@ *.* :omruleset: ' startup -injectmsg 0 5000 -echo doing shutdown +injectmsg shutdown_when_empty -echo wait on shutdown wait_shutdown -seq_check 0 4999 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/omtcl.sh rsyslog-8.2006.0/tests/omtcl.sh --- rsyslog-8.2001.0/tests/omtcl.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/omtcl.sh 2020-05-28 10:29:49.000000000 +0000 @@ -8,7 +8,7 @@ add_conf "*.* :omtcl:$srcdir/omtcl.tcl,doAction;tcldict " startup -echo 'injectmsg litteral <167>Mar 1 01:00:00 172.20.245.8 tag hello world' | \ +echo 'injectmsg literal <167>Mar 1 01:00:00 172.20.245.8 tag hello world' | \ ./diagtalker -p$IMDIAG_PORT || error_exit $? echo doing shutdown shutdown_when_empty diff -Nru rsyslog-8.2001.0/tests/pipe_noreader.sh rsyslog-8.2006.0/tests/pipe_noreader.sh --- rsyslog-8.2001.0/tests/pipe_noreader.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/pipe_noreader.sh 2020-05-28 10:29:49.000000000 +0000 @@ -19,9 +19,8 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" :msg, contains, "msgnum:" |./'$RSYSLOG_DYNNAME'.pipe diff -Nru rsyslog-8.2001.0/tests/random.sh rsyslog-8.2006.0/tests/random.sh --- rsyslog-8.2001.0/tests/random.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/random.sh 2020-05-28 10:29:49.000000000 +0000 @@ -11,9 +11,8 @@ # to stderr. $ErrorMessagesToStderr off -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%rawmsg%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! diff -Nru rsyslog-8.2001.0/tests/rcvr_fail_restore.sh rsyslog-8.2006.0/tests/rcvr_fail_restore.sh --- rsyslog-8.2001.0/tests/rcvr_fail_restore.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/rcvr_fail_restore.sh 2020-05-28 10:29:49.000000000 +0000 @@ -30,10 +30,6 @@ generate_conf 2 export TCPFLOOD_PORT="$(get_free_port)" add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -# this listener is for message generation by the test framework! -$InputTCPServerRun '$TCPFLOOD_PORT' - $WorkDirectory '$RSYSLOG_DYNNAME'.spool $MainMsgQueueSize 2000 $MainMsgQueueLowWaterMark 800 diff -Nru rsyslog-8.2001.0/tests/resultdata/imuxsock_ccmiddle.log rsyslog-8.2006.0/tests/resultdata/imuxsock_ccmiddle.log --- rsyslog-8.2001.0/tests/resultdata/imuxsock_ccmiddle.log 2019-08-20 07:44:06.000000000 +0000 +++ rsyslog-8.2006.0/tests/resultdata/imuxsock_ccmiddle.log 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - test 1#0112 diff -Nru rsyslog-8.2001.0/tests/resultdata/imuxsock_hostname.log rsyslog-8.2006.0/tests/resultdata/imuxsock_hostname.log --- rsyslog-8.2001.0/tests/resultdata/imuxsock_hostname.log 2019-08-20 07:44:27.000000000 +0000 +++ rsyslog-8.2006.0/tests/resultdata/imuxsock_hostname.log 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -rsyslog-testbench-hostname diff -Nru rsyslog-8.2001.0/tests/resultdata/imuxsock_logger.log rsyslog-8.2006.0/tests/resultdata/imuxsock_logger.log --- rsyslog-8.2001.0/tests/resultdata/imuxsock_logger.log 2019-08-20 07:44:06.000000000 +0000 +++ rsyslog-8.2006.0/tests/resultdata/imuxsock_logger.log 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - test diff -Nru rsyslog-8.2001.0/tests/resultdata/imuxsock_traillf.log rsyslog-8.2006.0/tests/resultdata/imuxsock_traillf.log --- rsyslog-8.2001.0/tests/resultdata/imuxsock_traillf.log 2019-08-20 07:44:06.000000000 +0000 +++ rsyslog-8.2006.0/tests/resultdata/imuxsock_traillf.log 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - test diff -Nru rsyslog-8.2001.0/tests/rfc5424parser-sp_at_msg_start.sh rsyslog-8.2006.0/tests/rfc5424parser-sp_at_msg_start.sh --- rsyslog-8.2001.0/tests/rfc5424parser-sp_at_msg_start.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/rfc5424parser-sp_at_msg_start.sh 2020-05-28 10:29:49.000000000 +0000 @@ -11,10 +11,10 @@ action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'") ' startup -injectmsg litteral '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - - nosd-nosp' -injectmsg litteral '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - [abc@123 a="b"] sd-nosp' -injectmsg litteral '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - - nosd-sp' -injectmsg litteral '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - [abc@123 a="b"] sd-sp' +injectmsg literal '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - - nosd-nosp' +injectmsg literal '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - [abc@123 a="b"] sd-nosp' +injectmsg literal '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - - nosd-sp' +injectmsg literal '<13>1 2019-05-15T11:21:57+03:00 domain.tld tag - - [abc@123 a="b"] sd-sp' shutdown_when_empty wait_shutdown export EXPECTED='nosd-nosp--END diff -Nru rsyslog-8.2001.0/tests/rscript_parse_time_get-ts.py rsyslog-8.2006.0/tests/rscript_parse_time_get-ts.py --- rsyslog-8.2001.0/tests/rscript_parse_time_get-ts.py 2019-10-30 17:45:57.000000000 +0000 +++ rsyslog-8.2006.0/tests/rscript_parse_time_get-ts.py 2020-05-28 10:29:49.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +# call this via "python[3] script name" # Added 2017-11-05 by Stephen Workman, released under ASL 2.0 # diff -Nru rsyslog-8.2001.0/tests/rscript_set_memleak-vg.sh rsyslog-8.2006.0/tests/rscript_set_memleak-vg.sh --- rsyslog-8.2001.0/tests/rscript_set_memleak-vg.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/rscript_set_memleak-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,11 +5,9 @@ # Copyright 2017-01-24 by Rainer Gerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=5000 generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="rcvr") - template(name="json" type="string" string="%$!%\n") template(name="ts" type="string" string="%timestamp:::date-rfc3339%") ruleset(name="rcvr" queue.type="LinkedList" @@ -27,7 +25,7 @@ ) }' startup_vg -tcpflood -m5000 +injectmsg shutdown_when_empty wait_shutdown_vg check_exit_vg diff -Nru rsyslog-8.2001.0/tests/rsf_getenv.sh rsyslog-8.2006.0/tests/rsf_getenv.sh --- rsyslog-8.2001.0/tests/rsf_getenv.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/rsf_getenv.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,29 +5,19 @@ # added 2009-11-03 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: -echo =============================================================================== -echo \[rsf_getenv.sh\]: testing RainerScript getenv\(\) function +export NUMMESSAGES=10000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines export MSGNUM="msgnum:" . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' - -# set spool locations and switch queue to disk-only mode -$WorkDirectory '$RSYSLOG_DYNNAME'.spool -$MainMsgQueueFilename mainq -$MainMsgQueueType disk - $template outfmt,"%msg:F,58:2%\n" template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! if $msg contains getenv("MSGNUM") then ?dynfile;outfmt ' startup -tcpflood -m10000 -shutdown_when_empty # shut down rsyslogd when done processing messages +injectmsg +shutdown_when_empty wait_shutdown -seq_check 0 9999 -unset MSGNUM +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/rulesetmultiqueue.sh rsyslog-8.2006.0/tests/rulesetmultiqueue.sh --- rsyslog-8.2001.0/tests/rulesetmultiqueue.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/rulesetmultiqueue.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,19 +6,15 @@ # support multi-output-file operations. # added 2009-10-30 by Rgerhards # This file is part of the rsyslog project, released under ASL 2.0 -uname -if [ $(uname) = "SunOS" ] ; then - echo "This test currently does not work on all flavors of Solaris." - exit 77 -fi - . ${srcdir:=.}/diag.sh init -export RSYSLOG_PORT2="$(get_free_port)" -export RSYSLOG_PORT3="$(get_free_port)" +skip_platform "SunOS" "This test does not work on Solaris. The overall queue +size check in imdiag requires atomics or mutexes on this platform, which we +do not use for performance reasons." +export NUMMESSAGES=60000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 # general definition $template outfmt,"%msg:F,58:2%\n" @@ -27,36 +23,46 @@ $ruleset file1 $RulesetCreateMainQueue on $template dynfile1,"'$RSYSLOG_OUT_LOG'1.log" # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile1;outfmt +:msg, contains, "msgnum:" { ?dynfile1;outfmt + ./'$RSYSLOG_OUT_LOG' +} $ruleset file2 $RulesetCreateMainQueue on $template dynfile2,"'$RSYSLOG_OUT_LOG'2.log" # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile2;outfmt +:msg, contains, "msgnum:" { ?dynfile2;outfmt + ./'$RSYSLOG_OUT_LOG' +} $ruleset file3 $RulesetCreateMainQueue on $template dynfile3,"'$RSYSLOG_OUT_LOG'3.log" # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile3;outfmt +:msg, contains, "msgnum:" { ?dynfile3;outfmt + ./'$RSYSLOG_OUT_LOG' +} # start listeners and bind them to rulesets $InputTCPServerBindRuleset file1 -$InputTCPServerRun '$TCPFLOOD_PORT' +$InputTCPServerListenPortFile '$RSYSLOG_DYNNAME'.tcpflood_port +$InputTCPServerRun 0 $InputTCPServerBindRuleset file2 -$InputTCPServerRun '$RSYSLOG_PORT2' +$InputTCPServerListenPortFile '$RSYSLOG_DYNNAME'.tcpflood_port2 +$InputTCPServerRun 0 $InputTCPServerBindRuleset file3 -$InputTCPServerRun '$RSYSLOG_PORT3' +$InputTCPServerListenPortFile '$RSYSLOG_DYNNAME'.tcpflood_port3 +$InputTCPServerRun 0 ' -rm -f ${RSYSLOG_OUT_LOG}1.log ${RSYSLOG_OUT_LOG}2.log ${RSYSLOG_OUT_LOG}3.log startup +assign_tcpflood_port2 "$RSYSLOG_DYNNAME.tcpflood_port2" +assign_rs_port "$RSYSLOG_DYNNAME.tcpflood_port3" # now fill the three files (a bit sequentially, but they should # still get their share of concurrency - to increase the chance # we use three connections per set). -tcpflood -c3 -p'$TCPFLOOD_PORT' -m20000 -i0 -tcpflood -c3 -p'$RSYSLOG_PORT2' -m20000 -i20000 -tcpflood -c3 -p'$RSYSLOG_PORT3' -m20000 -i40000 +tcpflood -c3 -p$TCPFLOOD_PORT -m20000 -i0 +tcpflood -c3 -p$TCPFLOOD_PORT2 -m20000 -i20000 +tcpflood -c3 -p$RS_PORT -m20000 -i40000 # in this version of the imdiag, we do not have the capability to poll # all queues for emptiness. So we do a sleep in the hopes that this will @@ -67,6 +73,5 @@ # now consolidate all logs into a single one so that we can use the # regular check logic cat ${RSYSLOG_OUT_LOG}1.log ${RSYSLOG_OUT_LOG}2.log ${RSYSLOG_OUT_LOG}3.log > $RSYSLOG_OUT_LOG -seq_check 0 59999 -rm -f ${RSYSLOG_OUT_LOG}1.log ${RSYSLOG_OUT_LOG}2.log ${RSYSLOG_OUT_LOG}3.log +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/rulesetmultiqueue-v6.sh rsyslog-8.2006.0/tests/rulesetmultiqueue-v6.sh --- rsyslog-8.2001.0/tests/rulesetmultiqueue-v6.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/rulesetmultiqueue-v6.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,19 +6,15 @@ # support multi-output-file operations. # added 2013-11-14 by Rgerhards # This file is part of the rsyslog project, released under ASL 2.0 -uname -if [ $(uname) = "SunOS" ] ; then - echo "This test currently does not work on all flavors of Solaris." - exit 77 -fi - . ${srcdir:=.}/diag.sh init -export RSYSLOG_PORT2="$(get_free_port)" -export RSYSLOG_PORT3="$(get_free_port)" +skip_platform "SunOS" "This test does not work on Solaris. The overall queue +size check in imdiag requires atomics or mutexes on this platform, which we +do not use for performance reasons." +export NUMMESSAGES=60000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 +module(load="../plugins/imtcp/.libs/imtcp") # general definition $template outfmt,"%msg:F,58:2%\n" @@ -26,48 +22,41 @@ # create the individual rulesets $template dynfile1,"'$RSYSLOG_OUT_LOG'1.log" # trick to use relative path names! ruleset(name="file1" queue.type="linkedList") { + :msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") :msg, contains, "msgnum:" ?dynfile1;outfmt } $template dynfile2,"'$RSYSLOG_OUT_LOG'2.log" # trick to use relative path names! ruleset(name="file2" queue.type="linkedList") { + :msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") :msg, contains, "msgnum:" ?dynfile2;outfmt } $template dynfile3,"'$RSYSLOG_OUT_LOG'3.log" # trick to use relative path names! ruleset(name="file3" queue.type="linkedList") { + :msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") :msg, contains, "msgnum:" ?dynfile3;outfmt } # start listeners and bind them to rulesets -$InputTCPServerBindRuleset file1 -$InputTCPServerRun '$TCPFLOOD_PORT' - -$InputTCPServerBindRuleset file2 -$InputTCPServerRun '$RSYSLOG_PORT2' - -$InputTCPServerBindRuleset file3 -$InputTCPServerRun '$RSYSLOG_PORT3' +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="file1") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port2" ruleset="file2") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port3" ruleset="file3") ' -rm -f ${RSYSLOG_OUT_LOG}1.log ${RSYSLOG_OUT_LOG}2.log ${RSYSLOG_OUT_LOG}3.log startup +assign_tcpflood_port2 "$RSYSLOG_DYNNAME.tcpflood_port2" +assign_rs_port "$RSYSLOG_DYNNAME.tcpflood_port3" # now fill the three files (a bit sequentially, but they should # still get their share of concurrency - to increase the chance # we use three connections per set). -tcpflood -c3 -p'$TCPFLOOD_PORT' -m20000 -i0 -tcpflood -c3 -p'$RSYSLOG_PORT2' -m20000 -i20000 -tcpflood -c3 -p'$RSYSLOG_PORT3' -m20000 -i40000 - -# in this version of the imdiag, we do not have the capability to poll -# all queues for emptiness. So we do a sleep in the hopes that this will -# sufficiently drain the queues. This is race, but the best we currently -# can do... - rgerhards, 2009-11-05 -sleep 2 -shutdown_when_empty # shut down rsyslogd when done processing messages +tcpflood -c3 -p$TCPFLOOD_PORT -m20000 -i0 +tcpflood -c3 -p$TCPFLOOD_PORT2 -m20000 -i20000 +tcpflood -c3 -p$RS_PORT -m20000 -i40000 +shutdown_when_empty wait_shutdown # now consolidate all logs into a single one so that we can use the +seq_check # do a check on the count file - doesn't hurt as we need it anyhow # regular check logic cat ${RSYSLOG_OUT_LOG}1.log ${RSYSLOG_OUT_LOG}2.log ${RSYSLOG_OUT_LOG}3.log > $RSYSLOG_OUT_LOG -seq_check 0 59999 -rm -f ${RSYSLOG_OUT_LOG}1.log ${RSYSLOG_OUT_LOG}2.log ${RSYSLOG_OUT_LOG}3.log +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_failover.sh rsyslog-8.2006.0/tests/sndrcv_failover.sh --- rsyslog-8.2001.0/tests/sndrcv_failover.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_failover.sh 2020-05-28 10:29:49.000000000 +0000 @@ -9,18 +9,20 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=50000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines +export DEAD_PORT=4 # a port unassigned by IANA and very unlikely to be used +export RSYSLOG_DEBUGLOG="log" + # uncomment for debugging support: # start up the instances #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" -NUMMESSAGES=50000 -export DEAD_PORT=4 # a port unassigned by IANA and very unlikely to be used -export RSYSLOG_DEBUGLOG="log" generate_conf export PORT_RCVR="$(get_free_port)" add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp # then SENDER sends to this port (not tcpflood!) -$InputTCPServerRun '$PORT_RCVR' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%\n" $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! @@ -29,12 +31,9 @@ startup export RSYSLOG_DEBUGLOG="log2" #valgrind="valgrind" +export PORT_RCVR=$TCPFLOOD_PORT generate_conf 2 add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -# this listener is for message generation by the test framework! -$InputTCPServerRun '$TCPFLOOD_PORT' - *.* @@127.0.0.1:'$DEAD_PORT' # this must be DEAD $ActionExecOnlyWhenPreviousIsSuspended on & @@127.0.0.1:'$PORT_RCVR' @@ -45,8 +44,7 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 -wait_file_lines +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -55,7 +53,7 @@ wait_shutdown # do the final check -seq_check 1 $NUMMESSAGES +seq_check ls -l ${RSYSLOG_DYNNAME}.empty if [[ -s ${RSYSLOG_DYNNAME}.empty ]] ; then diff -Nru rsyslog-8.2001.0/tests/sndrcv_gzip.sh rsyslog-8.2006.0/tests/sndrcv_gzip.sh --- rsyslog-8.2001.0/tests/sndrcv_gzip.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_gzip.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,13 +5,7 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init export NUMMESSAGES=50000 -empty_check() { - if [ $(wc -l < "$RSYSLOG_OUT_LOG") -eq $NUMMESSAGES ]; then - return 0 - fi - return 1 -} -export QUEUE_EMPTY_CHECK_FUNC=empty_check +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="log" diff -Nru rsyslog-8.2001.0/tests/sndrcv_omudpspoof-bigmsg.sh rsyslog-8.2006.0/tests/sndrcv_omudpspoof-bigmsg.sh --- rsyslog-8.2001.0/tests/sndrcv_omudpspoof-bigmsg.sh 1970-01-01 00:00:00.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_omudpspoof-bigmsg.sh 2020-06-22 12:57:15.000000000 +0000 @@ -0,0 +1,83 @@ +#!/bin/bash +# This runs sends and receives big messages via OMUDPSPOOF +# added 2020-04-07 alorbach +# This file is part of the rsyslog project, released under GPLv3 +echo This test must be run as root [raw socket access required] +if [ "$EUID" -ne 0 ]; then + exit 77 # Not root, skip this test +fi +export TCPFLOOD_EXTRA_OPTS="-b1 -W1" +export NUMMESSAGES=1 +export MESSAGESIZE=16384 #65000 #32768 #16384 +#export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout" +#export RSYSLOG_DEBUGLOG="log" + +. ${srcdir:=.}/diag.sh init +# start up the instances +#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" +export RSYSLOG_DEBUGLOG="log" +generate_conf +export PORT_UDP="$(get_free_port)" + +add_conf ' +module(load="../plugins/imudp/.libs/imudp") +global ( + maxMessageSize="64k" +) + +input(type="imudp" port="'$PORT_UDP'" ruleset="rsImudp") +$template outfmt,"%msg%\n" + +ruleset(name="rsImudp") { + action( name="UDPOUT" + type="omfile" + file=`echo $RSYSLOG_OUT_LOG` + template="outfmt") +} +' +startup + +export RSYSLOG_DEBUGLOG="log2" +#valgrind="valgrind" +generate_conf 2 +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") +module(load="../plugins/omudpspoof/.libs/omudpspoof") + +global ( + maxMessageSize="64k" +) + +# this listener is for message generation by the test framework! +input(type="imtcp" port="'$TCPFLOOD_PORT'" ruleset="rsImtcp") + +$template spoofaddr,"127.0.0.1" + +ruleset(name="rsImtcp") { + action( name="MTUTEST" + type="omudpspoof" + Target="127.0.0.1" + Port="'$PORT_UDP'" + SourceTemplate="spoofaddr" + mtu="1500") +# for comparison only -> action(name="MTUTEST" type="omfwd" Target="127.0.0.1" Port="'$PORT_UDP'") +} + +' 2 +startup 2 + +# now inject the messages into instance 2. It will connect to instance 1, +# and that instance will record the data. +# tcpflood -m$NUMMESSAGES -i1 -d 1024 +tcpflood -m$NUMMESSAGES -i1 -d $MESSAGESIZE + +sleep 5 # make sure all data is received in input buffers +# shut down sender when everything is sent, receiver continues to run concurrently +shutdown_when_empty 2 +wait_shutdown 2 +# now it is time to stop the receiver as well +shutdown_when_empty +wait_shutdown + +# do the final check +content_count_check "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ${NUMMESSAGES} diff -Nru rsyslog-8.2001.0/tests/sndrcv_relp_tls-cfgcmd.sh rsyslog-8.2006.0/tests/sndrcv_relp_tls-cfgcmd.sh --- rsyslog-8.2001.0/tests/sndrcv_relp_tls-cfgcmd.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_relp_tls-cfgcmd.sh 2020-06-22 12:57:15.000000000 +0000 @@ -1,6 +1,7 @@ #!/bin/bash # added 2019-11-13 by alorbach . ${srcdir:=.}/diag.sh init +require_relpEngineSetTLSLibByName export PORT_RCVR="$(get_free_port)" export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout" export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" @@ -40,22 +41,22 @@ shutdown_when_empty wait_shutdown -content_check --check-only "parameter tls.tlslib ignored" ${RSYSLOG_DEBUGLOG} +content_check --check-only "relpTcpConnectTLSInit_gnutls" ${RSYSLOG_DEBUGLOG} ret=$? if [ $ret == 0 ]; then - echo "SKIP: Parameter tls.tlslib not supported" + echo "SKIP: LIBRELP was build without OPENSSL Support" + skip_test +fi + +content_check --check-only "OpenSSL Version too old" $RSYSLOG_DEBUGLOG +ret=$? +if [ $ret == 0 ]; then + echo "SKIP: OpenSSL Version too old" skip_test else - content_check --check-only "OpenSSL Version too old" $RSYSLOG_DEBUGLOG - ret=$? - if [ $ret == 0 ]; then - echo "SKIP: OpenSSL Version too old" - skip_test - else - # Kindly check for a failed session - content_check "librelp error 10031" $RSYSLOG_DEBUGLOG - # content_check "OpenSSL Error Stack:" - fi + # Kindly check for a failed session + content_check "librelp error 10031" $RSYSLOG_DEBUGLOG +# content_check "OpenSSL Error Stack:" fi exit_test \ No newline at end of file diff -Nru rsyslog-8.2001.0/tests/sndrcv.sh rsyslog-8.2006.0/tests/sndrcv.sh --- rsyslog-8.2001.0/tests/sndrcv.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,32 +6,29 @@ # added 2009-11-11 by Rgerhards # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init -NUMMESSAGES=50000 +export NUMMESSAGES=50000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines # uncomment for debugging support: #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" # start up the instances export RSYSLOG_DEBUGLOG="log" generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp # then SENDER sends to this port (not tcpflood!) -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.rcvr_port") +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) $template outfmt,"%msg:F,58:2%\n" $template dynfile,"'$RSYSLOG_OUT_LOG'" :msg, contains, "msgnum:" ?dynfile;outfmt ' startup -assign_file_content RCVR_PORT "$RSYSLOG_DYNNAME.rcvr_port" +export RCVR_PORT=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="log2" #valgrind="valgrind" generate_conf 2 add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -# this listener is for message generation by the test framework! -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - action(type="omfwd" target="127.0.0.1" protocol="tcp" port="'$RCVR_PORT'") ' 2 startup 2 @@ -39,16 +36,14 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 -wait_file_lines +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 -wait_shutdown 2 # now it is time to stop the receiver as well shutdown_when_empty wait_shutdown # do the final check -seq_check 1 $NUMMESSAGES +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_anon_hostname.sh rsyslog-8.2006.0/tests/sndrcv_tls_anon_hostname.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_anon_hostname.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_anon_hostname.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,12 +3,12 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init export NUMMESSAGES=25000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines # start up the instances # uncomment for debugging support: #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="log" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -22,17 +22,17 @@ StreamDriver.Mode="1" StreamDriver.AuthMode="anon" ) # then SENDER sends to this port (not tcpflood!) -input( type="imtcp" port="'$PORT_RCVR'" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) $template outfmt,"%msg:F,58:2%\n" $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! :msg, contains, "msgnum:" ?dynfile;outfmt ' startup +export RCVR_PORT=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="log2" #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" # TODO: move to diag.sh add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -41,21 +41,16 @@ defaultNetstreamDriver="gtls" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -input( type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) - # set up the action $ActionSendStreamDriverMode 1 # require TLS for the connection $ActionSendStreamDriverAuthMode anon -*.* @@localhost:'$PORT_RCVR' +*.* @@localhost:'$RCVR_PORT' ' 2 startup 2 # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 -wait_file_lines +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -63,5 +58,5 @@ shutdown_when_empty wait_shutdown -seq_check 1 $NUMMESSAGES +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_anon_ipv4.sh rsyslog-8.2006.0/tests/sndrcv_tls_anon_ipv4.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_anon_ipv4.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_anon_ipv4.sh 2020-05-28 10:29:49.000000000 +0000 @@ -2,10 +2,10 @@ # rgerhards, 2011-04-04 # testing sending and receiving via TLS with anon auth using bare ipv4, no SNI # This file is part of the rsyslog project, released under ASL 2.0 - -# uncomment for debugging support: . ${srcdir:=.}/diag.sh init export NUMMESSAGES=25000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines +# uncomment for debugging support: # start up the instances #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="log" @@ -24,13 +24,14 @@ StreamDriver.Mode="1" StreamDriver.AuthMode="anon" ) # then SENDER sends to this port (not tcpflood!) -input( type="imtcp" port="'$PORT_RCVR'" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) $template outfmt,"%msg:F,58:2%\n" $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! :msg, contains, "msgnum:" ?dynfile;outfmt ' startup +export RCVR_PORT=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="log2" #valgrind="valgrind" generate_conf 2 @@ -42,22 +43,17 @@ defaultNetstreamDriver="gtls" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -input( type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) - # set up the action $DefaultNetstreamDriver gtls # use gtls netstream driver $ActionSendStreamDriverMode 1 # require TLS for the connection $ActionSendStreamDriverAuthMode anon -*.* @@127.0.0.1:'$PORT_RCVR' +*.* @@127.0.0.1:'$RCVR_PORT' ' 2 startup 2 # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 -wait_file_lines +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -65,5 +61,5 @@ shutdown_when_empty wait_shutdown -seq_check 1 $NUMMESSAGES +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_anon_ipv6.sh rsyslog-8.2006.0/tests/sndrcv_tls_anon_ipv6.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_anon_ipv6.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_anon_ipv6.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,33 +5,32 @@ . ${srcdir:=.}/diag.sh init . $srcdir/diag.sh check-ipv6-available export NUMMESSAGES=25000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines # uncomment for debugging support: #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" # start up the instances export RSYSLOG_DEBUGLOG="log" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp - -# certificates -$DefaultNetstreamDriverCAFile testsuites/x.509/ca.pem -$DefaultNetstreamDriverCertFile testsuites/x.509/client-cert.pem -$DefaultNetstreamDriverKeyFile testsuites/x.509/client-key.pem +global( + defaultNetstreamDriverCAFile="'$srcdir'/testsuites/x.509/ca.pem" + defaultNetstreamDriverCertFile="'$srcdir'/testsuites/x.509/client-cert.pem" + defaultNetstreamDriverKeyFile="'$srcdir'/testsuites/x.509/client-key.pem" + defaultNetstreamDriver="gtls" + debug.whitelist="on" + debug.files=["nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"] +) -$DefaultNetstreamDriver gtls # use gtls netstream driver +module(load="../plugins/imtcp/.libs/imtcp" maxSessions="1100" + streamDriver.mode="1" streamDriver.authMode="anon") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") -# then SENDER sends to this port (not tcpflood!) -$InputTCPServerStreamDriverMode 1 -$InputTCPServerStreamDriverAuthMode anon -$InputTCPServerRun '$PORT_RCVR' - -$template outfmt,"%msg:F,58:2%\n" -$template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! -:msg, contains, "msgnum:" ?dynfile;outfmt +template(name="outfmt" type="string" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") +:msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup +export PORT_RCVR=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="log2" #valgrind="valgrind" generate_conf 2 @@ -44,10 +43,6 @@ defaultNetstreamDriver="gtls" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - # set up the action $DefaultNetstreamDriver gtls # use gtls netstream driver $ActionSendStreamDriverMode 1 # require TLS for the connection @@ -58,8 +53,7 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 -wait_file_lines +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 @@ -68,5 +62,5 @@ shutdown_when_empty wait_shutdown -seq_check 1 $NUMMESSAGES +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_certvalid_expired.sh rsyslog-8.2006.0/tests/sndrcv_tls_certvalid_expired.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_certvalid_expired.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_certvalid_expired.sh 2020-05-28 10:29:49.000000000 +0000 @@ -7,7 +7,6 @@ #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -24,16 +23,15 @@ StreamDriver.AuthMode="x509/certvalid" StreamDriver.PermitExpiredCerts="off" ) -input( type="imtcp" - port="'$PORT_RCVR'" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup +export PORT_RCVR=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.sender.debuglog" #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" # TODO: move to diag.sh add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -42,10 +40,6 @@ defaultNetstreamDriver="gtls" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - # set up the action $ActionSendStreamDriverMode 1 # require TLS for the connection $ActionSendStreamDriverAuthMode anon @@ -55,8 +49,8 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m1 -i1 -sleep 5 # make sure all data is received in input buffers +injectmsg + # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -66,5 +60,4 @@ content_check "not permitted to talk to peer, certificate invalid: certificate expired" -unset PORT_RCVR # TODO: move to exit_test()? exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_certvalid.sh rsyslog-8.2006.0/tests/sndrcv_tls_certvalid.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_certvalid.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_certvalid.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,52 +1,44 @@ #!/bin/bash # This file is part of the rsyslog project, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +printf 'using TLS driver: %s\n' ${RS_TLS_DRIVER:=gtls} +export NUMMESSAGES=10000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines # uncomment for debugging support: -. ${srcdir:=.}/diag.sh init -# start up the instances #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-cert.pem'" defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-key.pem'" - defaultNetstreamDriver="gtls" -# debug.whitelist="on" -# debug.files=["nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"] + defaultNetstreamDriver="'$RS_TLS_DRIVER'" ) module( load="../plugins/imtcp/.libs/imtcp" - StreamDriver.Name="gtls" + StreamDriver.Name="'$RS_TLS_DRIVER'" StreamDriver.Mode="1" StreamDriver.AuthMode="x509/certvalid" ) -input( type="imtcp" - port="'$PORT_RCVR'" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%msg:F,58:2%\n") -:msg, contains, "msgnum:" action( type="omfile" - template="outfmt" - file="'$RSYSLOG_OUT_LOG'") +:msg, contains, "msgnum:" action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'") ' startup +export PORT_RCVR=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.sender.debuglog" #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" # TODO: move to diag.sh add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-cert.pem'" defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-key.pem'" - defaultNetstreamDriver="gtls" + defaultNetstreamDriver="'$RS_TLS_DRIVER'" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - # set up the action $ActionSendStreamDriverMode 1 # require TLS for the connection $ActionSendStreamDriverAuthMode x509/certvalid @@ -56,8 +48,7 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m10000 -i1 -sleep 5 # make sure all data is received in input buffers +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -65,8 +56,5 @@ shutdown_when_empty wait_shutdown -# do the final check -seq_check 1 10000 - -unset PORT_RCVR # TODO: move to exit_test()? +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_gtls_serveranon_gtls_clientanon.sh rsyslog-8.2006.0/tests/sndrcv_tls_gtls_serveranon_gtls_clientanon.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_gtls_serveranon_gtls_clientanon.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_gtls_serveranon_gtls_clientanon.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,18 +3,15 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init export NUMMESSAGES=1000 -# uncomment for debugging support: -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines export RSYSLOG_DEBUGLOG="log" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' module( load="../plugins/imtcp/.libs/imtcp" StreamDriver.Name="gtls" StreamDriver.Mode="1" StreamDriver.AuthMode="anon" ) -# then SENDER sends to this port (not tcpflood!) -input( type="imtcp" port="'$PORT_RCVR'" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) $template outfmt,"%msg:F,58:2%\n" $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! @@ -22,19 +19,14 @@ ' startup export RSYSLOG_DEBUGLOG="log2" +export RCVR_PORT=$TCPFLOOD_PORT #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" add_conf ' -# Note: no TLS for the listener, this is for tcpflood! -module( load="../plugins/imtcp/.libs/imtcp") -input( type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - -# set up the action action( type="omfwd" protocol="tcp" target="127.0.0.1" - port="'$PORT_RCVR'" + port="'$RCVR_PORT'" StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="anon" @@ -44,8 +36,7 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 -wait_file_lines +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -53,5 +44,5 @@ shutdown_when_empty wait_shutdown -seq_check 1 $NUMMESSAGES +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_ossl_anon_ipv4.sh rsyslog-8.2006.0/tests/sndrcv_tls_ossl_anon_ipv4.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_ossl_anon_ipv4.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_ossl_anon_ipv4.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,16 +1,18 @@ #!/bin/bash +# testing sending and receiving via TLS with anon auth using bare ipv4, no SNI # rgerhards, 2011-04-04 # This file is part of the rsyslog project, released under ASL 2.0 -echo =============================================================================== -echo \[sndrcv_tls_ossl_anon_ipv4.sh\]: testing sending and receiving via TLS with anon auth using bare ipv4, no SNI +. ${srcdir:=.}/diag.sh init +if [ "${TARGET:=127.0.0.1}" == "[::1]" ]; then +. $srcdir/diag.sh check-ipv6-available +fi +export NUMMESSAGES=10000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines # uncomment for debugging support: -. ${srcdir:=.}/diag.sh init -# start up the instances #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="log" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -25,19 +27,16 @@ StreamDriver.Name="ossl" StreamDriver.Mode="1" StreamDriver.AuthMode="anon" ) -input( type="imtcp" - port="'$PORT_RCVR'" ) +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%msg:F,58:2%\n") -:msg, contains, "msgnum:" action( type="omfile" - template="outfmt" - file="'$RSYSLOG_OUT_LOG'") +:msg, contains, "msgnum:" action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'") ' startup +export PORT_RCVR=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="log2" #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" # TODO: move to diag.sh add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'" @@ -46,21 +45,16 @@ defaultNetstreamDriver="ossl" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - # set up the action $ActionSendStreamDriverMode 1 # require TLS for the connection $ActionSendStreamDriverAuthMode anon -*.* @@127.0.0.1:'$PORT_RCVR' +*.* @@'${TARGET}':'$PORT_RCVR' ' 2 startup 2 # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m10000 -i1 -sleep 5 # make sure all data is received in input buffers +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -68,8 +62,5 @@ shutdown_when_empty wait_shutdown -# do the final check -seq_check 1 10000 - -unset PORT_RCVR # TODO: move to exit_test()? +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_ossl_anon_ipv6.sh rsyslog-8.2006.0/tests/sndrcv_tls_ossl_anon_ipv6.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_ossl_anon_ipv6.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_ossl_anon_ipv6.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,80 +1,4 @@ #!/bin/bash -# rgerhards, 2011-04-04 -# testing sending and receiving via TLS with anon auth using bare ipv6, no SNI -# This file is part of the rsyslog project, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -. $srcdir/diag.sh check-ipv6-available -export NUMMESSAGES=10000 -# uncomment for debugging support: -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" - -# start up the instances -export RSYSLOG_DEBUGLOG="log" -generate_conf -export PORT_RCVR="$(get_free_port)" -add_conf ' -global( - defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" - defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-cert.pem'" - defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-key.pem'" - defaultNetstreamDriver="ossl" - debug.whitelist="off" - debug.files=["rainerscript.c", "ruleset.c"] -) - -module( load="../plugins/imtcp/.libs/imtcp" - StreamDriver.Name="ossl" - StreamDriver.Mode="1" - StreamDriver.AuthMode="anon" ) -input( type="imtcp" - port="'$PORT_RCVR'" ) - -template(name="outfmt" type="string" string="%msg:F,58:2%\n") -:msg, contains, "msgnum:" action( type="omfile" - template="outfmt" - file="'$RSYSLOG_OUT_LOG'") -' -startup -export RSYSLOG_DEBUGLOG="log2" -#valgrind="valgrind" -generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" -add_conf ' -global( - defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'" - defaultNetstreamDriverCertFile="'$srcdir/tls-certs/cert.pem'" - defaultNetstreamDriverKeyFile="'$srcdir/tls-certs/key.pem'" - defaultNetstreamDriver="ossl" - debug.whitelist="off" - debug.files=["rainerscript.c", "ruleset.c"] -) - -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - -# set up the action -$DefaultNetstreamDriver ossl # use gtls netstream driver -$ActionSendStreamDriverMode 1 # require TLS for the connection -$ActionSendStreamDriverAuthMode anon -*.* @@[::1]:'$PORT_RCVR' -' 2 -startup 2 - -# now inject the messages into instance 2. It will connect to instance 1, -# and that instance will record the data. -tcpflood -m$NUMMESSAGES -i1 - -# sleep 5 # work-around because of -#this should actually work: https://github.com/rsyslog/rsyslog/issues/3325 -wait_file_lines - -# shut down sender when everything is sent, receiver continues to run concurrently -shutdown_when_empty 2 -wait_shutdown 2 -# now it is time to stop the receiver as well -shutdown_when_empty -wait_shutdown - -seq_check 1 $NUMMESSAGES -exit_test +# addd 2020-01-16 by RGerhards, released under ASL 2.0 +export TARGET="[::1]" +source ${srcdir:=.}/sndrcv_tls_ossl_anon_ipv4.sh diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_ossl_certvalid_expired.sh rsyslog-8.2006.0/tests/sndrcv_tls_ossl_certvalid_expired.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_ossl_certvalid_expired.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_ossl_certvalid_expired.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,13 +1,10 @@ #!/bin/bash # This file is part of the rsyslog project, released under ASL 2.0 - -# uncomment for debugging support: . ${srcdir:=.}/diag.sh init -# start up the instances +# uncomment for debugging support: #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -24,16 +21,16 @@ StreamDriver.AuthMode="x509/certvalid" StreamDriver.PermitExpiredCerts="off" ) -input( type="imtcp" - port="'$PORT_RCVR'" ) + +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") action(type="omfile" file="'$RSYSLOG_OUT_LOG'") ' startup +export PORT_RCVR=$TCPFLOOD_PORT export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.sender.debuglog" #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" # TODO: move to diag.sh add_conf ' global( defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" @@ -42,10 +39,6 @@ defaultNetstreamDriver="ossl" ) -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - # set up the action $ActionSendStreamDriverMode 1 # require TLS for the connection $ActionSendStreamDriverAuthMode anon @@ -55,8 +48,7 @@ # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m1 -i1 -# sleep 5 # make sure all data is received in input buffers +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 wait_shutdown 2 @@ -66,6 +58,4 @@ content_check "Certificate EXPIRED at depth" content_check "OpenSSL Error Stack:" - -unset PORT_RCVR # TODO: move to exit_test()? exit_test diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_ossl_certvalid.sh rsyslog-8.2006.0/tests/sndrcv_tls_ossl_certvalid.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_ossl_certvalid.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_ossl_certvalid.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,72 +1,4 @@ #!/bin/bash -# This file is part of the rsyslog project, released under ASL 2.0 - -# uncomment for debugging support: -. ${srcdir:=.}/diag.sh init -# start up the instances -#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" -export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" -generate_conf -export PORT_RCVR="$(get_free_port)" -add_conf ' -global( - defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" - defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-cert.pem'" - defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-key.pem'" - defaultNetstreamDriver="ossl" -# debug.whitelist="on" -# debug.files=["nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"] -) - -module( load="../plugins/imtcp/.libs/imtcp" - StreamDriver.Name="ossl" - StreamDriver.Mode="1" - StreamDriver.AuthMode="x509/certvalid" ) -input( type="imtcp" - port="'$PORT_RCVR'" ) - -template(name="outfmt" type="string" string="%msg:F,58:2%\n") -:msg, contains, "msgnum:" action( type="omfile" - template="outfmt" - file="'$RSYSLOG_OUT_LOG'") -' -startup -export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.sender.debuglog" -#valgrind="valgrind" -generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" # TODO: move to diag.sh -add_conf ' -global( - defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'" - defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-cert.pem'" - defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-key.pem'" - defaultNetstreamDriver="ossl" -) - -# Note: no TLS for the listener, this is for tcpflood! -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - -# set up the action -$ActionSendStreamDriverMode 1 # require TLS for the connection -$ActionSendStreamDriverAuthMode x509/certvalid -*.* @@127.0.0.1:'$PORT_RCVR' -' 2 -startup 2 - -# now inject the messages into instance 2. It will connect to instance 1, -# and that instance will record the data. -tcpflood -m10000 -i1 -sleep 5 # make sure all data is received in input buffers -# shut down sender when everything is sent, receiver continues to run concurrently -shutdown_when_empty 2 -wait_shutdown 2 -# now it is time to stop the receiver as well -shutdown_when_empty -wait_shutdown - -# do the final check -seq_check 1 10000 - -unset PORT_RCVR # TODO: move to exit_test()? -exit_test +# added 2020-01-17 by RGerhards, released under ASL 2.0 +export RS_TLS_DRIVER=ossl +source ${srcdir:=.}/sndrcv_tls_certvalid.sh diff -Nru rsyslog-8.2001.0/tests/sndrcv_tls_ossl_certvalid_tlscommand.sh rsyslog-8.2006.0/tests/sndrcv_tls_ossl_certvalid_tlscommand.sh --- rsyslog-8.2001.0/tests/sndrcv_tls_ossl_certvalid_tlscommand.sh 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_tls_ossl_certvalid_tlscommand.sh 2020-06-05 10:06:07.000000000 +0000 @@ -58,10 +58,10 @@ # intent. So do not think something is wrong. The content_check below checks # these error codes. -content_check --check-only "OpenSSL Version too old" +content_check --check-only "TLS library does not support SSL_CONF_cmd" ret=$? if [ $ret == 0 ]; then - echo "SKIP: OpenSSL Version too old" + echo "SKIP: TLS library does not support SSL_CONF_cmd" skip_test else # Kindly check for a failed session diff -Nru rsyslog-8.2001.0/tests/sndrcv_udp_nonstdpt.sh rsyslog-8.2006.0/tests/sndrcv_udp_nonstdpt.sh --- rsyslog-8.2001.0/tests/sndrcv_udp_nonstdpt.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/sndrcv_udp_nonstdpt.sh 2020-05-28 10:29:49.000000000 +0000 @@ -8,14 +8,15 @@ # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init export TCPFLOOD_EXTRA_OPTS="-b1 -W1" +export NUMMESSAGES=500 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines export RSYSLOG_DEBUGLOG="log" generate_conf -export PORT_RCVR="$(get_free_port)" add_conf ' $ModLoad ../plugins/imudp/.libs/imudp # then SENDER sends to this port (not tcpflood!) -$UDPServerRun '$PORT_RCVR' +$UDPServerRun '$TCPFLOOD_PORT' $template outfmt,"%msg:F,58:2%\n" $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! @@ -26,22 +27,14 @@ #valgrind="valgrind" generate_conf 2 -export TCPFLOOD_PORT="$(get_free_port)" add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -# this listener is for message generation by the test framework! -$InputTCPServerRun '$TCPFLOOD_PORT' - -*.* @127.0.0.1:'$PORT_RCVR' +*.* @127.0.0.1:'$TCPFLOOD_PORT' ' 2 startup 2 # now inject the messages into instance 2. It will connect to instance 1, # and that instance will record the data. -tcpflood -m500 -i1 - -# wait in data received -wait_file_lines $RSYSLOG_OUT_LOG 500 $TB_TIMEOUT_STARTSTOP +injectmsg # shut down sender when everything is sent, receiver continues to run concurrently shutdown_when_empty 2 @@ -50,5 +43,5 @@ shutdown_when_empty wait_shutdown -seq_check 1 500 +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/snmptrapreceiver.py rsyslog-8.2006.0/tests/snmptrapreceiver.py --- rsyslog-8.2001.0/tests/snmptrapreceiver.py 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/snmptrapreceiver.py 2020-05-28 10:29:49.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +# call this via "python[3] script name" import sys from pysnmp.entity import engine, config from pysnmp.carrier.asyncore.dgram import udp diff -Nru rsyslog-8.2001.0/tests/stats-cee.sh rsyslog-8.2006.0/tests/stats-cee.sh --- rsyslog-8.2001.0/tests/stats-cee.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/stats-cee.sh 2020-05-28 10:29:49.000000000 +0000 @@ -17,9 +17,9 @@ } ' startup -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/stats-cee-vg.sh rsyslog-8.2006.0/tests/stats-cee-vg.sh --- rsyslog-8.2001.0/tests/stats-cee-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/stats-cee-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -24,9 +24,9 @@ } ' startup_vg -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/stats-json-es.sh rsyslog-8.2006.0/tests/stats-json-es.sh --- rsyslog-8.2001.0/tests/stats-json-es.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/stats-json-es.sh 2020-05-28 10:29:49.000000000 +0000 @@ -17,9 +17,9 @@ } ' startup -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/stats-json.sh rsyslog-8.2006.0/tests/stats-json.sh --- rsyslog-8.2001.0/tests/stats-json.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/stats-json.sh 2020-05-28 10:29:49.000000000 +0000 @@ -16,9 +16,9 @@ } ' startup -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/stats-json-vg.sh rsyslog-8.2006.0/tests/stats-json-vg.sh --- rsyslog-8.2001.0/tests/stats-json-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/stats-json-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -24,9 +24,9 @@ } ' startup_vg -. $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_1 wait_queueempty -. $srcdir/diag.sh wait-for-stats-flush ${RSYSLOG_DYNNAME}.out.stats.log +wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log echo doing shutdown shutdown_when_empty echo wait on shutdown diff -Nru rsyslog-8.2001.0/tests/tcpflood.c rsyslog-8.2006.0/tests/tcpflood.c --- rsyslog-8.2001.0/tests/tcpflood.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/tcpflood.c 2020-06-05 10:06:07.000000000 +0000 @@ -167,7 +167,7 @@ #define NETTEST_INPUT_CONF_FILE "nettest.input.conf" /* name of input file, must match $IncludeConfig in .conf files */ -#define MAX_EXTRADATA_LEN 200*1024 +#define MAX_EXTRADATA_LEN 512*1024 #define MAX_SENDBUF 2 * MAX_EXTRADATA_LEN #define MAX_RCVBUF 16 * 1024 + 1/* TLS RFC 8449: max size of buffer for message reception */ @@ -1178,7 +1178,7 @@ " Is the file at the right path? And do we have the permissions?"); exit(1); } - if(SSL_CTX_use_certificate_file(ctx, tlsCertFile, SSL_FILETYPE_PEM) != 1) { + if(SSL_CTX_use_certificate_chain_file(ctx, tlsCertFile) != 1) { printf("tcpflood: error cert file could not be accessed -- have you mixed up key and certificate?\n"); printf("If in doubt, try swapping the files in -z/-Z\n"); printf("Certifcate is: '%s'\n", tlsCertFile); @@ -1200,7 +1200,7 @@ /* Check for Custom Config string */ if (customConfig != NULL){ -#if OPENSSL_VERSION_NUMBER >= 0x10002000L +#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) char *pCurrentPos; char *pNextPos; char *pszCmd; @@ -1254,7 +1254,7 @@ printf("tcpflood: error, invalid value for -k: %s\n", customConfig); } #else - printf("tcpflood: error, OpenSSL Version too old, SSL_CONF_cmd API is not supported."); + printf("tcpflood: TLS library does not support SSL_CONF_cmd API (maybe it is too old?)."); #endif } diff -Nru rsyslog-8.2001.0/tests/tcp-msgreduc-vg.sh rsyslog-8.2006.0/tests/tcp-msgreduc-vg.sh --- rsyslog-8.2001.0/tests/tcp-msgreduc-vg.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/tcp-msgreduc-vg.sh 2020-05-28 10:29:49.000000000 +0000 @@ -1,21 +1,19 @@ #!/bin/bash # check if valgrind violations occur. Correct output is not checked. # added 2011-03-01 by Rgerhards -# This file is part of the rsyslog project, released under GPLv3 - -uname +# This file is part of the rsyslog project, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init if [ $(uname) = "FreeBSD" ] ; then echo "This test currently does not work on FreeBSD." - exit 77 +# exit 77 fi -echo =============================================================================== -echo \[tcp-msgreduc-vg.sh\]: testing msg reduction via UDP -. ${srcdir:=.}/diag.sh init +export NUMMESSAGES=4 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $RepeatedMsgReduction on $template outfmt,"%msg:F,58:2%\n" @@ -24,9 +22,7 @@ startup_vg tcpflood -t 127.0.0.1 -m 4 -r -M "\"<133>2011-03-01T11:22:12Z host tag msgh ...\"" tcpflood -t 127.0.0.1 -m 1 -r -M "\"<133>2011-03-01T11:22:12Z host tag msgh ...x\"" -# we need to give rsyslog a little time to settle the receiver -./msleep 1500 -shutdown_when_empty # shut down rsyslogd when done processing messages +shutdown_when_empty wait_shutdown_vg check_exit_vg exit_test diff -Nru rsyslog-8.2001.0/tests/timegenerated-dateordinal-invld.sh rsyslog-8.2006.0/tests/timegenerated-dateordinal-invld.sh --- rsyslog-8.2001.0/tests/timegenerated-dateordinal-invld.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timegenerated-dateordinal-invld.sh 2020-05-28 10:29:49.000000000 +0000 @@ -10,11 +10,12 @@ . $srcdir/faketime_common.sh export TZ=UTC+00:00 +export EXPECTED="001" # same for all tests generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%timegenerated:::date-ordinal%\n") @@ -29,13 +30,7 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; +cmp_exact echo "***SUBTEST: check 1960-01-01" @@ -44,13 +39,7 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; +cmp_exact echo "***SUBTEST: check 2101-01-01" @@ -59,13 +48,7 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; +cmp_exact echo "***SUBTEST: check 2500-01-01" @@ -74,13 +57,6 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; - +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timegenerated-dateordinal.sh rsyslog-8.2006.0/tests/timegenerated-dateordinal.sh --- rsyslog-8.2001.0/tests/timegenerated-dateordinal.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timegenerated-dateordinal.sh 2020-05-28 10:29:49.000000000 +0000 @@ -13,8 +13,8 @@ generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%timegenerated:::date-ordinal%\n") @@ -29,12 +29,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="001" +cmp_exact echo "***SUBTEST: check 2000-03-01" @@ -43,12 +39,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "061" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="061" +cmp_exact echo "***SUBTEST: check 2016-01-01" @@ -57,12 +49,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="001" +cmp_exact echo "***SUBTEST: check 2016-02-29" @@ -71,12 +59,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "060" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="060" +cmp_exact echo "***SUBTEST: check 2016-03-01" @@ -85,12 +69,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "061" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="061" +cmp_exact echo "***SUBTEST: check 2016-03-03" @@ -99,12 +79,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "063" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="063" +cmp_exact echo "***SUBTEST: check 2016-12-31" @@ -113,12 +89,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "366" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="366" +cmp_exact echo "***SUBTEST: check 2017-01-01" @@ -127,12 +99,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="001" +cmp_exact echo "***SUBTEST: check 2020-03-01" @@ -141,12 +109,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "061" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="061" +cmp_exact echo "***SUBTEST: check 2038-01-01" @@ -155,12 +119,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="001" +cmp_exact rsyslog_testbench_require_y2k38_support @@ -172,12 +132,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "365" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="365" +cmp_exact echo "***SUBTEST: check 2040-01-01" @@ -186,12 +142,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="001" +cmp_exact echo "***SUBTEST: check 2040-12-31" @@ -200,12 +152,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "366" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="366" +cmp_exact echo "***SUBTEST: check 2100-01-01" @@ -214,12 +162,7 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "001" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; - +export EXPECTED="001" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timegenerated-uxtimestamp-invld.sh rsyslog-8.2006.0/tests/timegenerated-uxtimestamp-invld.sh --- rsyslog-8.2001.0/tests/timegenerated-uxtimestamp-invld.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timegenerated-uxtimestamp-invld.sh 2020-05-28 10:29:49.000000000 +0000 @@ -13,8 +13,8 @@ generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%timegenerated:::date-unixtimestamp%\n") @@ -29,13 +29,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "0" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; +export EXPECTED="0" +cmp_exact echo "***SUBTEST: check 1960-01-01" @@ -44,13 +39,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "0" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; +export EXPECTED="0" +cmp_exact echo "***SUBTEST: check 2101-01-01" @@ -59,13 +49,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "0" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; +export EXPECTED="0" +cmp_exact echo "***SUBTEST: check 2500-01-01" @@ -74,13 +59,7 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "0" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - date -d @$(cat $RSYSLOG_OUT_LOG) - exit 1 -fi; - +export EXPECTED="0" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timegenerated-uxtimestamp.sh rsyslog-8.2006.0/tests/timegenerated-uxtimestamp.sh --- rsyslog-8.2001.0/tests/timegenerated-uxtimestamp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timegenerated-uxtimestamp.sh 2020-05-28 10:29:49.000000000 +0000 @@ -13,8 +13,8 @@ generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%timegenerated:::date-unixtimestamp%\n") diff -Nru rsyslog-8.2001.0/tests/timegenerated-ymd.sh rsyslog-8.2006.0/tests/timegenerated-ymd.sh --- rsyslog-8.2001.0/tests/timegenerated-ymd.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timegenerated-ymd.sh 2020-05-28 10:29:49.000000000 +0000 @@ -11,8 +11,8 @@ generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") template(name="outfmt" type="string" string="%timegenerated:::date-year%-%timegenerated:::date-month%-%timegenerated:::date-day%\n") @@ -25,12 +25,8 @@ tcpflood -m1 shutdown_when_empty wait_shutdown -echo "2016-01-01" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="2016-01-01" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timereported-utc-legacy.sh rsyslog-8.2006.0/tests/timereported-utc-legacy.sh --- rsyslog-8.2001.0/tests/timereported-utc-legacy.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timereported-utc-legacy.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,52 +3,22 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -$ModLoad ../plugins/imtcp/.libs/imtcp -$InputTCPServerRun '$TCPFLOOD_PORT' - template(name="outfmt" type="string" string="%timereported:::date-rfc3339,date-utc%\n") :msg, contains, "msgnum:" action(type="omfile" template="outfmt" - file=`echo $RSYSLOG_OUT_LOG`) + file="'$RSYSLOG_OUT_LOG'") ' echo "*** SUBTEST 2003 ****" -rm -f $RSYSLOG_OUT_LOG # do cleanup of previous subtest -startup -tcpflood -m1 -M"\"<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000\"" -shutdown_when_empty -wait_shutdown -echo "2003-08-24T12:14:15.000003+00:00" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; - -echo "*** SUBTEST 2016 ****" -rm -f $RSYSLOG_OUT_LOG # do cleanup of previous subtest -startup -tcpflood -m1 -M"\"<165>1 2016-03-01T12:00:00-02:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000\"" -shutdown_when_empty -wait_shutdown -echo "2016-03-01T14:00:00.000000+00:00" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; - -echo "*** SUBTEST 2016 (already in UTC) ****" -rm -f $RSYSLOG_OUT_LOG # do cleanup of previous subtest startup -tcpflood -m1 -M"\"<165>1 2016-03-01T12:00:00Z 192.0.2.1 tcpflood 8710 - - msgnum:0000000\"" +injectmsg_literal "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000" +injectmsg_literal "<165>1 2016-03-01T12:00:00-02:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000" +injectmsg_literal "<165>1 2016-03-01T12:00:00Z 192.0.2.1 tcpflood 8710 - - msgnum:0000000" shutdown_when_empty wait_shutdown -echo "2016-03-01T12:00:00.000000+00:00" | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid timestamps generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - exit 1 -fi; +export EXPECTED="2003-08-24T12:14:15.000003+00:00 +2016-03-01T14:00:00.000000+00:00 +2016-03-01T12:00:00.000000+00:00" +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timereported-utc.sh rsyslog-8.2006.0/tests/timereported-utc.sh --- rsyslog-8.2001.0/tests/timereported-utc.sh 2020-01-14 12:58:40.000000000 +0000 +++ rsyslog-8.2006.0/tests/timereported-utc.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,9 +5,6 @@ export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="list") { property(name="timereported" dateformat="rfc3339" date.inUTC="on") constant(value="\n") @@ -17,9 +14,9 @@ ' startup -tcpflood -m1 -M"\"<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000\"" -tcpflood -m1 -M"\"<165>1 2016-03-01T12:00:00-02:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000\"" -tcpflood -m1 -M"\"<165>1 2016-03-01T12:00:00Z 192.0.2.1 tcpflood 8710 - - msgnum:0000000\"" +injectmsg_literal "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000" +injectmsg_literal "<165>1 2016-03-01T12:00:00-02:00 192.0.2.1 tcpflood 8710 - - msgnum:0000000" +injectmsg_literal "<165>1 2016-03-01T12:00:00Z 192.0.2.1 tcpflood 8710 - - msgnum:0000000" shutdown_when_empty wait_shutdown diff -Nru rsyslog-8.2001.0/tests/timestamp-3164.sh rsyslog-8.2006.0/tests/timestamp-3164.sh --- rsyslog-8.2001.0/tests/timestamp-3164.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-3164.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,9 +3,6 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%timestamp:::date-rfc3164%\n") :syslogtag, contains, "TAG" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` @@ -14,20 +11,20 @@ ' startup -tcpflood -m1 -M "\"<167>Jan 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Feb 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Mar 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Apr 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>May 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Jun 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Jul 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Aug 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Sep 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Oct 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Nov 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Dec 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Jan 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -M "\"<167>Jan 16 16:57:54 172.20.245.8 TAG: MSG\"" +injectmsg_literal "<167>Jan 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Feb 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Mar 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Apr 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>May 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Jun 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Jul 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Aug 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Sep 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Oct 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Nov 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Dec 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Jan 6 16:57:54 172.20.245.8 TAG: MSG" +injectmsg_literal "<167>Jan 16 16:57:54 172.20.245.8 TAG: MSG" shutdown_when_empty wait_shutdown diff -Nru rsyslog-8.2001.0/tests/timestamp-3164-udp.sh rsyslog-8.2006.0/tests/timestamp-3164-udp.sh --- rsyslog-8.2001.0/tests/timestamp-3164-udp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-3164-udp.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -#!/bin/bash -# add 2018-06-25 by Pascal Withopf, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imudp/.libs/imudp") -input(type="imudp" port="'$TCPFLOOD_PORT'") - -template(name="outfmt" type="string" string="%timestamp:::date-rfc3164%\n") - -:syslogtag, contains, "TAG" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` - template="outfmt") - - -' -startup -tcpflood -m1 -T "udp" -M "\"<167>Jan 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Feb 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Mar 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Apr 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>May 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Jun 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Jul 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Aug 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Sep 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Oct 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Nov 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Dec 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Jan 6 16:57:54 172.20.245.8 TAG: MSG\"" -tcpflood -m1 -T "udp" -M "\"<167>Jan 16 16:57:54 172.20.245.8 TAG: MSG\"" -shutdown_when_empty -wait_shutdown - -echo 'Jan 6 16:57:54 -Feb 6 16:57:54 -Mar 6 16:57:54 -Apr 6 16:57:54 -May 6 16:57:54 -Jun 6 16:57:54 -Jul 6 16:57:54 -Aug 6 16:57:54 -Sep 6 16:57:54 -Oct 6 16:57:54 -Nov 6 16:57:54 -Dec 6 16:57:54 -Jan 6 16:57:54 -Jan 16 16:57:54' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - -exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-3339.sh rsyslog-8.2006.0/tests/timestamp-3339.sh --- rsyslog-8.2001.0/tests/timestamp-3339.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-3339.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,9 +3,6 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%timestamp:::date-rfc3339%\n") :syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` @@ -13,29 +10,24 @@ ' startup -tcpflood -m1 -M "\"<34>1 2003-11-11T22:14:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-01-11T22:14:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-11-01T22:04:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-11-11T02:14:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-11-11T22:04:05.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-11-11T22:04:05.003+02:00 mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-11-11T22:04:05.003+01:30 mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-11-11T22:04:05.123456+01:30 mymachine.example.com su - ID47 - MSG\"" +injectmsg_literal "<34>1 2003-11-11T22:14:15.003Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-01-11T22:14:15.003Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-11-01T22:04:15.003Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-11-11T02:14:15.003Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-11-11T22:04:05.003Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-11-11T22:04:05.003+02:00 mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-11-11T22:04:05.003+01:30 mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-11-11T22:04:05.123456+01:30 mymachine.example.com su - ID47 - MSG" shutdown_when_empty wait_shutdown -echo '2003-11-11T22:14:15.003Z +export EXPECTED='2003-11-11T22:14:15.003Z 2003-01-11T22:14:15.003Z 2003-11-01T22:04:15.003Z 2003-11-11T02:14:15.003Z 2003-11-11T22:04:05.003Z 2003-11-11T22:04:05.003+02:00 2003-11-11T22:04:05.003+01:30 -2003-11-11T22:04:05.123456+01:30' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - +2003-11-11T22:04:05.123456+01:30' +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-3339-udp.sh rsyslog-8.2006.0/tests/timestamp-3339-udp.sh --- rsyslog-8.2001.0/tests/timestamp-3339-udp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-3339-udp.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -#!/bin/bash -# add 2018-06-25 by Pascal Withopf, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imudp/.libs/imudp") -input(type="imudp" port="'$TCPFLOOD_PORT'") - -template(name="outfmt" type="string" string="%timestamp:::date-rfc3339%\n") - -:syslogtag, contains, "su" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" - template="outfmt") - -' -startup -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-11T22:14:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-01-11T22:14:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-01T22:04:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-11T02:14:15.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-11T22:04:05.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-11T22:04:05.003+02:00 mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-11T22:04:05.003+01:30 mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-11-11T22:04:05.123456+01:30 mymachine.example.com su - ID47 - MSG\"" -wait_file_exists $RSYSLOG_OUT_LOG -shutdown_when_empty -wait_shutdown - -export EXPECTED='2003-11-11T22:14:15.003Z -2003-01-11T22:14:15.003Z -2003-11-01T22:04:15.003Z -2003-11-11T02:14:15.003Z -2003-11-11T22:04:05.003Z -2003-11-11T22:04:05.003+02:00 -2003-11-11T22:04:05.003+01:30 -2003-11-11T22:04:05.123456+01:30' -cmp_exact - -exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-mysql.sh rsyslog-8.2006.0/tests/timestamp-mysql.sh --- rsyslog-8.2001.0/tests/timestamp-mysql.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-mysql.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,25 +3,17 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%timestamp:::date-mysql%\n") -:syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` +:syslogtag, contains, "su" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") ' startup -tcpflood -m1 -M "\"<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" +injectmsg_literal "<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" shutdown_when_empty wait_shutdown -echo '20030123123456' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - +export EXPECTED='20030123123456' +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-mysql-udp.sh rsyslog-8.2006.0/tests/timestamp-mysql-udp.sh --- rsyslog-8.2001.0/tests/timestamp-mysql-udp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-mysql-udp.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -#!/bin/bash -# add 2018-06-25 by Pascal Withopf, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imudp/.libs/imudp") -input(type="imudp" port="'$TCPFLOOD_PORT'") - -template(name="outfmt" type="string" string="%timestamp:::date-mysql%\n") - -:syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` - template="outfmt") - -' -startup -tcpflood -m1 -T "udp" -M "\"<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" -shutdown_when_empty -wait_shutdown - -echo '20030123123456' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - -exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-pgsql.sh rsyslog-8.2006.0/tests/timestamp-pgsql.sh --- rsyslog-8.2001.0/tests/timestamp-pgsql.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-pgsql.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,9 +3,6 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%timestamp:::date-pgsql%\n") :syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` @@ -14,15 +11,10 @@ ' startup -tcpflood -m1 -M "\"<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" +injectmsg_literal "<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" shutdown_when_empty wait_shutdown -echo '2003-01-23 12:34:56' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - +export EXPECTED='2003-01-23 12:34:56' +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-pgsql-udp.sh rsyslog-8.2006.0/tests/timestamp-pgsql-udp.sh --- rsyslog-8.2001.0/tests/timestamp-pgsql-udp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-pgsql-udp.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -#!/bin/bash -# add 2018-06-27 by Pascal Withopf, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imudp/.libs/imudp") -input(type="imudp" port="'$TCPFLOOD_PORT'") - -template(name="outfmt" type="string" string="%timestamp:::date-pgsql%\n") - -:syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` - template="outfmt") - - -' -startup -tcpflood -m1 -T "udp" -M "\"<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" -shutdown_when_empty -wait_shutdown - -echo '2003-01-23 12:34:56' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - -exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-subseconds.sh rsyslog-8.2006.0/tests/timestamp-subseconds.sh --- rsyslog-8.2001.0/tests/timestamp-subseconds.sh 2019-12-27 16:44:32.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-subseconds.sh 2020-05-28 10:29:49.000000000 +0000 @@ -3,9 +3,6 @@ . ${srcdir:=.}/diag.sh init generate_conf add_conf ' -module(load="../plugins/imtcp/.libs/imtcp") -input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") - template(name="outfmt" type="string" string="%timestamp:::date-subseconds%\n") :syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` @@ -14,19 +11,14 @@ ' startup -tcpflood -m1 -M "\"<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-01-23T12:34:56.123456Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -M "\"<34>1 2003-01-23T12:34:56Z mymachine.example.com su - ID47 - MSG\"" +injectmsg_literal "<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-01-23T12:34:56.123456Z mymachine.example.com su - ID47 - MSG" +injectmsg_literal "<34>1 2003-01-23T12:34:56Z mymachine.example.com su - ID47 - MSG" shutdown_when_empty wait_shutdown -echo '003 +export EXPECTED='003 123456 -0' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - +0' +cmp_exact exit_test diff -Nru rsyslog-8.2001.0/tests/timestamp-subseconds-udp.sh rsyslog-8.2006.0/tests/timestamp-subseconds-udp.sh --- rsyslog-8.2001.0/tests/timestamp-subseconds-udp.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/timestamp-subseconds-udp.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -#!/bin/bash -# add 2018-06-25 by Pascal Withopf, released under ASL 2.0 -. ${srcdir:=.}/diag.sh init -generate_conf -add_conf ' -module(load="../plugins/imudp/.libs/imudp") -input(type="imudp" port="'$TCPFLOOD_PORT'") - -template(name="outfmt" type="string" string="%timestamp:::date-subseconds%\n") - -:syslogtag, contains, "su" action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` - template="outfmt") - - -' -startup -tcpflood -m1 -T "udp" -M "\"<34>1 2003-01-23T12:34:56.003Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-01-23T12:34:56.123456Z mymachine.example.com su - ID47 - MSG\"" -tcpflood -m1 -T "udp" -M "\"<34>1 2003-01-23T12:34:56Z mymachine.example.com su - ID47 - MSG\"" -shutdown_when_empty -wait_shutdown - -echo '003 -123456 -0' | cmp - $RSYSLOG_OUT_LOG -if [ ! $? -eq 0 ]; then - echo "invalid response generated, $RSYSLOG_OUT_LOG is:" - cat $RSYSLOG_OUT_LOG - error_exit 1 -fi; - -exit_test diff -Nru rsyslog-8.2001.0/tests/urlencode.py rsyslog-8.2006.0/tests/urlencode.py --- rsyslog-8.2001.0/tests/urlencode.py 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tests/urlencode.py 2020-05-28 10:29:49.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +# call this via "python[3] script name" # a small url encoder for testbench purposes # written 2018-11-05 by Rainer Gerhards # part of the rsyslog testbench, released under ASL 2.0 diff -Nru rsyslog-8.2001.0/tests/wr_large_async.sh rsyslog-8.2006.0/tests/wr_large_async.sh --- rsyslog-8.2001.0/tests/wr_large_async.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/wr_large_async.sh 2020-05-28 10:29:49.000000000 +0000 @@ -5,17 +5,17 @@ # # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=4000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $MaxMessageSize 10k -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! -$OMFileFlushOnTXEnd off +template(name="dynfile" type="string" string="'$RSYSLOG_OUT_LOG'") # trick to use relative path names! $OMFileFlushInterval 2 $OMFileIOBufferSize 256k $OMFileAsyncWriting on @@ -23,9 +23,9 @@ ' startup # send 4000 messages of 10.000bytes plus header max, randomized -tcpflood -m4000 -r -d10000 -P129 -wait_file_lines $RSYSLOG_OUT_LOG 4000 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 3999 -E +tcpflood -m$NUMMESSAGES -r -d10000 -P129 +shutdown_when_empty +wait_shutdown +export SEQ_CHECK_OPTIONS=-E +seq_check exit_test diff -Nru rsyslog-8.2001.0/tests/wr_large_sync.sh rsyslog-8.2006.0/tests/wr_large_sync.sh --- rsyslog-8.2001.0/tests/wr_large_sync.sh 2019-12-27 12:51:33.000000000 +0000 +++ rsyslog-8.2006.0/tests/wr_large_sync.sh 2020-05-28 10:29:49.000000000 +0000 @@ -6,25 +6,26 @@ # # This file is part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=4000 +export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines generate_conf add_conf ' $MaxMessageSize 10k -$ModLoad ../plugins/imtcp/.libs/imtcp -$MainMsgQueueTimeoutShutdown 10000 -$InputTCPServerRun '$TCPFLOOD_PORT' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") $template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" -template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names! +template(name="dynfile" type="string" string="'$RSYSLOG_OUT_LOG'") # trick to use relative path names! $OMFileIOBufferSize 256k $OMFileAsyncWriting off local0.* ?dynfile;outfmt ' startup # send 4000 messages of 10.000bytes plus header max, randomized -tcpflood -m4000 -r -d10000 -P129 -wait_file_lines $RSYSLOG_OUT_LOG 4000 -shutdown_when_empty # shut down rsyslogd when done processing messages -wait_shutdown # and wait for it to terminate -seq_check 0 3999 -E +tcpflood -m$NUMMESSAGES -r -d10000 -P129 +shutdown_when_empty +wait_shutdown +export SEQ_CHECK_OPTIONS=-E +seq_check exit_test diff -Nru rsyslog-8.2001.0/tools/ompipe.c rsyslog-8.2006.0/tools/ompipe.c --- rsyslog-8.2001.0/tools/ompipe.c 2019-10-02 06:22:05.000000000 +0000 +++ rsyslog-8.2006.0/tools/ompipe.c 2020-06-22 12:57:15.000000000 +0000 @@ -70,6 +70,7 @@ short fd; /* pipe descriptor for (current) pipe */ pthread_mutex_t mutWrite; /* guard against multiple instances writing to same pipe */ sbool bHadError; /* did we already have/report an error on this pipe? */ + sbool bTryResumeReopen; /* should we attempt to reopen the pipe on action resume? */ } instanceData; typedef struct wrkrInstanceData { @@ -95,7 +96,8 @@ /* action (instance) parameters */ static struct cnfparamdescr actpdescr[] = { { "pipe", eCmdHdlrString, CNFPARAM_REQUIRED }, - { "template", eCmdHdlrGetWord, 0 } + { "template", eCmdHdlrGetWord, 0 }, + { "tryResumeReopen", eCmdHdlrBinary, 0 }, }; static struct cnfparamblk actpblk = { CNFPARAMBLK_VERSION, @@ -273,6 +275,7 @@ pData->pipe = NULL; pData->fd = -1; pData->bHadError = 0; + pData->bTryResumeReopen = 0; pthread_mutex_init(&pData->mutWrite, NULL); ENDcreateInstance @@ -318,8 +321,13 @@ tv.tv_usec = 0; ready = select(pData->fd+1, NULL, &wrds, NULL, &tv); DBGPRINTF("ompipe: tryResume: ready to write fd %d: %d\n", pData->fd, ready); - if(ready != 1) + if(ready != 1) { + if(pData->bTryResumeReopen && pData->fd != -1) { + close(pData->fd); + pData->fd = -1; + } ABORT_FINALIZE(RS_RET_SUSPENDED); + } } finalize_it: ENDtryResume @@ -361,6 +369,8 @@ pData->pipe = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "template")) { pData->tplName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); + } else if(!strcmp(actpblk.descr[i].name, "tryResumeReopen")) { + pData->bTryResumeReopen = (int) pvals[i].val.d.n; } else { dbgprintf("ompipe: program error, non-handled " "param '%s'\n", actpblk.descr[i].name); @@ -402,10 +412,12 @@ BEGINdoHUP CODESTARTdoHUP + pthread_mutex_lock(&pData->mutWrite); if(pData->fd != -1) { close(pData->fd); pData->fd = -1; } + pthread_mutex_unlock(&pData->mutWrite); ENDdoHUP diff -Nru rsyslog-8.2001.0/tools/rsyslogd.c rsyslog-8.2006.0/tools/rsyslogd.c --- rsyslog-8.2001.0/tools/rsyslogd.c 2020-01-13 07:34:24.000000000 +0000 +++ rsyslog-8.2006.0/tools/rsyslogd.c 2020-05-28 10:29:49.000000000 +0000 @@ -1832,12 +1832,12 @@ static void -wait_timeout(void) +wait_timeout(const sigset_t *sigmask) { - struct timeval tvSelectTimeout; + struct timespec tvSelectTimeout; tvSelectTimeout.tv_sec = janitorInterval * 60; /* interval is in minutes! */ - tvSelectTimeout.tv_usec = 0; + tvSelectTimeout.tv_nsec = 0; #ifdef _AIX if(!src_exists) { @@ -1849,22 +1849,24 @@ * timeout value, which we count down to zero. We do this * in useful subsecond steps. */ - const int wait_period = 500000; /* wait period in microseconds */ - int timeout = janitorInterval * 60 * (1000000 / wait_period); + const long wait_period = 500000000; /* wait period in nanoseconds */ + int timeout = janitorInterval * 60 * (1000000000 / wait_period); + + tvSelectTimeout.tv_sec = 0; + tvSelectTimeout.tv_nsec = wait_period; do { if(bFinished || bHadHUP) { break; } - srSleep(0, wait_period); - timeout--; - } while(timeout > 0); + pselect(1, NULL, NULL, NULL, &tvSelectTimeout, sigmask); + } while(--timeout > 0); } else { char buf[256]; fd_set rfds; FD_ZERO(&rfds); FD_SET(SRC_FD, &rfds); - if(select(SRC_FD + 1, (fd_set *)&rfds, NULL, NULL, &tvSelectTimeout)) + if(pselect(SRC_FD + 1, (fd_set *)&rfds, NULL, NULL, &tvSelectTimeout, sigmask)) { if(FD_ISSET(SRC_FD, &rfds)) { @@ -1913,7 +1915,7 @@ } } #else - select(1, NULL, NULL, NULL, &tvSelectTimeout); + pselect(0, NULL, NULL, NULL, &tvSelectTimeout, sigmask); #endif /* AIXPORT : SRC end */ } @@ -1941,28 +1943,39 @@ mainloop(void) { time_t tTime; + sigset_t origmask; + sigset_t sigblockset; + + sigemptyset(&sigblockset); + sigaddset(&sigblockset, SIGTERM); + sigaddset(&sigblockset, SIGCHLD); + sigaddset(&sigblockset, SIGHUP); do { processImInternal(); - wait_timeout(); + + pthread_sigmask(SIG_BLOCK, &sigblockset, &origmask); if(bChildDied) { reapChild(); bChildDied = 0; } + if(bHadHUP) { + doHUP(); + bHadHUP = 0; + } + if(bFinished) break; /* exit as quickly as possible */ + wait_timeout(&origmask); + pthread_sigmask(SIG_UNBLOCK, &sigblockset, NULL); + janitorRun(); datetime.GetTime(&tTime); checkGoneAwaySenders(tTime); - if(bHadHUP) { - doHUP(); - bHadHUP = 0; - } - } while(!bFinished); /* end do ... while() */ }