From 6bad782f154b7f838c7371bf99c13f6dc4ec4101 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Feb 2011 17:54:09 +0100 Subject: bugfix: abort if imfile reads file line of more than 64KiB Thanks to Peter Eisentraut for reporting and analysing this problem. bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=221 --- ChangeLog | 3 +++ runtime/stringbuf.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 571c8bcb..3f478e0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,9 @@ Version 4.6.6 [v4-stable] (rgerhards), 2010-11-?? - bugfix: imfile utilizes 32 bit to track offset. Most importantly, this problem can not experienced on Fedora 64 bit OS (which has 64 bit long's!) +- bugfix: abort if imfile reads file line of more than 64KiB + Thanks to Peter Eisentraut for reporting and analysing this problem. + bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=221 - some improvements thanks to clang's static code analyzer o overall cleanup (mostly unnecessary writes and otherwise unused stuff) o bugfix: fixed a very remote problem in msg.c which could occur when diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c index 93995b38..8b2fe455 100644 --- a/runtime/stringbuf.c +++ b/runtime/stringbuf.c @@ -156,7 +156,7 @@ rsRetVal rsCStrExtendBuf(cstr_t *pThis, size_t iMinNeeded) { uchar *pNewBuf; - unsigned short iNewSize; + size_t iNewSize; DEFiRet; /* first compute the new size needed */ -- cgit v1.2.3 From d1eb6e0edc51a78f3209448e800b25eda50340f2 Mon Sep 17 00:00:00 2001 From: Bojan Smojver Date: Wed, 23 Feb 2011 11:25:43 +0100 Subject: added work-around for bug in gtls, which causes fd leak when using TLS The capability has been added for module to specify that they do not like being unloaded. related bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=222 Signed-off-by: Rainer Gerhards --- gss-misc.c | 1 + plugins/im3195/im3195.c | 1 + plugins/imdiag/imdiag.c | 1 + plugins/imfile/imfile.c | 1 + plugins/imgssapi/imgssapi.c | 1 + plugins/imklog/imklog.c | 1 + plugins/immark/immark.c | 1 + plugins/imptcp/imptcp.c | 1 + plugins/imrelp/imrelp.c | 1 + plugins/imsolaris/imsolaris.c | 1 + plugins/imtcp/imtcp.c | 1 + plugins/imtemplate/imtemplate.c | 1 + plugins/imudp/imudp.c | 1 + plugins/imuxsock/imuxsock.c | 1 + plugins/omdbalerting/omdbalerting.c | 1 + plugins/omgssapi/omgssapi.c | 1 + plugins/omlibdbi/omlibdbi.c | 1 + plugins/ommail/ommail.c | 1 + plugins/ommysql/ommysql.c | 1 + plugins/omoracle/omoracle.c | 1 + plugins/ompgsql/ompgsql.c | 1 + plugins/omprog/omprog.c | 1 + plugins/omrelp/omrelp.c | 1 + plugins/omruleset/omruleset.c | 1 + plugins/omsnmp/omsnmp.c | 1 + plugins/omstdout/omstdout.c | 1 + plugins/omtemplate/omtemplate.c | 1 + plugins/omtesting/omtesting.c | 1 + plugins/omudpspoof/omudpspoof.c | 1 + plugins/omuxsock/omuxsock.c | 1 + plugins/pmlastmsg/pmlastmsg.c | 1 + plugins/pmrfc3164sd/pmrfc3164sd.c | 1 + runtime/module-template.h | 12 ++++++++++ runtime/modules.c | 48 +++++++++++++++++++++++++++++++++---- runtime/modules.h | 14 +++++++++++ runtime/net.c | 1 + runtime/netstrms.c | 1 + runtime/nsd_gtls.c | 1 + runtime/nsd_ptcp.c | 1 + runtime/regexp.c | 1 + runtime/strmsrv.c | 1 + runtime/zlibw.c | 1 + tcpclt.c | 1 + tcpsrv.c | 1 + tests/rt-init.c | 1 - tools/omdiscard.c | 1 + tools/omfile.c | 1 + tools/omfwd.c | 1 + tools/ompipe.c | 1 + tools/omshell.c | 1 + tools/omusrmsg.c | 1 + tools/pmrfc3164.c | 1 + tools/pmrfc5424.c | 1 + tools/smfile.c | 1 + tools/smfwd.c | 1 + tools/smtradfile.c | 1 + tools/smtradfwd.c | 1 + 57 files changed, 123 insertions(+), 5 deletions(-) diff --git a/gss-misc.c b/gss-misc.c index a5e161de..d30eda02 100644 --- a/gss-misc.c +++ b/gss-misc.c @@ -56,6 +56,7 @@ #include "unlimited_select.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c index 106da2c8..156524c9 100644 --- a/plugins/im3195/im3195.c +++ b/plugins/im3195/im3195.c @@ -51,6 +51,7 @@ #include "errmsg.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* Module static data */ DEF_IMOD_STATIC_DATA diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c index 81b357ef..b7a2a070 100644 --- a/plugins/imdiag/imdiag.c +++ b/plugins/imdiag/imdiag.c @@ -57,6 +57,7 @@ #include "net.h" /* for permittedPeers, may be removed when this is removed */ MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* static data */ DEF_IMOD_STATIC_DATA diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index 1dd5e65c..acb58dad 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -51,6 +51,7 @@ #include "ruleset.h" MODULE_TYPE_INPUT /* must be present for input modules, do not remove */ +MODULE_TYPE_NOKEEP /* defines */ diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c index dd3d67e3..446795d6 100644 --- a/plugins/imgssapi/imgssapi.c +++ b/plugins/imgssapi/imgssapi.c @@ -62,6 +62,7 @@ MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ #define ALLOWEDMETHOD_GSS 2 diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c index c59ce04f..69c8cd1a 100644 --- a/plugins/imklog/imklog.c +++ b/plugins/imklog/imklog.c @@ -58,6 +58,7 @@ #include "unicode-helper.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* Module static data */ DEF_IMOD_STATIC_DATA diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c index 5d48369e..6410003d 100644 --- a/plugins/immark/immark.c +++ b/plugins/immark/immark.c @@ -46,6 +46,7 @@ #include "glbl.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ #define DEFAULT_MARK_PERIOD (20 * 60) diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c index 6449ad62..3197564e 100644 --- a/plugins/imptcp/imptcp.c +++ b/plugins/imptcp/imptcp.c @@ -73,6 +73,7 @@ MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* static data */ DEF_IMOD_STATIC_DATA diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c index 9be38f8f..13fd4428 100644 --- a/plugins/imrelp/imrelp.c +++ b/plugins/imrelp/imrelp.c @@ -47,6 +47,7 @@ #include "prop.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* static data */ DEF_IMOD_STATIC_DATA diff --git a/plugins/imsolaris/imsolaris.c b/plugins/imsolaris/imsolaris.c index f801833b..ee9ec5c6 100644 --- a/plugins/imsolaris/imsolaris.c +++ b/plugins/imsolaris/imsolaris.c @@ -85,6 +85,7 @@ #include "sun_cddl.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ #define PATH_LOG "/dev/log" diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c index 0cfae057..d3e9cabe 100644 --- a/plugins/imtcp/imtcp.c +++ b/plugins/imtcp/imtcp.c @@ -65,6 +65,7 @@ #include "net.h" /* for permittedPeers, may be removed when this is removed */ MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* static data */ DEF_IMOD_STATIC_DATA diff --git a/plugins/imtemplate/imtemplate.c b/plugins/imtemplate/imtemplate.c index e5e43025..0e2cac11 100644 --- a/plugins/imtemplate/imtemplate.c +++ b/plugins/imtemplate/imtemplate.c @@ -80,6 +80,7 @@ #include "debug.h" /* some debug helper functions */ MODULE_TYPE_INPUT /* must be present for input modules, do not remove */ +MODULE_TYPE_NOKEEP /* defines */ diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index ad39ead0..56cdab28 100644 --- a/plugins/imudp/imudp.c +++ b/plugins/imudp/imudp.c @@ -54,6 +54,7 @@ #include "unicode-helper.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index ff38852c..40f32e4a 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -56,6 +56,7 @@ #include "hashtable.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ #define MAXFUNIX 50 diff --git a/plugins/omdbalerting/omdbalerting.c b/plugins/omdbalerting/omdbalerting.c index 2e04391c..35de5818 100644 --- a/plugins/omdbalerting/omdbalerting.c +++ b/plugins/omdbalerting/omdbalerting.c @@ -44,6 +44,7 @@ #include "cfsysline.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c index 605e5ed9..e4fdf0c0 100644 --- a/plugins/omgssapi/omgssapi.c +++ b/plugins/omgssapi/omgssapi.c @@ -58,6 +58,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index 6f130f54..4b190ce3 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -50,6 +50,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c index 324e1a77..886513c0 100644 --- a/plugins/ommail/ommail.c +++ b/plugins/ommail/ommail.c @@ -54,6 +54,7 @@ #include "glbl.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c index aff76d0a..f8bb4aa6 100644 --- a/plugins/ommysql/ommysql.c +++ b/plugins/ommysql/ommysql.c @@ -46,6 +46,7 @@ #include "cfsysline.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omoracle/omoracle.c b/plugins/omoracle/omoracle.c index 30b5834b..a37533ee 100644 --- a/plugins/omoracle/omoracle.c +++ b/plugins/omoracle/omoracle.c @@ -82,6 +82,7 @@ #include "omoracle.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /** */ DEF_OMOD_STATIC_DATA diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c index ffdcc532..ab8e4d2c 100644 --- a/plugins/ompgsql/ompgsql.c +++ b/plugins/ompgsql/ompgsql.c @@ -49,6 +49,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omprog/omprog.c b/plugins/omprog/omprog.c index 2687e7a3..56192579 100644 --- a/plugins/omprog/omprog.c +++ b/plugins/omprog/omprog.c @@ -45,6 +45,7 @@ #include "cfsysline.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 349e45aa..cf70381f 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -46,6 +46,7 @@ #include "debug.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omruleset/omruleset.c b/plugins/omruleset/omruleset.c index 0e0fc13b..c439bd83 100644 --- a/plugins/omruleset/omruleset.c +++ b/plugins/omruleset/omruleset.c @@ -49,6 +49,7 @@ #include "dirty.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* static data */ DEFobjCurrIf(ruleset); diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c index b973b09d..443cfaab 100644 --- a/plugins/omsnmp/omsnmp.c +++ b/plugins/omsnmp/omsnmp.c @@ -47,6 +47,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c index 929de703..dc9912e3 100644 --- a/plugins/omstdout/omstdout.c +++ b/plugins/omstdout/omstdout.c @@ -44,6 +44,7 @@ #include "cfsysline.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omtemplate/omtemplate.c b/plugins/omtemplate/omtemplate.c index 5577f8c6..1472ebeb 100644 --- a/plugins/omtemplate/omtemplate.c +++ b/plugins/omtemplate/omtemplate.c @@ -45,6 +45,7 @@ #include "cfsysline.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c index c474bb41..6d178467 100644 --- a/plugins/omtesting/omtesting.c +++ b/plugins/omtesting/omtesting.c @@ -57,6 +57,7 @@ #include "cfsysline.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omudpspoof/omudpspoof.c b/plugins/omudpspoof/omudpspoof.c index 3ead5447..48d7a68e 100644 --- a/plugins/omudpspoof/omudpspoof.c +++ b/plugins/omudpspoof/omudpspoof.c @@ -82,6 +82,7 @@ MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/omuxsock/omuxsock.c b/plugins/omuxsock/omuxsock.c index c66e63aa..0e336c51 100644 --- a/plugins/omuxsock/omuxsock.c +++ b/plugins/omuxsock/omuxsock.c @@ -52,6 +52,7 @@ #include "unicode-helper.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/plugins/pmlastmsg/pmlastmsg.c b/plugins/pmlastmsg/pmlastmsg.c index 275f1c1f..259c5d41 100644 --- a/plugins/pmlastmsg/pmlastmsg.c +++ b/plugins/pmlastmsg/pmlastmsg.c @@ -47,6 +47,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.lastline") /* internal structures diff --git a/plugins/pmrfc3164sd/pmrfc3164sd.c b/plugins/pmrfc3164sd/pmrfc3164sd.c index 5598c025..53204ece 100644 --- a/plugins/pmrfc3164sd/pmrfc3164sd.c +++ b/plugins/pmrfc3164sd/pmrfc3164sd.c @@ -45,6 +45,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("contrib.rfc3164sd") /* internal structures diff --git a/runtime/module-template.h b/runtime/module-template.h index d05ec23c..c2585e67 100644 --- a/runtime/module-template.h +++ b/runtime/module-template.h @@ -77,6 +77,16 @@ static rsRetVal modGetType(eModType_t *modType) \ DEF_LMOD_STATIC_DATA \ MODULE_TYPE(eMOD_LIB) +/* Macro to define whether the module should be kept dynamically linked. + */ +#define MODULE_KEEP_TYPE(x)\ +static rsRetVal modGetKeepType(eModKeepType_t *modKeepType) \ + { \ + *modKeepType = x; \ + return RS_RET_OK;\ + } +#define MODULE_TYPE_NOKEEP MODULE_KEEP_TYPE(eMOD_NOKEEP) +#define MODULE_TYPE_KEEP MODULE_KEEP_TYPE(eMOD_KEEP) /* macro to define a unique module id. This must be able to fit in a void*. The * module id must be unique inside a running rsyslogd application. It is used to @@ -342,6 +352,8 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\ *pEtryPoint = modGetID;\ } else if(!strcmp((char*) name, "getType")) {\ *pEtryPoint = modGetType;\ + } else if(!strcmp((char*) name, "getKeepType")) {\ + *pEtryPoint = modGetKeepType;\ } /* the following definition is the standard block for queryEtryPt for output diff --git a/runtime/modules.c b/runtime/modules.c index d7362753..86e7c695 100644 --- a/runtime/modules.c +++ b/runtime/modules.c @@ -77,6 +77,9 @@ static pthread_mutex_t mutLoadUnload; static modInfo_t *pLoadedModules = NULL; /* list of currently-loaded modules */ static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */ +/* already dlopen()-ed libs */ +static struct dlhandle_s *pHandles = NULL; + /* config settings */ uchar *pModDir = NULL; /* read-only after startup */ @@ -232,7 +235,9 @@ static void moduleDestruct(modInfo_t *pThis) # ifdef VALGRIND # warning "dlclose disabled for valgrind" # else - dlclose(pThis->pModHdlr); + if (pThis->eKeepType == eMOD_NOKEEP) { + dlclose(pThis->pModHdlr); + } # endif } @@ -413,6 +418,8 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_ strgen_t *pStrgen; /* used for strgen modules */ rsRetVal (*GetName)(uchar**); rsRetVal (*modGetType)(eModType_t *pType); + rsRetVal (*modGetKeepType)(eModKeepType_t *pKeepType); + struct dlhandle_s *pHandle = NULL; DEFiRet; assert(modInit != NULL); @@ -433,6 +440,8 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_ */ CHKiRet((*pNew->modQueryEtryPt)((uchar*)"getType", &modGetType)); CHKiRet((*modGetType)(&pNew->eType)); + CHKiRet((*pNew->modQueryEtryPt)((uchar*)"getKeepType", &modGetKeepType)); + CHKiRet((*modGetKeepType)(&pNew->eKeepType)); dbgprintf("module of type %d being loaded.\n", pNew->eType); /* OK, we know we can successfully work with the module. So we now fill the @@ -529,11 +538,28 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_ pNew->pszName = (uchar*) strdup((char*)name); /* we do not care if strdup() fails, we can accept that */ pNew->pModHdlr = pModHdlr; /* TODO: take this from module */ - if(pModHdlr == NULL) + if(pModHdlr == NULL) { pNew->eLinkType = eMOD_LINK_STATIC; - else + } else { pNew->eLinkType = eMOD_LINK_DYNAMIC_LOADED; + /* if we need to keep the linked module, save it */ + if (pNew->eKeepType == eMOD_KEEP) { + if((pHandle = calloc(1, sizeof (*pHandle))) == NULL) { + iRet = RS_RET_OUT_OF_MEMORY; + goto finalize_it; + } + + strncpy((char *)pHandle->szName, + (char *)name, PATH_MAX - 1); + pHandle->szName[PATH_MAX - 1] = '\0'; + pHandle->pModHdlr = pModHdlr; + pHandle->next = pHandles; + + pHandles = pHandle; + } + } + /* we initialized the structure, now let's add it to the linked list of modules */ addModToList(pNew); @@ -740,6 +766,7 @@ Load(uchar *pModName) modInfo_t *pModInfo; uchar *pModDirCurr, *pModDirNext; int iLoadCnt; + struct dlhandle_s *pHandle = NULL; assert(pModName != NULL); dbgprintf("Requested to load module '%s'\n", pModName); @@ -829,7 +856,20 @@ Load(uchar *pModName) /* complete load path constructed, so ... GO! */ dbgprintf("loading module '%s'\n", szPath); - pModHdlr = dlopen((char *) szPath, RTLD_NOW); + + /* see if we have this one already */ + for (pHandle = pHandles; pHandle; pHandle = pHandle->next) { + if (!strcmp((char *)pModName, (char *)pHandle->szName)) { + pModHdlr = pHandle->pModHdlr; + break; + } + } + + /* not found, try to dynamically link it */ + if (!pModHdlr) { + pModHdlr = dlopen((char *) szPath, RTLD_NOW); + } + iLoadCnt++; } while(pModHdlr == NULL && *pModName != '/' && pModDirNext); diff --git a/runtime/modules.h b/runtime/modules.h index df1afbc3..7eff8581 100644 --- a/runtime/modules.h +++ b/runtime/modules.h @@ -75,12 +75,26 @@ typedef enum eModLinkType_ { eMOD_LINK_ALL /* special: all linkage types, e.g. for unload */ } eModLinkType_t; +/* remember which shared libs we dlopen()-ed */ +struct dlhandle_s { + uchar szName[PATH_MAX]; + void *pModHdlr; + struct dlhandle_s *next; +}; + +/* should this module be kept linked? */ +typedef enum eModKeepType_ { + eMOD_NOKEEP, + eMOD_KEEP +} eModKeepType_t; + struct modInfo_s { struct modInfo_s *pPrev; /* support for creating a double linked module list */ struct modInfo_s *pNext; /* support for creating a linked module list */ int iIFVers; /* Interface version of module */ eModType_t eType; /* type of this module */ eModLinkType_t eLinkType; + eModKeepType_t eKeepType; /* keep the module dynamically linked on unload */ uchar* pszName; /* printable module name, e.g. for dbgprintf */ unsigned uRefCnt; /* reference count for this module; 0 -> may be unloaded */ /* functions supported by all types of modules */ diff --git a/runtime/net.c b/runtime/net.c index 7653ea1d..789790f6 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -69,6 +69,7 @@ #endif MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/runtime/netstrms.c b/runtime/netstrms.c index e9ff2568..ea2dd9f3 100644 --- a/runtime/netstrms.c +++ b/runtime/netstrms.c @@ -40,6 +40,7 @@ #include "netstrms.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index 0ee70e56..152dc8de 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -56,6 +56,7 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL; MODULE_TYPE_LIB +MODULE_TYPE_KEEP /* static data */ DEFobjStaticHelpers diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c index ca00749c..c8915231 100644 --- a/runtime/nsd_ptcp.c +++ b/runtime/nsd_ptcp.c @@ -52,6 +52,7 @@ #include "nsd_ptcp.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/runtime/regexp.c b/runtime/regexp.c index 86b3e6c4..21079f80 100644 --- a/runtime/regexp.c +++ b/runtime/regexp.c @@ -35,6 +35,7 @@ #include "regexp.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/runtime/strmsrv.c b/runtime/strmsrv.c index a122ca8a..e66ad717 100644 --- a/runtime/strmsrv.c +++ b/runtime/strmsrv.c @@ -75,6 +75,7 @@ #include "unicode-helper.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* defines */ #define STRMSESS_MAX_DEFAULT 200 /* default for nbr of strm sessions if no number is given */ diff --git a/runtime/zlibw.c b/runtime/zlibw.c index 2b386213..455c20d9 100644 --- a/runtime/zlibw.c +++ b/runtime/zlibw.c @@ -34,6 +34,7 @@ #include "zlibw.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/tcpclt.c b/tcpclt.c index d7e30e23..0db98ea9 100644 --- a/tcpclt.c +++ b/tcpclt.c @@ -46,6 +46,7 @@ #include "srUtils.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* static data */ DEFobjStaticHelpers diff --git a/tcpsrv.c b/tcpsrv.c index fbb9446d..e8d79142 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -71,6 +71,7 @@ #include "unicode-helper.h" MODULE_TYPE_LIB +MODULE_TYPE_NOKEEP /* defines */ #define TCPSESS_MAX_DEFAULT 200 /* default for nbr of tcp sessions if no number is given */ diff --git a/tests/rt-init.c b/tests/rt-init.c index dbe94b4a..2d43943f 100644 --- a/tests/rt-init.c +++ b/tests/rt-init.c @@ -28,7 +28,6 @@ MODULE_TYPE_TESTBENCH - BEGINInit CODESTARTInit ENDInit diff --git a/tools/omdiscard.c b/tools/omdiscard.c index 227ad8e2..dbd18092 100644 --- a/tools/omdiscard.c +++ b/tools/omdiscard.c @@ -38,6 +38,7 @@ #include "module-template.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/tools/omfile.c b/tools/omfile.c index 8c507a56..08f965b3 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -70,6 +70,7 @@ #include "atomic.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/tools/omfwd.c b/tools/omfwd.c index 487bb35a..38a4a16b 100644 --- a/tools/omfwd.c +++ b/tools/omfwd.c @@ -64,6 +64,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/tools/ompipe.c b/tools/ompipe.c index c51a5c48..58725fb9 100644 --- a/tools/ompipe.c +++ b/tools/ompipe.c @@ -57,6 +57,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/tools/omshell.c b/tools/omshell.c index f8a68527..25f9838f 100644 --- a/tools/omshell.c +++ b/tools/omshell.c @@ -46,6 +46,7 @@ #include "errmsg.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c index 768baca7..2d99c1e4 100644 --- a/tools/omusrmsg.c +++ b/tools/omusrmsg.c @@ -87,6 +87,7 @@ MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c index 38f556a2..635ca985 100644 --- a/tools/pmrfc3164.c +++ b/tools/pmrfc3164.c @@ -45,6 +45,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.rfc3164") /* internal structures diff --git a/tools/pmrfc5424.c b/tools/pmrfc5424.c index 07994ade..2bd18042 100644 --- a/tools/pmrfc5424.c +++ b/tools/pmrfc5424.c @@ -44,6 +44,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.rfc5424") /* internal structures diff --git a/tools/smfile.c b/tools/smfile.c index 5e4a775f..1e0bf091 100644 --- a/tools/smfile.c +++ b/tools/smfile.c @@ -46,6 +46,7 @@ #include "unicode-helper.h" MODULE_TYPE_STRGEN +MODULE_TYPE_NOKEEP STRGEN_NAME("RSYSLOG_FileFormat") /* internal structures diff --git a/tools/smfwd.c b/tools/smfwd.c index fe33fb2c..60fe94a7 100644 --- a/tools/smfwd.c +++ b/tools/smfwd.c @@ -43,6 +43,7 @@ #include "unicode-helper.h" MODULE_TYPE_STRGEN +MODULE_TYPE_NOKEEP STRGEN_NAME("RSYSLOG_ForwardFormat") /* internal structures diff --git a/tools/smtradfile.c b/tools/smtradfile.c index eff2f99a..5484f7be 100644 --- a/tools/smtradfile.c +++ b/tools/smtradfile.c @@ -43,6 +43,7 @@ #include "unicode-helper.h" MODULE_TYPE_STRGEN +MODULE_TYPE_NOKEEP STRGEN_NAME("RSYSLOG_TraditionalFileFormat") /* internal structures diff --git a/tools/smtradfwd.c b/tools/smtradfwd.c index 88dc6082..37717434 100644 --- a/tools/smtradfwd.c +++ b/tools/smtradfwd.c @@ -43,6 +43,7 @@ #include "unicode-helper.h" MODULE_TYPE_STRGEN +MODULE_TYPE_NOKEEP STRGEN_NAME("RSYSLOG_TraditionalForwardFormat") /* internal structures -- cgit v1.2.3 From dbf181c3d34570a450430a6616f1d1a5ce0a242c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 25 Feb 2011 14:23:25 +0100 Subject: bugfix: fixed a memory leak and potential abort condition this could happen if multiple rulesets were used and some output batches contained messages belonging to more than one ruleset. fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=226 fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218 --- ChangeLog | 5 +++++ runtime/batch.h | 8 +++++++- runtime/ruleset.c | 23 ++++++++++++++--------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 324fc999..4d815f56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ --------------------------------------------------------------------------- Version 5.6.4 [V5-STABLE] (rgerhards), 2011-02-25 +- bugfix: fixed a memory leak and potential abort condition + this could happen if multiple rulesets were used and some output batches + contained messages belonging to more than one ruleset. + fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=226 + fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218 - bugfix: memory leak when $RepeatedMsgReduction on was used bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225 --------------------------------------------------------------------------- diff --git a/runtime/batch.h b/runtime/batch.h index d0504f2b..944889bd 100644 --- a/runtime/batch.h +++ b/runtime/batch.h @@ -136,11 +136,16 @@ batchIsValidElem(batch_t *pBatch, int i) { /* copy one batch element to another. * This creates a complete duplicate in those cases where * it is needed. Use duplication only when absolutely necessary! + * Note that all working fields are reset to zeros. If that were + * not done, we would have potential problems with invalid + * or double pointer frees. * rgerhards, 2010-06-10 */ static inline void batchCopyElem(batch_obj_t *pDest, batch_obj_t *pSrc) { - memcpy(pDest, pSrc, sizeof(batch_obj_t)); + memset(pDest, 0, sizeof(batch_obj_t)); + pDest->pUsrp = pSrc->pUsrp; + pDest->state = pSrc->state; } @@ -171,6 +176,7 @@ batchFree(batch_t *pBatch) { static inline rsRetVal batchInit(batch_t *pBatch, int maxElem) { DEFiRet; + pBatch->iDoneUpTo = 0; pBatch->maxElem = maxElem; CHKmalloc(pBatch->pElem = calloc((size_t)maxElem, sizeof(batch_obj_t))); // TODO: replace calloc by inidividual writes? diff --git a/runtime/ruleset.c b/runtime/ruleset.c index 0584e8d6..c9c64a38 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -171,35 +171,40 @@ processBatchMultiRuleset(batch_t *pBatch) int i; int iStart; /* start index of partial batch */ int iNew; /* index for new (temporary) batch */ + int bHaveUnprocessed; /* do we (still) have unprocessed entries? (loop term predicate) */ DEFiRet; - CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem)); - snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImmediate; - - while(1) { /* loop broken inside */ + do { + bHaveUnprocessed = 0; /* search for first unprocessed element */ for(iStart = 0 ; iStart < pBatch->nElem && pBatch->pElem[iStart].state == BATCH_STATE_DISC ; ++iStart) /* just search, no action */; - if(iStart == pBatch->nElem) - FINALIZE; /* everything processed */ + break; /* everything processed */ /* prepare temporary batch */ + CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem)); + snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImmediate; currRuleset = batchElemGetRuleset(pBatch, iStart); iNew = 0; for(i = iStart ; i < pBatch->nElem ; ++i) { if(batchElemGetRuleset(pBatch, i) == currRuleset) { - batchCopyElem(&(snglRuleBatch.pElem[iNew++]), &(pBatch->pElem[i])); + /* for performance reasons, we copy only those members that we actually need */ + snglRuleBatch.pElem[iNew].pUsrp = pBatch->pElem[i].pUsrp; + snglRuleBatch.pElem[iNew].state = pBatch->pElem[i].state; + ++iNew; /* We indicate the element also as done, so it will not be processed again */ pBatch->pElem[i].state = BATCH_STATE_DISC; + } else { + bHaveUnprocessed = 1; } } snglRuleBatch.nElem = iNew; /* was left just right by the for loop */ batchSetSingleRuleset(&snglRuleBatch, 1); /* process temp batch */ processBatch(&snglRuleBatch); - } - batchFree(&snglRuleBatch); + batchFree(&snglRuleBatch); + } while(bHaveUnprocessed == 1); finalize_it: RETiRet; -- cgit v1.2.3 From 7a75a305acd47c236e3eb006936b480034208a6c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 25 Feb 2011 14:57:30 +0100 Subject: cosmetic: ChangeLog looks like 5.6.4 was already released, but it is not --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4d815f56..4e58bd0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 5.6.4 [V5-STABLE] (rgerhards), 2011-02-25 +Version 5.6.4 [V5-STABLE] (rgerhards), 2011-02-?? - bugfix: fixed a memory leak and potential abort condition this could happen if multiple rulesets were used and some output batches contained messages belonging to more than one ruleset. -- cgit v1.2.3 From 3018b443e7aee3de5485fa00e01951d2a05f2774 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 2 Mar 2011 14:01:48 +0100 Subject: preparing for 5.7.7 --- ChangeLog | 2 +- configure.ac | 2 +- doc/manual.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b95441c7..4344535f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 5.7.7 [V5-BETA] (rgerhards), 2011-03-?? +Version 5.7.7 [V5-BETA] (rgerhards), 2011-03-02 - bugfix: potential abort condition when $RepeatedMsgReduction set to on as well as potentially in a number of other places where MsgDup() was used. This only happened when the imudp input module was used and it diff --git a/configure.ac b/configure.ac index 09884b9c..278288e7 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[5.7.6],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[5.7.7],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/doc/manual.html b/doc/manual.html index 966c172d..48ff5e16 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@ rsyslog support available directly from the source!

Please visit the rsyslog sponsor's page to honor the project sponsors or become one yourself! We are very grateful for any help towards the project goals.

-

This documentation is for version 5.7.6 (beta branch) of rsyslog. +

This documentation is for version 5.7.7 (beta branch) of rsyslog. Visit the rsyslog status page to obtain current version information and project status.

If you like rsyslog, you might -- cgit v1.2.3 From 8083bd1433449fd2b1b79bf759f782e0f64c0cd2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 2 Mar 2011 14:10:08 +0100 Subject: backporting abort condition fix from 5.7.7 --- ChangeLog | 9 ++++++++- runtime/msg.c | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e58bd0e..1622a0bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ --------------------------------------------------------------------------- -Version 5.6.4 [V5-STABLE] (rgerhards), 2011-02-?? +Version 5.6.4 [V5-STABLE] (rgerhards), 2011-03-03 +- bugfix: potential abort condition when $RepeatedMsgReduction set to on + as well as potentially in a number of other places where MsgDup() was + used. This only happened when the imudp input module was used and it + depended on name resolution not yet had taken place. In other words, + this was a strange problem that could lead to hard to diagnose + instability. So if you experience instability, chances are good that + this fix will help. - bugfix: fixed a memory leak and potential abort condition this could happen if multiple rulesets were used and some output batches contained messages belonging to more than one ruleset. diff --git a/runtime/msg.c b/runtime/msg.c index e8be79db..409515ae 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -922,13 +922,14 @@ msg_t* MsgDup(msg_t* pOld) pNew->iLenMSG = pOld->iLenMSG; pNew->iLenTAG = pOld->iLenTAG; pNew->iLenHOSTNAME = pOld->iLenHOSTNAME; - if((pOld->msgFlags & NEEDS_DNSRESOL) == 1) { + if((pOld->msgFlags & NEEDS_DNSRESOL)) { localRet = msgSetFromSockinfo(pNew, pOld->rcvFrom.pfrominet); if(localRet != RS_RET_OK) { /* if something fails, we accept loss of this property, it is * better than losing the whole message. */ pNew->msgFlags &= ~NEEDS_DNSRESOL; + pNew->rcvFrom.pRcvFrom = NULL; /* make sure no dangling values */ } } else { if(pOld->rcvFrom.pRcvFrom != NULL) { -- cgit v1.2.3 From e7ed6c6a94227d3d79e22c846de831779cc4e369 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 2 Mar 2011 14:29:36 +0100 Subject: preparing for 5.6.4 --- configure.ac | 2 +- doc/manual.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index dd681617..e6b532ca 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[5.6.3],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[5.6.4],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/doc/manual.html b/doc/manual.html index 529f57d1..04e867fe 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@ rsyslog support available directly from the source!

Please visit the rsyslog sponsor's page to honor the project sponsors or become one yourself! We are very grateful for any help towards the project goals.

-

This documentation is for version 5.6.3 (beta branch) of rsyslog. +

This documentation is for version 5.6.4 (beta branch) of rsyslog. Visit the rsyslog status page to obtain current version information and project status.

If you like rsyslog, you might -- cgit v1.2.3 From 87f8ac6dc4343eb4664ca5e234c163c399afca1b Mon Sep 17 00:00:00 2001 From: Bojan Smojver Date: Fri, 4 Mar 2011 07:55:53 +0100 Subject: bugfix: regression: memory leak in module loader Signed-off-by: Rainer Gerhards --- runtime/modules.c | 28 ++++++++++++++++++---------- runtime/modules.h | 6 +++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/runtime/modules.c b/runtime/modules.c index 86e7c695..4541bddf 100644 --- a/runtime/modules.c +++ b/runtime/modules.c @@ -545,18 +545,26 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_ /* if we need to keep the linked module, save it */ if (pNew->eKeepType == eMOD_KEEP) { - if((pHandle = calloc(1, sizeof (*pHandle))) == NULL) { - iRet = RS_RET_OUT_OF_MEMORY; - goto finalize_it; + /* see if we have this one already */ + for (pHandle = pHandles; pHandle; pHandle = pHandle->next) { + if (!strcmp((char *)name, (char *)pHandle->pszName)) + break; } - strncpy((char *)pHandle->szName, - (char *)name, PATH_MAX - 1); - pHandle->szName[PATH_MAX - 1] = '\0'; - pHandle->pModHdlr = pModHdlr; - pHandle->next = pHandles; + /* not found, create it */ + if (!pHandle) { + if((pHandle = malloc(sizeof (*pHandle))) == NULL) { + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + } + if((pHandle->pszName = (uchar*) strdup((char*)name)) == NULL) { + free(pHandle); + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + } + pHandle->pModHdlr = pModHdlr; + pHandle->next = pHandles; - pHandles = pHandle; + pHandles = pHandle; + } } } @@ -859,7 +867,7 @@ Load(uchar *pModName) /* see if we have this one already */ for (pHandle = pHandles; pHandle; pHandle = pHandle->next) { - if (!strcmp((char *)pModName, (char *)pHandle->szName)) { + if (!strcmp((char *)pModName, (char *)pHandle->pszName)) { pModHdlr = pHandle->pModHdlr; break; } diff --git a/runtime/modules.h b/runtime/modules.h index 7eff8581..4daaf1f9 100644 --- a/runtime/modules.h +++ b/runtime/modules.h @@ -77,9 +77,9 @@ typedef enum eModLinkType_ { /* remember which shared libs we dlopen()-ed */ struct dlhandle_s { - uchar szName[PATH_MAX]; - void *pModHdlr; - struct dlhandle_s *next; + uchar *pszName; + void *pModHdlr; + struct dlhandle_s *next; }; /* should this module be kept linked? */ -- cgit v1.2.3 From b8610a107ee4fd9e4b1ba06e7bd43dd6cbd72ea7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 4 Mar 2011 09:19:08 +0100 Subject: added first experimental skeleton of what is to become a testconfig generator currently it generates only the power set, more work to do to make it a real config generator. --- tests/testconfgen.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/testconfgen.c diff --git a/tests/testconfgen.c b/tests/testconfgen.c new file mode 100644 index 00000000..9f191cc7 --- /dev/null +++ b/tests/testconfgen.c @@ -0,0 +1,72 @@ +/* a testcase generator + * THis program reads stdin, which must consist of (name,stmt) tupels + * where name is a part of the config name (small!) and stmt is an actual + * config statement. These tupels must be encoded as + * namestmt + * on stdin. After all tupels are read, the power set of all possible + * configurations is generated. + * Copyright (C) 2011 by Rainer Gerhards and Adiscon GmbH + * Released under the GPLv3 as part of the rsyslog project. + */ +#include +#include +#include + +static int arr[128]; +static char *name[128]; +static char *stmt[128]; + +void output(int n) +{ + int i; + + printf("name:"); + for(i = 0 ; i < n ; ++i) { + if(arr[i]) { + printf("-%s", name[i]); + } + } + printf("\n"); +} + +void pows(int n, int i) +{ + if(i == 0) { + output(n); + } else { + --i; + arr[i] = 0; + pows(n, i); + arr[i] = 1; + pows(n, i); + } +} + + +int main(int argc, char *argv[]) +{ + int n; + char iname[512]; + char istmt[2048]; + int nscanned; + + n = 0; + while(!feof(stdin)) { + nscanned = scanf("%s %[^\n]s\n", iname, istmt); + if(nscanned == EOF) + break; + else if(nscanned != 2) { + fprintf(stderr, "problem scanning entry %d, scanned %d\n", + n, nscanned); + exit(1); + } + name[n] = strdup(iname); + stmt[n] = strdup(istmt); + n++; + printf("name: %s, stmt: %s\n", iname, istmt); + } + /* n is on to high for an index, but just right as the actual number! */ + + printf("read %d entries\n", n); + pows(n, n); +} -- cgit v1.2.3 From 5709b056c5be16df1f1a2369a737e40711f20979 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 4 Mar 2011 16:33:01 +0100 Subject: changed testbench parser patterns for more usual system config a problem in the current testbench is that it depends on the locally assigned system name. We have changed the default to the most common default value. However, in the long term we need to fix this (and will do so via a preloaded DNS cache, which we do not yet have!) --- tests/testsuites/samples.parse-nodate | 2 +- tests/testsuites/samples.snare_ccoff_udp | 2 +- tests/testsuites/samples.snare_ccoff_udp2 | 8 ++++---- tests/testsuites/weird.parse1 | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/testsuites/samples.parse-nodate b/tests/testsuites/samples.parse-nodate index 7f16181c..5432bcac 100644 --- a/tests/testsuites/samples.parse-nodate +++ b/tests/testsuites/samples.parse-nodate @@ -1,5 +1,5 @@ <27>xapi: [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) -27,daemon,err,localhost,xapi,xapi:, [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) +27,daemon,err,localhost.localdomain,xapi,xapi:, [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) # a message with just text (as permitted by rfc 3164) # it is questionable if the current sample result is really correct as of 3164! This is a message! diff --git a/tests/testsuites/samples.snare_ccoff_udp b/tests/testsuites/samples.snare_ccoff_udp index 010e44d5..1ae7e8b4 100644 --- a/tests/testsuites/samples.snare_ccoff_udp +++ b/tests/testsuites/samples.snare_ccoff_udp @@ -3,7 +3,7 @@ # *real* cases (just mangled to anonymize them...) # Sample 1 - note the absence of PRI! windowsserver MSWinEventLog 1 Security 1167 Fri Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733\n -13,user,notice,localhost,windowsserver,windowsserver MSWinEventLog 1 Security 1167 Fri, Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733 +13,user,notice,localhost.localdomain,windowsserver,windowsserver MSWinEventLog 1 Security 1167 Fri, Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733 # Sample 2 # the samples below need to be disabled for the "workaround patch" for the message # parser to work. They need to be re-enabled once a final solution has been crafted diff --git a/tests/testsuites/samples.snare_ccoff_udp2 b/tests/testsuites/samples.snare_ccoff_udp2 index 337cd97c..da3a2b14 100644 --- a/tests/testsuites/samples.snare_ccoff_udp2 +++ b/tests/testsuites/samples.snare_ccoff_udp2 @@ -14,13 +14,13 @@ test insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('', 1, 'test',5, '20100321185328', '20100321185328', 1, '') # and yet another one we have seen in practice UX=Abcd-efg-hij-klmno; XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111 -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'UX=Abcd-efg-hij-klmno;') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'UX=Abcd-efg-hij-klmno;') # Sample 1 - note the absence of PRI! windowsserver MSWinEventLog 1 Security 1167 Fri Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1167 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1167 Fri') # Sample 2 windowsserver MSWinEventLog 1 Security 1166 Fri Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1166 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1166 Fri') # Sample 3 windowsserver MSWinEventLog 1 Security 1165 Fri Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1165 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1165 Fri') diff --git a/tests/testsuites/weird.parse1 b/tests/testsuites/weird.parse1 index e8b90c74..907198a1 100644 --- a/tests/testsuites/weird.parse1 +++ b/tests/testsuites/weird.parse1 @@ -11,10 +11,10 @@ 14,user,info,Aug 30 23:00:05,X4711,,, # there is a SP at the end of the line <14>Aug 30 23:00:05 -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, # and here is no SP at the end of the line <14>Aug 30 23:00:05 -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, # unfortunately, I can not test missing dates with this test suite, because # we would have the current date in the response, which we can not check against # @@ -31,7 +31,7 @@ 14,user,info,Aug 30 23:00:05,X4711,,, # there is a SP at the end of the line <14>2010-08-30T23:00:05Z -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, # and here is no SP at the end of the line <14>2010-08-30T23:00:05Z -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, -- cgit v1.2.3 From eb8e018d5a7b27700bbae1b8681b4f2f8e8a4f99 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 15:05:12 +0100 Subject: updated ChangLog with merged in fix --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4344535f..52f0528d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ --------------------------------------------------------------------------- +Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-?? +- bugfix: file descriptor leak in gnutls netstream driver + fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=222 +--------------------------------------------------------------------------- Version 5.7.7 [V5-BETA] (rgerhards), 2011-03-02 - bugfix: potential abort condition when $RepeatedMsgReduction set to on as well as potentially in a number of other places where MsgDup() was -- cgit v1.2.3 From 68124ef1f63daef07ecf45d479ca9697cb099441 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 15:18:01 +0100 Subject: fixed small regression from gnutls fd leak fix --- plugins/impstats/impstats.c | 1 + plugins/pmcisconames/pmcisconames.c | 1 + plugins/pmsnare/pmsnare.c | 1 + 3 files changed, 3 insertions(+) diff --git a/plugins/impstats/impstats.c b/plugins/impstats/impstats.c index 1312a4e8..aa98ae9d 100644 --- a/plugins/impstats/impstats.c +++ b/plugins/impstats/impstats.c @@ -49,6 +49,7 @@ #include "prop.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ #define DEFAULT_STATS_PERIOD (5 * 60) diff --git a/plugins/pmcisconames/pmcisconames.c b/plugins/pmcisconames/pmcisconames.c index 4171e688..61688cbf 100644 --- a/plugins/pmcisconames/pmcisconames.c +++ b/plugins/pmcisconames/pmcisconames.c @@ -41,6 +41,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.cisconames") /* internal structures diff --git a/plugins/pmsnare/pmsnare.c b/plugins/pmsnare/pmsnare.c index 4a9880d4..f3658d11 100644 --- a/plugins/pmsnare/pmsnare.c +++ b/plugins/pmsnare/pmsnare.c @@ -58,6 +58,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.snare") /* internal structures -- cgit v1.2.3 From 4fb7dd296efc6a798e884f0504fdf0bedebba9f5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 15:50:48 +0100 Subject: backported new testbench support for valgrind --- tests/diag.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/diag.sh b/tests/diag.sh index 2f307750..64b507e6 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -34,7 +34,12 @@ case $1 in ;; 'startup') # start rsyslogd with default params. $2 is the config file name to use # returns only after successful startup, $3 is the instance (blank or 2!) - $valgrind ../tools/rsyslogd -c4 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & + $valgrind ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & + $srcdir/diag.sh wait-startup $3 + ;; + 'startup-vg') # start rsyslogd with default params under valgrind control. $2 is the config file name to use + # returns only after successful startup, $3 is the instance (blank or 2!) + valgrind --error-exitcode=10 --malloc-fill=ff --free-fill=fe --leak-check=full ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & $srcdir/diag.sh wait-startup $3 ;; 'wait-startup') # wait for rsyslogd startup ($2 is the instance) @@ -58,6 +63,18 @@ case $1 in exit 1 fi ;; + 'wait-shutdown-vg') # actually, we wait for rsyslog.pid to be deleted. $2 is the + # instance + wait `cat rsyslog.pid` + export RSYSLOGD_EXIT=$? + echo rsyslogd run exited with $RSYSLOGD_EXIT + if [ -e core.* ] + then + echo "ABORT! core file exists, starting interactive shell" + bash + exit 1 + fi + ;; 'wait-queueempty') # wait for main message queue to be empty. $2 is the instance. if [ "$2" == "2" ] then -- cgit v1.2.3 From 4d55e2481f51b59fff9a32f9392bb3e74da9789a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 15:59:06 +0100 Subject: forgot to backport imdiag mem leak fix -- now done --- plugins/imdiag/imdiag.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c index b7a2a070..0a69ee43 100644 --- a/plugins/imdiag/imdiag.c +++ b/plugins/imdiag/imdiag.c @@ -292,6 +292,7 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg) { int iMsgQueueSize; uchar *pszMsg; + uchar *pToFree = NULL; uchar cmdBuf[1024]; DEFiRet; @@ -303,6 +304,7 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg) * before proceeding. */ CHKmalloc(pszMsg = MALLOC(sizeof(uchar) * (iLenMsg + 1))); + pToFree = pszMsg; memcpy(pszMsg, pRcv, iLenMsg); pszMsg[iLenMsg] = '\0'; @@ -322,6 +324,8 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg) } finalize_it: + if(pToFree != NULL) + free(pToFree); RETiRet; } -- cgit v1.2.3 From 36899ac8c40e78767ba58e440167a76dd4a73db1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 16:09:17 +0100 Subject: added new test to check RepeatedMsgReduction (via TCP) This is kind of a backport of a similar UDP-based test from v6. However, we do not have everything required for UDP in the v5 test tool base, so we mimic the test with tcp -- which is not bad at all, because the code path for TCP is somewhat different (and thus once we merge this patch into v6, it is a useful addition). --- tests/Makefile.am | 3 +++ tests/tcp-msgreduc-vg.sh | 20 ++++++++++++++++++++ tests/testsuites/tcp-msgreduc-vg.conf | 10 ++++++++++ 3 files changed, 33 insertions(+) create mode 100755 tests/tcp-msgreduc-vg.sh create mode 100644 tests/testsuites/tcp-msgreduc-vg.conf diff --git a/tests/Makefile.am b/tests/Makefile.am index 694b28ab..2e2e47aa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,6 +13,7 @@ TESTS = $(TESTRUNS) cfg.sh \ rulesetmultiqueue.sh \ manytcp.sh \ rsf_getenv.sh \ + tcp-msgreduc-vg.sh \ imtcp_conndrop.sh \ imtcp_addtlframedelim.sh \ sndrcv.sh \ @@ -210,6 +211,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/imtcp_conndrop.conf \ imtcp_addtlframedelim.sh \ testsuites/imtcp_addtlframedelim.conf \ + tcp-msgreduc-vg.sh \ + testsuites/./tcp-msgreduc-vg.conf \ inputname.sh \ testsuites/inputname_imtcp.conf \ testsuites/1.inputname_imtcp_12514 \ diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh new file mode 100755 index 00000000..82747f3b --- /dev/null +++ b/tests/tcp-msgreduc-vg.sh @@ -0,0 +1,20 @@ +# 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 +echo =============================================================================== +echo \[tcp-msgreduc-vg.sh\]: testing msg reduction via UDP +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg tcp-msgreduc-vg.conf +source $srcdir/diag.sh wait-startup +./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 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +if [ "$RSYSLOGD_EXIT" -eq "10" ] +then + echo "tcp-msgreduc-vg.sh FAILED" + exit 1 +fi +source $srcdir/diag.sh exit diff --git a/tests/testsuites/tcp-msgreduc-vg.conf b/tests/testsuites/tcp-msgreduc-vg.conf new file mode 100644 index 00000000..72420f04 --- /dev/null +++ b/tests/testsuites/tcp-msgreduc-vg.conf @@ -0,0 +1,10 @@ +# Test for queue disk mode (see .sh file for details) +# rgerhards, 2009-05-22 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 +$RepeatedMsgReduction on + +$template outfmt,"%msg:F,58:2%\n" +*.* ./rsyslog.out.log;outfmt -- cgit v1.2.3 From f813c01258ec5ef3adc8f4790c5c743c2f4b462a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 7 Mar 2011 18:55:13 +0100 Subject: bugfix: discard action did not work under some circumstances fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=217 --- ChangeLog | 2 ++ action.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 52f0528d..5f9b06c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-?? +- bugfix: discard action did not work under some circumstances + fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=217 - bugfix: file descriptor leak in gnutls netstream driver fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=222 --------------------------------------------------------------------------- diff --git a/action.c b/action.c index 36830577..c9e5e095 100644 --- a/action.c +++ b/action.c @@ -1481,7 +1481,8 @@ helperSubmitToActionQComplexBatch(action_t *pAction, batch_t *pBatch) DBGPRINTF("Called action(complex case), logging to %s\n", module.GetStateName(pAction->pMod)); for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { - if(pBatch->pElem[i].bFilterOK) { + if( pBatch->pElem[i].bFilterOK + && pBatch->pElem[i].state != BATCH_STATE_DISC) { doActionCallAction(pAction, (msg_t*)(pBatch->pElem[i].pUsrp)); } } -- cgit v1.2.3 From 027e6434c97c102d6c67648a49cb1ccc378346d2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 7 Mar 2011 19:03:02 +0100 Subject: small bug in testbench, wrong config file pulled in one test --- tests/imtcp_conndrop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh index 2caa0ce2..9855ee3b 100755 --- a/tests/imtcp_conndrop.sh +++ b/tests/imtcp_conndrop.sh @@ -6,7 +6,7 @@ echo =========================================================================== echo TEST: \[imtcp_conndrop.sh\]: test imtcp with random connection drops cat rsyslog.action.1.include source $srcdir/diag.sh init -source $srcdir/diag.sh startup imptcp_large.conf +source $srcdir/diag.sh startup imtcp_conndrop.conf # 100 byte messages to gain more practical data use source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D sleep 4 # due to large messages, we need this time for the tcp receiver to settle... -- cgit v1.2.3 From 5d3783b0c0449df1d4d1b0d38ce35dc2995ce22a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Mar 2011 18:18:14 +0100 Subject: added new test to testbench --- tests/Makefile.am | 5 ++++- tests/discard-rptdmsg.sh | 17 +++++++++++++++++ tests/testsuites/discard-rptdmsg.conf | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 tests/discard-rptdmsg.sh create mode 100644 tests/testsuites/discard-rptdmsg.conf diff --git a/tests/Makefile.am b/tests/Makefile.am index 3c00c24a..3f703fcb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,8 @@ TESTS = $(TESTRUNS) cfg.sh \ pipe_noreader.sh \ dircreate_dflt.sh \ dircreate_off.sh \ + discard-rptdmsg.sh \ + discard.sh \ queue-persist.sh if ENABLE_IMPTCP @@ -68,7 +70,6 @@ TESTS += omod-if-array.sh \ inputname.sh \ threadingmq.sh \ threadingmqaq.sh \ - discard.sh \ badqi.sh \ tabescape_dflt.sh \ tabescape_off.sh \ @@ -212,6 +213,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ omod-if-array.sh \ discard.sh \ testsuites/discard.conf \ + discard-rptdmsg.sh \ + testsuites/discard-rptdmsg.conf \ diag.sh \ testsuites/diag-common.conf \ testsuites/diag-common2.conf \ diff --git a/tests/discard-rptdmsg.sh b/tests/discard-rptdmsg.sh new file mode 100755 index 00000000..a8b35c38 --- /dev/null +++ b/tests/discard-rptdmsg.sh @@ -0,0 +1,17 @@ +# Test for discard-rptdmsg functionality +# This test checks if discard-rptdmsg works. It is not a perfect test but +# will find at least segfaults and obviously not discard-rptdmsged messages. +# added 2009-07-30 by Rgerhards +# This file is part of the rsyslog project, released under GPLv3 +# uncomment for debugging support: +echo =============================================================================== +echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup discard-rptdmsg.conf +# 20000 messages should be enough - the disk test is slow enough ;) +sleep 4 +source $srcdir/diag.sh tcpflood -m10 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/discard-rptdmsg.conf b/tests/testsuites/discard-rptdmsg.conf new file mode 100644 index 00000000..74060e31 --- /dev/null +++ b/tests/testsuites/discard-rptdmsg.conf @@ -0,0 +1,15 @@ +# Test for discard functionality +# rgerhards, 2009-07-30 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$RepeatedMsgReduction on + +:msg, contains, "00000001" ~ + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt -- cgit v1.2.3 From 3866bd51bf7e622594ff4831664c28d80f711cb3 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Mar 2011 18:29:33 +0100 Subject: bugfix(kind of): tell users that config graph can currently not be generated closes: http://bugzilla.adiscon.com/show_bug.cgi?id=232 --- ChangeLog | 8 ++++++++ action.c | 3 ++- doc/rsconf1_generateconfiggraph.html | 8 +++++++- tools/syslogd.c | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1622a0bc..a8ac416d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ --------------------------------------------------------------------------- +Version 5.6.5 [V5-STABLE] (rgerhards), 2011-03-?? +- bugfix(kind of): tell users that config graph can currently not be + generated + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=232 +- bugfix: discard action did not work under some circumstances + fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=217 + (backport from 5.7.8) +--------------------------------------------------------------------------- Version 5.6.4 [V5-STABLE] (rgerhards), 2011-03-03 - bugfix: potential abort condition when $RepeatedMsgReduction set to on as well as potentially in a number of other places where MsgDup() was diff --git a/action.c b/action.c index 4bf8ba04..d41449d0 100644 --- a/action.c +++ b/action.c @@ -1480,7 +1480,8 @@ helperSubmitToActionQComplexBatch(action_t *pAction, batch_t *pBatch) DBGPRINTF("Called action(complex case), logging to %s\n", module.GetStateName(pAction->pMod)); for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { - if(pBatch->pElem[i].bFilterOK) { + if( pBatch->pElem[i].bFilterOK + && pBatch->pElem[i].state != BATCH_STATE_DISC) { doActionCallAction(pAction, (msg_t*)(pBatch->pElem[i].pUsrp)); } } diff --git a/doc/rsconf1_generateconfiggraph.html b/doc/rsconf1_generateconfiggraph.html index 0b18463a..3f0fd666 100644 --- a/doc/rsconf1_generateconfiggraph.html +++ b/doc/rsconf1_generateconfiggraph.html @@ -8,8 +8,14 @@

$GenerateConfigGraph

Type: global configuration directive

Default:

-

Available Since: 4.3.1

+

Available Since: 4.3.1 CURRENTLY NOT AVAILABLE

Description:

+This directive is currently not supported. We had to disable it when we improved the +rule engine. It is considerable effort to re-enable it. On the other hand, we are about +to add a new config system, which will make yet another config graph method necessary. +As such we have decided to currently disable this functionality and re-introduce it when +the new config system has been instantiated. +

This directive permits to create (hopefully) good-looking visualizations of rsyslogd's configuration. It does not affect rsyslog operation. If the directive is specified multiple times, all but the last are ignored. If it is specified, a graph is created. This happens diff --git a/tools/syslogd.c b/tools/syslogd.c index ffcaa27f..dd9729ef 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -1334,6 +1334,11 @@ generateConfigDAG(uchar *pszDAGFile) assert(pszDAGFile != NULL); + logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*) + "Configuration graph generation is unfortunately disabled " + "in the current code base.", 0); + ABORT_FINALIZE(RS_RET_FILENAME_INVALID); + if((fp = fopen((char*) pszDAGFile, "w")) == NULL) { logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*) "configuraton graph output file could not be opened, none generated", 0); -- cgit v1.2.3 From 1a0875865300472150c411afa8335e47a1722bae Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Mar 2011 18:58:28 +0100 Subject: further improved testbench some cosmetic issues, plus a new valgrind-based test --- tests/Makefile.am | 2 ++ tests/diag.sh | 7 +++++++ tests/discard-rptdmsg-vg.sh | 13 +++++++++++++ tests/discard-rptdmsg.sh | 7 ------- tests/tcp-msgreduc-vg.sh | 6 +----- 5 files changed, 23 insertions(+), 12 deletions(-) create mode 100755 tests/discard-rptdmsg-vg.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index c834ef6e..3e07e1c6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -49,6 +49,7 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ + discard-rptdmsg-vg.sh \ discard.sh \ queue-persist.sh @@ -223,6 +224,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ discard.sh \ testsuites/discard.conf \ discard-rptdmsg.sh \ + discard-rptdmsg-vg.sh \ testsuites/discard-rptdmsg.conf \ diag.sh \ testsuites/diag-common.conf \ diff --git a/tests/diag.sh b/tests/diag.sh index 64b507e6..e8e3ce1c 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -75,6 +75,13 @@ case $1 in exit 1 fi ;; + 'check-exit-vg') # wait for main message queue to be empty. $2 is the instance. + if [ "$RSYSLOGD_EXIT" -eq "10" ] + then + echo "valgrind run FAILED with exceptions - terminating" + exit 1 + fi + ;; 'wait-queueempty') # wait for main message queue to be empty. $2 is the instance. if [ "$2" == "2" ] then diff --git a/tests/discard-rptdmsg-vg.sh b/tests/discard-rptdmsg-vg.sh new file mode 100755 index 00000000..f56ac597 --- /dev/null +++ b/tests/discard-rptdmsg-vg.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg discard-rptdmsg.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +# we need to give rsyslog a little time to settle the receiver +./msleep 1500 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/discard-rptdmsg.sh b/tests/discard-rptdmsg.sh index a8b35c38..a8be110c 100755 --- a/tests/discard-rptdmsg.sh +++ b/tests/discard-rptdmsg.sh @@ -1,15 +1,8 @@ -# Test for discard-rptdmsg functionality -# This test checks if discard-rptdmsg works. It is not a perfect test but -# will find at least segfaults and obviously not discard-rptdmsged messages. -# added 2009-07-30 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -# uncomment for debugging support: echo =============================================================================== echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality source $srcdir/diag.sh init source $srcdir/diag.sh startup discard-rptdmsg.conf -# 20000 messages should be enough - the disk test is slow enough ;) -sleep 4 source $srcdir/diag.sh tcpflood -m10 -i1 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh index 82747f3b..7e388360 100755 --- a/tests/tcp-msgreduc-vg.sh +++ b/tests/tcp-msgreduc-vg.sh @@ -12,9 +12,5 @@ source $srcdir/diag.sh wait-startup ./msleep 1500 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown-vg -if [ "$RSYSLOGD_EXIT" -eq "10" ] -then - echo "tcp-msgreduc-vg.sh FAILED" - exit 1 -fi +source $srcdir/diag.sh wait-shutdown-vg source $srcdir/diag.sh exit -- cgit v1.2.3 From 22f36ffbbd0c4e0fe1bfe331cb7ca15ec6ae80aa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 08:23:16 +0100 Subject: testbench: valgrind tests only executed if valgrind is available --- configure.ac | 4 ++++ tests/Makefile.am | 8 ++++++-- tests/imtcp_conndrop.sh | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 278288e7..a7d26a1f 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,10 @@ AC_CONFIG_HEADERS([config.h]) AC_GNU_SOURCE +# check if valgrind is present +AC_CHECK_PROG(have_valgrind, [valgrind], [yes]) +AM_CONDITIONAL(HAVE_VALGRIND, test x$have_valgrind = xyes) + # check for Java compiler AC_CHECK_PROG(HAVE_JAVAC, [javac], [yes]) if test x"$HAVE_JAVAC" = x""; then diff --git a/tests/Makefile.am b/tests/Makefile.am index 3e07e1c6..7527b27f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,6 @@ TESTS = $(TESTRUNS) cfg.sh \ rulesetmultiqueue.sh \ manytcp.sh \ rsf_getenv.sh \ - tcp-msgreduc-vg.sh \ imtcp_conndrop.sh \ imtcp_addtlframedelim.sh \ sndrcv.sh \ @@ -49,10 +48,15 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ - discard-rptdmsg-vg.sh \ discard.sh \ queue-persist.sh +if HAVE_VALGRIND +TESTS += \ + discard-rptdmsg-vg.sh \ + tcp-msgreduc-vg.sh +endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh index 9855ee3b..c7eb89e8 100755 --- a/tests/imtcp_conndrop.sh +++ b/tests/imtcp_conndrop.sh @@ -9,7 +9,7 @@ source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp_conndrop.conf # 100 byte messages to gain more practical data use source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D -sleep 4 # due to large messages, we need this time for the tcp receiver to settle... +sleep 6 # due to large messages, we need this time for the tcp receiver to settle... source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown # and wait for it to terminate source $srcdir/diag.sh seq-check 0 49999 -E -- cgit v1.2.3 From 906b04e97e8e1f8f09110e6e13caad87862f4736 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 7 Mar 2011 22:39:37 +0100 Subject: systemd: use standard syslog.socket unit In systemd we now have a standard socket unit for /dev/log called syslog.socket. This unit can be shared between an early boot mini syslog and the full syslog implementation started later on. The mini syslog is shipped along systemd and does nothing but simply forward the data received through /dev/log to the kernel log buffer (i.e. kmsg, as visible by dmesg). It is run during early boot, and then as soon as rsyslog starts up it is terminated, so that rsyslog can take over the /dev/log socket. Since one of the first things rsyslog does after starting up is flushing the kernel log buffer to disk we end up with all data from early boot up in syslog. This patch changes two things: removes rsyslog.socket and instead configures rsyslog.service to take possession of syslock.socket. And secondly includes a PreStart line to terminate the running syslog bridge instance. --- Makefile.am | 3 --- rsyslog.service.in | 3 ++- rsyslog.socket | 8 -------- 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 rsyslog.socket diff --git a/Makefile.am b/Makefile.am index 9493e373..f699cc46 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,9 +44,6 @@ endif # if HAVE_SYSTEMD -dist_systemdsystemunit_DATA = \ - rsyslog.socket - nodist_systemdsystemunit_DATA = \ rsyslog.service diff --git a/rsyslog.service.in b/rsyslog.service.in index 2bcde528..03db596e 100644 --- a/rsyslog.service.in +++ b/rsyslog.service.in @@ -2,9 +2,10 @@ Description=System Logging Service [Service] +ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service ExecStart=@sbindir@/rsyslogd -n -c5 ExecReload=/bin/kill -HUP $MAINPID +Sockets=syslog.socket [Install] WantedBy=multi-user.target -Also=rsyslog.socket diff --git a/rsyslog.socket b/rsyslog.socket deleted file mode 100644 index 0cd86054..00000000 --- a/rsyslog.socket +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Syslog Socket - -[Socket] -ListenDatagram=/dev/log - -[Install] -WantedBy=sockets.target -- cgit v1.2.3 From 3f657f5b056c02cddb17ad639b226f24ebb047c5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 09:58:07 +0100 Subject: make testbench not errout if imdiag is not enabled --- tests/Makefile.am | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7527b27f..a720c0c3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,10 @@ if ENABLE_TESTBENCH TESTRUNS = rt_init rscript check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject -TESTS = $(TESTRUNS) cfg.sh \ +TESTS = $(TESTRUNS) cfg.sh + +if ENABLE_IMDIAG +TESTS += \ arrayqueue.sh \ linkedlistqueue.sh \ da-mainmsg-q.sh \ @@ -49,7 +52,10 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ discard.sh \ - queue-persist.sh + queue-persist.sh \ + arrayqueue.sh \ + linkedlistqueue.sh +endif if HAVE_VALGRIND TESTS += \ @@ -89,9 +95,11 @@ TESTS += omod-if-array.sh \ endif if ENABLE_OMRULESET +if ENABLE_IMDIAG TESTS += omruleset.sh \ omruleset-queue.sh endif +endif if ENABLE_EXTENDED_TESTS TESTS += random.sh @@ -193,9 +201,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rsf_getenv.conf \ diskqueue.sh \ testsuites/diskqueue.conf \ - arrayqueue.sh \ testsuites/arrayqueue.conf \ - linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ testsuites/da-mainmsg-q.conf \ -- cgit v1.2.3 From 67a52bbd1d236f2f24297efdbceaf20c6fa10906 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 10:01:19 +0100 Subject: preparing for 5.7.8 release --- ChangeLog | 3 ++- configure.ac | 2 +- doc/manual.html | 2 +- tests/imtcp_conndrop.sh | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5058fbc..baf0bcfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ --------------------------------------------------------------------------- -Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-?? +Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 +- systemd support somewhat improved (can now take over existing log sockt) - bugfix: discard action did not work under some circumstances fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=217 - bugfix: file descriptor leak in gnutls netstream driver diff --git a/configure.ac b/configure.ac index a7d26a1f..b5666d66 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[5.7.7],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[5.7.8],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/doc/manual.html b/doc/manual.html index 48ff5e16..945a5a62 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@ rsyslog support available directly from the source!

Please visit the rsyslog sponsor's page to honor the project sponsors or become one yourself! We are very grateful for any help towards the project goals.

-

This documentation is for version 5.7.7 (beta branch) of rsyslog. +

This documentation is for version 5.7.8 (beta branch) of rsyslog. Visit the rsyslog status page to obtain current version information and project status.

If you like rsyslog, you might diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh index c7eb89e8..0bfcd99c 100755 --- a/tests/imtcp_conndrop.sh +++ b/tests/imtcp_conndrop.sh @@ -9,7 +9,7 @@ source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp_conndrop.conf # 100 byte messages to gain more practical data use source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D -sleep 6 # due to large messages, we need this time for the tcp receiver to settle... +sleep 10 # due to large messages, we need this time for the tcp receiver to settle... source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown # and wait for it to terminate source $srcdir/diag.sh seq-check 0 49999 -E -- cgit v1.2.3 From 53afa44de8d7796df46a12d66fd9866165779d94 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 10:31:47 +0100 Subject: bugfix: (regression) omhdfs did no longer compile --- ChangeLog | 3 +++ plugins/omhdfs/omhdfs.c | 1 + 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index baf0bcfe..a9fb0d34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ --------------------------------------------------------------------------- +Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? +- bugfix: (regression) omhdfs did no longer compile +--------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 - systemd support somewhat improved (can now take over existing log sockt) - bugfix: discard action did not work under some circumstances diff --git a/plugins/omhdfs/omhdfs.c b/plugins/omhdfs/omhdfs.c index 9705b7fd..8b72747f 100644 --- a/plugins/omhdfs/omhdfs.c +++ b/plugins/omhdfs/omhdfs.c @@ -50,6 +50,7 @@ #include "hashtable_itr.h" MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP /* internal structures */ -- cgit v1.2.3 From d1ae9e393885fb6d9fc69fc1bb08a098a8ac0328 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 11:28:22 +0100 Subject: improved testbench --- ChangeLog | 1 + tests/Makefile.am | 5 +++++ tests/discard-allmark-vg.sh | 13 +++++++++++++ tests/discard-allmark.sh | 10 ++++++++++ tests/testsuites/discard-allmark.conf | 15 +++++++++++++++ 5 files changed, 44 insertions(+) create mode 100755 tests/discard-allmark-vg.sh create mode 100755 tests/discard-allmark.sh create mode 100644 tests/testsuites/discard-allmark.conf diff --git a/ChangeLog b/ChangeLog index a9fb0d34..5be02fca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ --------------------------------------------------------------------------- Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? +- improved testbench - bugfix: (regression) omhdfs did no longer compile --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 diff --git a/tests/Makefile.am b/tests/Makefile.am index a720c0c3..35513614 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -51,6 +51,7 @@ TESTS += \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ + discard-allmark.sh \ discard.sh \ queue-persist.sh \ arrayqueue.sh \ @@ -60,6 +61,7 @@ endif if HAVE_VALGRIND TESTS += \ discard-rptdmsg-vg.sh \ + discard-allmark-vg.sh \ tcp-msgreduc-vg.sh endif @@ -236,6 +238,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ discard-rptdmsg.sh \ discard-rptdmsg-vg.sh \ testsuites/discard-rptdmsg.conf \ + discard-allmark.sh \ + discard-allmark-vg.sh \ + testsuites/discard-allmark.conf \ diag.sh \ testsuites/diag-common.conf \ testsuites/diag-common2.conf \ diff --git a/tests/discard-allmark-vg.sh b/tests/discard-allmark-vg.sh new file mode 100755 index 00000000..57ce8e3e --- /dev/null +++ b/tests/discard-allmark-vg.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-allmark.sh\]: testing discard-allmark functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg discard-allmark.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +# we need to give rsyslog a little time to settle the receiver +./msleep 1500 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/discard-allmark.sh b/tests/discard-allmark.sh new file mode 100755 index 00000000..eb46ae70 --- /dev/null +++ b/tests/discard-allmark.sh @@ -0,0 +1,10 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-allmark.sh\]: testing discard-allmark functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup discard-allmark.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/discard-allmark.conf b/tests/testsuites/discard-allmark.conf new file mode 100644 index 00000000..8a4983c1 --- /dev/null +++ b/tests/testsuites/discard-allmark.conf @@ -0,0 +1,15 @@ +# Test for discard functionality +# rgerhards, 2009-07-30 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$ActionWriteAllMarkMessages on + +:msg, contains, "00000001" ~ + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt -- cgit v1.2.3 From 533a5351365cec93f233e0e99d98cedeadc5bd69 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 12:40:58 +0100 Subject: added MySQL life tests for ommysql tests run against a life database instance which must be setup in a specific way. --- ChangeLog | 2 ++ configure.ac | 18 ++++++++++++++++++ tests/Makefile.am | 19 +++++++++++++++++++ tests/mysql-asyn-vg.sh | 14 ++++++++++++++ tests/mysql-asyn.sh | 13 +++++++++++++ tests/mysql-basic-vg.sh | 14 ++++++++++++++ tests/mysql-basic.sh | 13 +++++++++++++ tests/tcp-msgreduc-vg.sh | 2 +- tests/testsuites/mysql-asyn.conf | 5 +++++ tests/testsuites/mysql-basic.conf | 4 ++++ tests/testsuites/mysql-select-msg.sql | 2 ++ tests/testsuites/mysql-truncate.sql | 2 ++ 12 files changed, 107 insertions(+), 1 deletion(-) create mode 100755 tests/mysql-asyn-vg.sh create mode 100755 tests/mysql-asyn.sh create mode 100755 tests/mysql-basic-vg.sh create mode 100755 tests/mysql-basic.sh create mode 100644 tests/testsuites/mysql-asyn.conf create mode 100644 tests/testsuites/mysql-basic.conf create mode 100644 tests/testsuites/mysql-select-msg.sql create mode 100644 tests/testsuites/mysql-truncate.sql diff --git a/ChangeLog b/ChangeLog index 5be02fca..69620435 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ --------------------------------------------------------------------------- Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? - improved testbench + among others, life tests for ommysql (against a test database) have + been added, valgrind-based testing enhanced, ... - bugfix: (regression) omhdfs did no longer compile --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 diff --git a/configure.ac b/configure.ac index b5666d66..58b203ff 100644 --- a/configure.ac +++ b/configure.ac @@ -736,6 +736,23 @@ AC_ARG_ENABLE(extended_tests, AM_CONDITIONAL(ENABLE_EXTENDED_TESTS, test x$enable_extended_tests = xyes) +# capability to enable MySQL testbench tests. This requries that a Syslog database +# with the default schema has been created on the local (127.0.0.1) MySQL server and +# a user "rsyslog" with password "testbench" exists, is able to login with default +# parameters and has sufficient (read: all) privileges on that database. +# rgerhards, 2011-03-09 +AC_ARG_ENABLE(mysql_tests, + [AS_HELP_STRING([--enable-mysql-tests],[enable MySQL specific tests in testbench @<:@default=no@:>@])], + [case "${enableval}" in + yes) enable_mysql_tests="yes" ;; + no) enable_mysql_tests="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mysql-tests) ;; + esac], + [enable_mysql_tests=no] +) +AM_CONDITIONAL(ENABLE_MYSQL_TESTS, test x$enable_mysql_tests = xyes) + + # Mail support (so far we do not need a library, but we need to turn this on and off) AC_ARG_ENABLE(mail, [AS_HELP_STRING([--enable-mail],[Enable mail support @<:@default=no@:>@])], @@ -1221,6 +1238,7 @@ echo echo "---{ debugging support }---" echo " Testbench enabled: $enable_testbench" echo " Extended Testbench enabled: $enable_extended_tests" +echo " MySQL Tests enabled: $enable_mysql_tests" echo " Debug mode enabled: $enable_debug" echo " Runtime Instrumentation enabled: $enable_rtinst" echo " Diagnostic tools enabled: $enable_diagtools" diff --git a/tests/Makefile.am b/tests/Makefile.am index 35513614..acadda04 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -65,6 +65,17 @@ TESTS += \ tcp-msgreduc-vg.sh endif +if ENABLE_MYSQL_TESTS +TESTS += \ + mysql-basic.sh \ + mysql-asyn.sh +if HAVE_VALGRIND +TESTS += \ + mysql-basic-vg.sh \ + mysql-asyn-vg.sh +endif +endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ @@ -354,6 +365,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ imuxsock_ccmiddle_root.sh \ testsuites/imuxsock_ccmiddle_root.conf \ resultdata/imuxsock_ccmiddle.log \ + testsuites\mysql-truncate.sql \ + testsuites\mysql-select-msg.sql \ + mysql-basic.sh \ + mysql-basic-vg.sh \ + testsuites\mysql-basic.sh \ + mysql-asyn.sh \ + mysql-asyn-vg.sh \ + testsuites\mysql-asyn.sh \ cfg.sh ourtail_SOURCES = ourtail.c diff --git a/tests/mysql-asyn-vg.sh b/tests/mysql-asyn-vg.sh new file mode 100755 index 00000000..dfe68665 --- /dev/null +++ b/tests/mysql-asyn-vg.sh @@ -0,0 +1,14 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-asyn.sh\]: asyn test for mysql functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-asyn.sh b/tests/mysql-asyn.sh new file mode 100755 index 00000000..de6d6fde --- /dev/null +++ b/tests/mysql-asyn.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-asyn.sh\]: asyn test for mysql functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-basic-vg.sh b/tests/mysql-basic-vg.sh new file mode 100755 index 00000000..215f41f0 --- /dev/null +++ b/tests/mysql-basic-vg.sh @@ -0,0 +1,14 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-basic-vg.sh\]: basic test for mysql-basic functionality/valgrind +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-basic.sh b/tests/mysql-basic.sh new file mode 100755 index 00000000..ba9d00f2 --- /dev/null +++ b/tests/mysql-basic.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-basic.sh\]: basic test for mysql-basic functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh index 7e388360..cd8534e4 100755 --- a/tests/tcp-msgreduc-vg.sh +++ b/tests/tcp-msgreduc-vg.sh @@ -12,5 +12,5 @@ source $srcdir/diag.sh wait-startup ./msleep 1500 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown-vg -source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg source $srcdir/diag.sh exit diff --git a/tests/testsuites/mysql-asyn.conf b/tests/testsuites/mysql-asyn.conf new file mode 100644 index 00000000..acdf9bbd --- /dev/null +++ b/tests/testsuites/mysql-asyn.conf @@ -0,0 +1,5 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/ommysql/.libs/ommysql +$ActionQueueType LinkedList +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/mysql-basic.conf b/tests/testsuites/mysql-basic.conf new file mode 100644 index 00000000..070094f5 --- /dev/null +++ b/tests/testsuites/mysql-basic.conf @@ -0,0 +1,4 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/ommysql/.libs/ommysql +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/mysql-select-msg.sql b/tests/testsuites/mysql-select-msg.sql new file mode 100644 index 00000000..2d27a331 --- /dev/null +++ b/tests/testsuites/mysql-select-msg.sql @@ -0,0 +1,2 @@ +use Syslog; +select substring(Message,9,8) from SystemEvents; diff --git a/tests/testsuites/mysql-truncate.sql b/tests/testsuites/mysql-truncate.sql new file mode 100644 index 00000000..ca852beb --- /dev/null +++ b/tests/testsuites/mysql-truncate.sql @@ -0,0 +1,2 @@ +use Syslog; +truncate table SystemEvents; -- cgit v1.2.3 From c1760db6bbd07086177679b2be4b2d307657ddce Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 13:01:57 +0100 Subject: bugfix: omlibdbi did not use password from rsyslog.con closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 --- ChangeLog | 2 ++ plugins/omlibdbi/omlibdbi.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3f478e0d..917ce51f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ Version 4.6.6 [v4-stable] (rgerhards), 2010-11-?? - bugfix: abort if imfile reads file line of more than 64KiB Thanks to Peter Eisentraut for reporting and analysing this problem. bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=221 +- bugfix: omlibdbi did not use password from rsyslog.con + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 - some improvements thanks to clang's static code analyzer o overall cleanup (mostly unnecessary writes and otherwise unused stuff) o bugfix: fixed a very remote problem in msg.c which could occur when diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index 6f130f54..67b1edf9 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -287,7 +287,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) if(dbName != NULL) if((pData->dbName = (uchar*) strdup((char*)dbName)) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); if(pwd != NULL) - if((pData->pwd = (uchar*) strdup((char*)"")) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + if((pData->pwd = (uchar*) strdup((char*)pwd)) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_RQD_TPL_OPT_SQL, (uchar*) " StdDBFmt")); -- cgit v1.2.3 From dffb2bab8cb52599626b82587da09df39b16e7aa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 13:08:32 +0100 Subject: adding bugfix info to ChangLog (imported fix) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index c7096d2b..74fd299f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 5.6.5 [V5-STABLE] (rgerhards), 2011-03-?? +- bugfix: omlibdbi did not use password from rsyslog.con + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 - bugfix(kind of): tell users that config graph can currently not be generated closes: http://bugzilla.adiscon.com/show_bug.cgi?id=232 -- cgit v1.2.3 From 8d79906d500c5760f093123b3ef3c43508ffce58 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 13:18:37 +0100 Subject: cosmetic: added bug info --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index c4bcadc2..784a8787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? among others, life tests for ommysql (against a test database) have been added, valgrind-based testing enhanced, ... - bugfix: (regression) omhdfs did no longer compile +- bugfix: omlibdbi did not use password from rsyslog.con + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 --------------------------------------------------------------------------- Version 5.7.8 [V5-BETA] (rgerhards), 2011-03-09 - systemd support somewhat improved (can now take over existing log sockt) -- cgit v1.2.3 From 32acf5b9f7c706c1104e94e654fe8c934e7340ea Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 17:47:16 +0100 Subject: fixed problems in testbench makefile (just introduced...) --- tests/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index acadda04..4a1bfe57 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -365,14 +365,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ imuxsock_ccmiddle_root.sh \ testsuites/imuxsock_ccmiddle_root.conf \ resultdata/imuxsock_ccmiddle.log \ - testsuites\mysql-truncate.sql \ - testsuites\mysql-select-msg.sql \ + testsuites/mysql-truncate.sql \ + testsuites/mysql-select-msg.sql \ mysql-basic.sh \ mysql-basic-vg.sh \ - testsuites\mysql-basic.sh \ + testsuites/mysql-basic.conf \ mysql-asyn.sh \ mysql-asyn-vg.sh \ - testsuites\mysql-asyn.sh \ + testsuites/mysql-asyn.conf \ cfg.sh ourtail_SOURCES = ourtail.c -- cgit v1.2.3 From 7fa1956da7ea3fa08d3187d3a5d883cfe5a67845 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 10 Mar 2011 03:23:58 +0100 Subject: bugfix: pmaixforwarded from fails to build Signed-off-by: Rainer Gerhards --- plugins/pmaixforwardedfrom/pmaixforwardedfrom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c b/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c index 11634199..fa4a9087 100644 --- a/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c +++ b/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c @@ -41,6 +41,7 @@ #include "unicode-helper.h" MODULE_TYPE_PARSER +MODULE_TYPE_NOKEEP PARSER_NAME("rsyslog.aixforwardedfrom") /* internal structures -- cgit v1.2.3 From 225aa0e367a604d3891bba13d470bfacc3dfe544 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 03:41:17 +0100 Subject: fixed problem in testbench Makefile, added module to distcheck Thanks to Michael Biebl for mentioning that some modules were not included in make distcheck. --- Makefile.am | 3 +++ tests/Makefile.am | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f699cc46..4e3e9476 100644 --- a/Makefile.am +++ b/Makefile.am @@ -230,5 +230,8 @@ DISTCHECK_CONFIGURE_FLAGS= --enable-gssapi_krb5 \ --enable-impstats \ --enable-imptcp \ --enable-memcheck \ + --enable-pmaixforwardedfrom \ + --enable-pmcisconames \ + --enable-pmsnare \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) ACLOCAL_AMFLAGS = -I m4 diff --git a/tests/Makefile.am b/tests/Makefile.am index 4a1bfe57..eb7ad94f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,7 +6,6 @@ TESTS = $(TESTRUNS) cfg.sh if ENABLE_IMDIAG TESTS += \ arrayqueue.sh \ - linkedlistqueue.sh \ da-mainmsg-q.sh \ validation-run.sh \ imtcp-multiport.sh \ @@ -54,7 +53,6 @@ TESTS += \ discard-allmark.sh \ discard.sh \ queue-persist.sh \ - arrayqueue.sh \ linkedlistqueue.sh endif @@ -214,7 +212,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rsf_getenv.conf \ diskqueue.sh \ testsuites/diskqueue.conf \ + arrayqueue.sh \ testsuites/arrayqueue.conf \ + linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ testsuites/da-mainmsg-q.conf \ -- cgit v1.2.3 From 9cc963926bad3de9a78df51a19456f419c34492a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 14:46:47 +0100 Subject: bugfix: minor memory leak in omlibdbi (< 1k per instance and run) also testbench improvement (omlibdbi now also receives a couple of tests if we have a life MySQL server). --- ChangeLog | 1 + plugins/omlibdbi/omlibdbi.c | 9 ++++++++- tests/Makefile.am | 11 +++++++++++ tests/libdbi-asyn.sh | 13 +++++++++++++ tests/libdbi-basic-vg.sh | 16 ++++++++++++++++ tests/libdbi-basic.sh | 13 +++++++++++++ tests/testsuites/libdbi-asyn.conf | 12 ++++++++++++ tests/testsuites/libdbi-basic.conf | 9 +++++++++ 8 files changed, 83 insertions(+), 1 deletion(-) create mode 100755 tests/libdbi-asyn.sh create mode 100755 tests/libdbi-basic-vg.sh create mode 100755 tests/libdbi-basic.sh create mode 100644 tests/testsuites/libdbi-asyn.conf create mode 100644 tests/testsuites/libdbi-basic.conf diff --git a/ChangeLog b/ChangeLog index 784a8787..320134e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Version 5.7.9 [V5-BETA] (rgerhards), 2011-03-?? - improved testbench among others, life tests for ommysql (against a test database) have been added, valgrind-based testing enhanced, ... +- bugfix: minor memory leak in omlibdbi (< 1k per instance and run) - bugfix: (regression) omhdfs did no longer compile - bugfix: omlibdbi did not use password from rsyslog.con closes: http://bugzilla.adiscon.com/show_bug.cgi?id=203 diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index f49bef42..7fcf9631 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -108,6 +108,11 @@ static void closeConn(instanceData *pData) BEGINfreeInstance CODESTARTfreeInstance closeConn(pData); + free(pData->drvrName); + free(pData->host); + free(pData->usrName); + free(pData->pwd); + free(pData->dbName); ENDfreeInstance @@ -171,7 +176,8 @@ static rsRetVal initConn(instanceData *pData, int bSilent) errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi or libdbi drivers not present on this system - suspending."); ABORT_FINALIZE(RS_RET_SUSPENDED); } else if(iDrvrsLoaded < 0) { - errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi could not be initialized - suspending."); + errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi could not be " + "initialized (do you have any dbi drivers installed?) - suspending."); ABORT_FINALIZE(RS_RET_SUSPENDED); } bDbiInitialized = 1; /* we are done for the rest of our existence... */ @@ -367,6 +373,7 @@ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionlibdbipassword", 0, eCmdHdlrGetWord, NULL, &pwd, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionlibdbidbname", 0, eCmdHdlrGetWord, NULL, &dbName, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr( (uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); + DBGPRINTF("omlibdbi compiled with version %s loaded, libdbi version %s\n", VERSION, dbi_version()); ENDmodInit /* vim:set ai: diff --git a/tests/Makefile.am b/tests/Makefile.am index eb7ad94f..ea6860d5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,10 +63,16 @@ TESTS += \ tcp-msgreduc-vg.sh endif + if ENABLE_MYSQL_TESTS TESTS += \ mysql-basic.sh \ mysql-asyn.sh +if ENABLE_OMLIBDBI +TESTS += \ + libdbi-basic.sh \ + libdbi-asyn.sh +endif if HAVE_VALGRIND TESTS += \ mysql-basic-vg.sh \ @@ -74,6 +80,7 @@ TESTS += \ endif endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ @@ -367,6 +374,10 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ resultdata/imuxsock_ccmiddle.log \ testsuites/mysql-truncate.sql \ testsuites/mysql-select-msg.sql \ + libdbi-basic.sh \ + testsuites/libdbi-basic.conf \ + libdbi-asyn.sh \ + testsuites/libdbi-asyn.conf \ mysql-basic.sh \ mysql-basic-vg.sh \ testsuites/mysql-basic.conf \ diff --git a/tests/libdbi-asyn.sh b/tests/libdbi-asyn.sh new file mode 100755 index 00000000..0076da9c --- /dev/null +++ b/tests/libdbi-asyn.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[libdbi-asyn.sh\]: asyn test for libdbi functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup libdbi-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/libdbi-basic-vg.sh b/tests/libdbi-basic-vg.sh new file mode 100755 index 00000000..75d12857 --- /dev/null +++ b/tests/libdbi-basic-vg.sh @@ -0,0 +1,16 @@ +# This file is part of the rsyslog project, released under GPLv3 +# this test is currently not included in the testbench as libdbi +# itself seems to have a memory leak +echo =============================================================================== +echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg libdbi-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/libdbi-basic.sh b/tests/libdbi-basic.sh new file mode 100755 index 00000000..a854a565 --- /dev/null +++ b/tests/libdbi-basic.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup libdbi-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/libdbi-asyn.conf b/tests/testsuites/libdbi-asyn.conf new file mode 100644 index 00000000..39b01fbc --- /dev/null +++ b/tests/testsuites/libdbi-asyn.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/omlibdbi/.libs/omlibdbi + +$ActionQueueType LinkedList + +$ActionLibdbiDriver mysql +$ActionLibdbiHost 127.0.0.1 +$ActionLibdbiUserName root +$ActionLibdbiPassword pass +$ActionLibdbiDBName Syslog +:msg, contains, "msgnum:" :omlibdbi: diff --git a/tests/testsuites/libdbi-basic.conf b/tests/testsuites/libdbi-basic.conf new file mode 100644 index 00000000..212225cc --- /dev/null +++ b/tests/testsuites/libdbi-basic.conf @@ -0,0 +1,9 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/omlibdbi/.libs/omlibdbi +$ActionLibdbiDriver mysql +$ActionLibdbiHost 127.0.0.1 +$ActionLibdbiUserName root +$ActionLibdbiPassword pass +$ActionLibdbiDBName Syslog +:msg, contains, "msgnum:" :omlibdbi: -- cgit v1.2.3 From fd26a42bdc04eaf497cafd9ef806a54f3de1a7e9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 10 Mar 2011 03:08:42 +0100 Subject: systemd: do not hook up SIGHUP for reload rsyslog doesn't actually do a configuration reload on SIGHUP, hence let's not pretend it does and drop the ExecReload= line, so that the clients will rather restart than reload the service. --- rsyslog.service.in | 1 - 1 file changed, 1 deletion(-) diff --git a/rsyslog.service.in b/rsyslog.service.in index 03db596e..898354d5 100644 --- a/rsyslog.service.in +++ b/rsyslog.service.in @@ -4,7 +4,6 @@ Description=System Logging Service [Service] ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service ExecStart=@sbindir@/rsyslogd -n -c5 -ExecReload=/bin/kill -HUP $MAINPID Sockets=syslog.socket [Install] -- cgit v1.2.3