diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | configure.ac | 40 | ||||
-rw-r--r-- | grammar/rainerscript.c | 36 | ||||
-rw-r--r-- | runtime/msg.c | 10 | ||||
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rwxr-xr-x | tests/diag.sh | 4 | ||||
-rwxr-xr-x | tests/incltest.sh | 11 | ||||
-rwxr-xr-x | tests/incltest_dir.sh | 11 | ||||
-rwxr-xr-x | tests/incltest_dir_wildcard.sh | 11 | ||||
-rw-r--r-- | tests/testsuites/incltest.conf | 5 | ||||
-rw-r--r-- | tests/testsuites/incltest.d/include.conf | 2 | ||||
-rw-r--r-- | tests/testsuites/incltest_dir.conf | 5 | ||||
-rw-r--r-- | tests/testsuites/incltest_dir_wildcard.conf | 5 | ||||
-rw-r--r-- | tools/syslogd.c | 5 |
14 files changed, 134 insertions, 42 deletions
@@ -64,6 +64,10 @@ Version 7.3.0 [devel] 2012-10-09 This is controlled by the new action parameter "VeryReliableZip". ---------------------------------------------------------------------------- Version 7.2.2 [v7-stable] 2012-10-?? +- enabled to build without libuuid, at loss of uuid functionality + this enables smoother builds on older systems that do not support + libuuid. Loss of functionality should usually not matter too much as + uuid support has only recently been added and is very seldom used. - bugfix: omfwd did not properly support "template" parameter - bugfix: potential segfault when re_match() function was used Thanks to oxpa for the patch. @@ -75,6 +79,18 @@ Version 7.2.2 [v7-stable] 2012-10-?? - bugfix: leading quote (") in string-type template() lead to thight loop on startup - bugfix: no error msg on invalid field option in legacy/string template +- bugfix: potential segfault due to invalid param handling in comparisons + This could happen in RainerScript comparisons (like contains); in some + cases an unitialized variable was accessed, which could lead to an + invalid free and in turn to a segfault. + Closes: http://bugzilla.adiscon.com/show_bug.cgi?id=372 + Thanks to Georgi Georgiev for reporting this bug and his great help + in solving it. +- bugfix: no error msg on unreadable $IncludeConfig path +- bugfix: $IncludeConfig did not correctly process directories + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=376 + The testbench was also enhanced to check for these cases. + Thanks to Georgi Georgiev for the bug report. ---------------------------------------------------------------------------- Version 7.2.1 [v7-stable] 2012-10-29 - bugfix: ruleset()-object did only support a single statement @@ -237,6 +253,11 @@ Version 6.6.1 [v6-stable] 2012-10-?? This did not affect users, but could have caused trouble in the future for developers. - bugfix: no error msg on invalid field option in legacy/string template +- bugfix: no error msg on unreadable $IncludeConfig path +- bugfix: $IncludeConfig did not correctly process directories + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=376 + The testbench was also enhanced to check for these cases. + Thanks to Georgi Georgiev for the bug report. --------------------------------------------------------------------------- Version 6.6.0 [v6-stable] 2012-10-22 This starts a new stable branch, based on the 6.5.x series, plus: diff --git a/configure.ac b/configure.ac index a1fa7dd3..cd8ec105 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,6 @@ PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES(LIBESTR, libestr >= 0.1.2) PKG_CHECK_MODULES(LIBEE, libee >= 0.4.0) PKG_CHECK_MODULES([JSON_C], [json]) -PKG_CHECK_MODULES([LIBUUID], [uuid]) case "${host}" in *-*-linux*) @@ -342,27 +341,6 @@ AC_ARG_ENABLE(kmsg, AM_CONDITIONAL(ENABLE_IMKMSG, test x$enable_kmsg = xyes) -# -# SYSLOG_UNIXAF -# -AC_MSG_CHECKING(for SYSLOG_UNIXAF support) -AC_ARG_ENABLE([unix], - [AS_HELP_STRING([--disable-unix], [Disable support for unix])], - [ - if test "x${enableval}" = "xyes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE([SYSLOG_UNIXAF], [1], [Description]) - else - AC_MSG_RESULT([no]) - fi - ], - [ - # enabled by default - AC_MSG_RESULT([yes]) - AC_DEFINE([SYSLOG_UNIXAF], [1], [Description]) - ]) - - # inet AC_ARG_ENABLE(inet, [AS_HELP_STRING([--enable-inet],[Enable networking support @<:@default=yes@:>@])], @@ -729,6 +707,23 @@ AC_SUBST(SNMP_CFLAGS) AC_SUBST(SNMP_LIBS) +# uuid support +AC_ARG_ENABLE(uuid, + [AS_HELP_STRING([--enable-uuid],[Enable support for uuid generation @<:@default=yes@:>@])], + [case "${enableval}" in + yes) enable_elasticsearch="yes" ;; + no) enable_elasticsearch="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-uuid) ;; + esac], + [enable_uuid=yes] +) +if test "x$enable_elasticsearch" = "xyes"; then + PKG_CHECK_MODULES([LIBUUID], [uuid]) + AC_DEFINE(USE_LIBUUID, 1, [Define if you want to enable libuuid support]) +fi +AM_CONDITIONAL(ENABLE_UUID, test x$enable_uuid = xyes) + + # elasticsearch support AC_ARG_ENABLE(elasticsearch, [AS_HELP_STRING([--enable-elasticsearch],[Enable elasticsearch output module @<:@default=no@:>@])], @@ -1365,6 +1360,7 @@ echo " rsyslog runtime will be built: $enable_rsyslogrt" echo " rsyslogd will be built: $enable_rsyslogd" echo " GUI components will be built: $enable_gui" echo " Unlimited select() support enabled: $enable_unlimited_select" +echo " uuid support enabled: $enable_uuid" echo echo "---{ input plugins }---" echo " Klog functionality enabled: $enable_klog ($os_type)" diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index 36254632..39ff6df3 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -1230,7 +1230,7 @@ evalStrArrayCmp(es_str_t *estr_l, struct cnfarray* ar, int cmpop) #define FREE_TWO_STRINGS \ if(bMustFree) es_deleteStr(estr_r); \ - if(expr->r->nodetype != 'A' && r.datatype == 'S') es_deleteStr(r.d.estr); \ + if(expr->r->nodetype != 'S' && expr->r->nodetype != 'A' && r.datatype == 'S') es_deleteStr(r.d.estr); \ if(bMustFree2) es_deleteStr(estr_l); \ if(l.datatype == 'S') es_deleteStr(l.d.estr) @@ -2761,24 +2761,29 @@ int cnfDoInclude(char *name) { char *cfgFile; + char *finalName; unsigned i; int result; glob_t cfgFiles; struct stat fileInfo; + char nameBuf[MAXFNAME+1]; - /* Use GLOB_MARK to append a trailing slash for directories. - * Required by doIncludeDirectory(). - */ - result = glob(name, GLOB_MARK, NULL, &cfgFiles); - if(result == GLOB_NOSPACE || result == GLOB_ABORTED) { -#if 0 + finalName = name; + if(stat(name, &fileInfo) == 0) { + /* stat usually fails if we have a wildcard - so this does NOT indicate error! */ + if(S_ISDIR(fileInfo.st_mode)) { + /* if we have a directory, we need to add "*" to get its files */ + snprintf(nameBuf, sizeof(nameBuf), "%s*", name); + finalName = nameBuf; + } + } + /* Use GLOB_MARK to append a trailing slash for directories. */ + result = glob(finalName, GLOB_MARK, NULL, &cfgFiles); + if(result == GLOB_NOSPACE || result == GLOB_ABORTED || cfgFiles.gl_pathc == 0) { char errStr[1024]; rs_strerror_r(errno, errStr, sizeof(errStr)); - errmsg.LogError(0, RS_RET_FILE_NOT_FOUND, "error accessing config file or directory '%s': %s", - pattern, errStr); - ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND); -#endif - dbgprintf("includeconfig glob error %d\n", errno); + parser_errmsg("error accessing config file or directory '%s': %s", + finalName, errStr); return 1; } @@ -2792,11 +2797,8 @@ cnfDoInclude(char *name) dbgprintf("requested to include config file '%s'\n", cfgFile); cnfSetLexFile(cfgFile); } else if(S_ISDIR(fileInfo.st_mode)) { /* config directory */ - if(strcmp(name, cfgFile)) { - /* do not include ourselves! */ - dbgprintf("requested to include directory '%s'\n", cfgFile); - cnfDoInclude(cfgFile); - } + dbgprintf("requested to include directory '%s'\n", cfgFile); + cnfDoInclude(cfgFile); } else { dbgprintf("warning: unable to process IncludeConfig directive '%s'\n", cfgFile); } diff --git a/runtime/msg.c b/runtime/msg.c index de0ca553..5b6392b2 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -45,7 +45,9 @@ #if HAVE_MALLOC_H # include <malloc.h> #endif -#include <uuid/uuid.h> +#ifdef USE_LIBUUID + #include <uuid/uuid.h> +#endif #include "rsyslog.h" #include "srUtils.h" #include "stringbuf.h" @@ -559,8 +561,10 @@ propNameStrToID(uchar *pName, propid_t *pPropID) *pPropID = PROP_MSGID; } else if(!strcmp((char*) pName, "parsesuccess")) { *pPropID = PROP_PARSESUCCESS; +#ifdef USE_LIBUUID } else if(!strcmp((char*) pName, "uuid")) { *pPropID = PROP_UUID; +#endif /* here start system properties (those, that do not relate to the message itself */ } else if(!strcmp((char*) pName, "$now")) { *pPropID = PROP_SYS_NOW; @@ -1450,6 +1454,7 @@ char *getProtocolVersionString(msg_t *pM) return(pM->iProtocolVersion ? "1" : "0"); } +#ifdef USE_LIBUUID /* note: libuuid seems not to be thread-safe, so we need * to get some safeguards in place. */ @@ -1504,6 +1509,7 @@ void getUUID(msg_t *pM, uchar **pBuf, int *piLen) } dbgprintf("[getUUID] END\n"); } +#endif void getRawMsg(msg_t *pM, uchar **pBuf, int *piLen) @@ -2970,9 +2976,11 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, case PROP_MSGID: pRes = (uchar*)getMSGID(pMsg); break; +#ifdef USE_LIBUUID case PROP_UUID: getUUID(pMsg, &pRes, &bufLen); break; +#endif case PROP_PARSESUCCESS: pRes = (uchar*)getParseSuccess(pMsg); break; diff --git a/tests/Makefile.am b/tests/Makefile.am index 5bcaea75..a673ef1e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,6 +73,9 @@ TESTS += \ rscript_ruleset_call.sh \ cee_simple.sh \ cee_diskqueue.sh \ + incltest.sh \ + incltest_dir.sh \ + incltest_dir_wildcard.sh \ linkedlistqueue.sh if HAVE_VALGRIND @@ -291,6 +294,13 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/cee_simple.conf \ cee_diskqueue.sh \ testsuites/cee_diskqueue.conf \ + incltest.sh \ + testsuites/incltest.conf \ + incltest_dir.sh \ + testsuites/incltest_dir.conf \ + incltest_dir_wildcard.sh \ + testsuites/incltest_dir_wildcard.conf \ + testsuites/incltest.d/include.conf \ linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ diff --git a/tests/diag.sh b/tests/diag.sh index bd38b29d..02b24c5b 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -10,8 +10,8 @@ #valgrind="valgrind --tool=helgrind --log-fd=1" #valgrind="valgrind --tool=exp-ptrcheck --log-fd=1" #set -o xtrace -#export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout" -#export RSYSLOG_DEBUGLOG="log" +export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout" +export RSYSLOG_DEBUGLOG="log" case $1 in 'init') $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason cp $srcdir/testsuites/diag-common.conf diag-common.conf diff --git a/tests/incltest.sh b/tests/incltest.sh new file mode 100755 index 00000000..8e3fe454 --- /dev/null +++ b/tests/incltest.sh @@ -0,0 +1,11 @@ +echo =============================================================================== +echo \[incltest.sh\]: test $IncludeConfig for specific file + +source $srcdir/diag.sh init +source $srcdir/diag.sh startup incltest.conf +# 100 messages are enough - the question is if the include is read ;) +source $srcdir/diag.sh injectmsg 0 100 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/incltest_dir.sh b/tests/incltest_dir.sh new file mode 100755 index 00000000..3716a695 --- /dev/null +++ b/tests/incltest_dir.sh @@ -0,0 +1,11 @@ +echo =============================================================================== +echo \[incltest_dir.sh\]: test $IncludeConfig for directories + +source $srcdir/diag.sh init +source $srcdir/diag.sh startup incltest_dir.conf +# 100 messages are enough - the question is if the include is read ;) +source $srcdir/diag.sh injectmsg 0 100 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/incltest_dir_wildcard.sh b/tests/incltest_dir_wildcard.sh new file mode 100755 index 00000000..0dcad34d --- /dev/null +++ b/tests/incltest_dir_wildcard.sh @@ -0,0 +1,11 @@ +echo =============================================================================== +echo \[incltest_dir_wildcard.sh\]: test $IncludeConfig for directories with wildcards + +source $srcdir/diag.sh init +source $srcdir/diag.sh startup incltest_dir_wildcard.conf +# 100 messages are enough - the question is if the include is read ;) +source $srcdir/diag.sh injectmsg 0 100 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/incltest.conf b/tests/testsuites/incltest.conf new file mode 100644 index 00000000..737018cd --- /dev/null +++ b/tests/testsuites/incltest.conf @@ -0,0 +1,5 @@ +# see .sh file for description +# rgerhards, 2009-11-30 +$IncludeConfig diag-common.conf + +$IncludeConfig testsuites/incltest.d/include.conf diff --git a/tests/testsuites/incltest.d/include.conf b/tests/testsuites/incltest.d/include.conf new file mode 100644 index 00000000..39a2ea70 --- /dev/null +++ b/tests/testsuites/incltest.d/include.conf @@ -0,0 +1,2 @@ +$template outfmt,"%msg:F,58:2%\n" +:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt diff --git a/tests/testsuites/incltest_dir.conf b/tests/testsuites/incltest_dir.conf new file mode 100644 index 00000000..421349d2 --- /dev/null +++ b/tests/testsuites/incltest_dir.conf @@ -0,0 +1,5 @@ +# see .sh file for description +# rgerhards, 2009-11-30 +$IncludeConfig diag-common.conf + +$IncludeConfig testsuites/incltest.d/ diff --git a/tests/testsuites/incltest_dir_wildcard.conf b/tests/testsuites/incltest_dir_wildcard.conf new file mode 100644 index 00000000..0d7e6782 --- /dev/null +++ b/tests/testsuites/incltest_dir_wildcard.conf @@ -0,0 +1,5 @@ +# see .sh file for description +# rgerhards, 2009-11-30 +$IncludeConfig diag-common.conf + +$IncludeConfig testsuites/incltest.d/*.conf diff --git a/tools/syslogd.c b/tools/syslogd.c index a2ce6469..0bac0acd 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -1340,6 +1340,11 @@ static void printVersion(void) #else printf("\tRuntime Instrumentation (slow code):\tNo\n"); #endif +#ifdef USE_LIBUUID + printf("\tuuid support:\t\t\t\tYes\n"); +#else + printf("\tuuid support:\t\t\t\tNo\n"); +#endif printf("\nSee http://www.rsyslog.com for more information.\n"); } |