summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-07 16:34:51 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-07 16:34:51 +0000
commitd471e71adabdad4fba8b59c4017a1c5f1f111073 (patch)
tree078d95dfd438e1b3d6a72a1ede5d422c89b9a0a7
parent549c0cccd44dc36a6ba8c480fa65bcaad6cb20ec (diff)
downloadrsyslog-d471e71adabdad4fba8b59c4017a1c5f1f111073.tar.gz
rsyslog-d471e71adabdad4fba8b59c4017a1c5f1f111073.tar.xz
rsyslog-d471e71adabdad4fba8b59c4017a1c5f1f111073.zip
fixed potential infinite loop condition when module load failed on startup
-rw-r--r--Makefile.am10
-rw-r--r--doc/rsyslog_conf.html8
-rw-r--r--msg.c2
-rw-r--r--obj.c9
-rwxr-xr-xstringbuf.c2
-rw-r--r--template.c2
6 files changed, 19 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index 1fc48c18..c924f7bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -123,11 +123,11 @@ endif
# regular expression support
#
if ENABLE_REGEXP
-pkglib_LTLIBRARIES += regexp.la
-regexp_la_SOURCES = regexp.c regexp.h
-regexp_la_CPPFLAGS = $(pthreads_cflags)
-regexp_la_LDFLAGS = -module -avoid-version
-regexp_la_LIBADD =
+pkglib_LTLIBRARIES += lmregexp.la
+lmregexp_la_SOURCES = regexp.c regexp.h
+lmregexp_la_CPPFLAGS = $(pthreads_cflags)
+lmregexp_la_LDFLAGS = -module -avoid-version
+lmregexp_la_LIBADD =
endif
#
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index 11f80a2d..03b15c17 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -505,7 +505,7 @@ once they are implemented, it can make very much sense
</tr>
<tr>
<td>regex</td>
-<td>Compares the property against the provided regular
+<td>Compares the property against the provided POSIX regular
expression.</td>
</tr>
</tbody>
@@ -547,7 +547,11 @@ code), this can be done easily by:</p>
<p>This filter will match when the message contains the string
"ID-4711". Please note that the comparison is case-sensitive, so it
would not match if "id-4711" would be contained in the message.</p>
-<p>Getting property-based filters right can sometimes be
+<p><code><b>:msg, regex, "fatal .* error"</b></code></p>
+<p>This filter uses a POSIX regular expression. It matches when the
+string contains the words "fatal" and "error" with anything in between
+(e.g. "fatal net error" and "fatal lib error" but not "fatal error" as
+two spaces are required by the regular expression!).</p><p>Getting property-based filters right can sometimes be
challenging. In order to help you do it with as minimal effort as
possible, rsyslogd spits out debug information for all property-based
filters during their evaluation. To enable this, run rsyslogd in
diff --git a/msg.c b/msg.c
index 1076feae..d40087ad 100644
--- a/msg.c
+++ b/msg.c
@@ -1771,7 +1771,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
dbgprintf("debug: String to match for regex is: %s\n", pRes);
- if(objUse(regexp, "regexp") == RS_RET_OK) {
+ if(objUse(regexp, "lmregexp") == RS_RET_OK) {
if (0 != regexp.regexec(&pTpe->data.field.re, pRes, nmatch,
pmatch, 0)) {
/* we got no match! */
diff --git a/obj.c b/obj.c
index 5a144727..910afe89 100644
--- a/obj.c
+++ b/obj.c
@@ -1058,8 +1058,6 @@ UseObj(char *srcFile, uchar *pObjName, uchar *pObjFile, interface_t *pIf)
cstr_t *pStr = NULL;
objInfo_t *pObjInfo;
- CHKiRet(rsCStrConstructFromszStr(&pStr, pObjName));
- iRet = FindObjInfo(pStr, &pObjInfo);
dbgprintf("source file %s requests object '%s', ifIsLoaded %d\n", srcFile, pObjName, pIf->ifIsLoaded);
@@ -1077,13 +1075,15 @@ UseObj(char *srcFile, uchar *pObjName, uchar *pObjFile, interface_t *pIf)
* looks like a good solution. -- rgerhards, 2008-03-07
*/
pIf->ifIsLoaded = 2;
+
+ CHKiRet(rsCStrConstructFromszStr(&pStr, pObjName));
+ iRet = FindObjInfo(pStr, &pObjInfo);
if(iRet == RS_RET_NOT_FOUND) {
/* in this case, we need to see if we can dynamically load the object */
if(pObjFile == NULL) {
FINALIZE; /* no chance, we have lost... */
} else {
CHKiRet(module.Load(pObjFile));
- pIf->ifIsLoaded = 1; /* all went well! */
/* NOW, we must find it or we have a problem... */
CHKiRet(FindObjInfo(pStr, &pObjInfo));
}
@@ -1091,7 +1091,8 @@ UseObj(char *srcFile, uchar *pObjName, uchar *pObjFile, interface_t *pIf)
FINALIZE; /* give up */
}
- pObjInfo->QueryIF(pIf);
+ CHKiRet(pObjInfo->QueryIF(pIf));
+ pIf->ifIsLoaded = 1; /* we are happy */
finalize_it:
if(pStr != NULL)
diff --git a/stringbuf.c b/stringbuf.c
index d5b77d99..8745c291 100755
--- a/stringbuf.c
+++ b/stringbuf.c
@@ -709,7 +709,7 @@ int rsCStrSzStrMatchRegex(cstr_t *pCS1, uchar *psz)
BEGINfunc
- if(objUse(regexp, "regexp") == RS_RET_OK) {
+ if(objUse(regexp, "lmregexp") == RS_RET_OK) {
regexp.regcomp(&preq, (char*) rsCStrGetSzStr(pCS1), 0);
ret = regexp.regexec(&preq, (char*) psz, 0, NULL, 0);
regexp.regfree(&preq);
diff --git a/template.c b/template.c
index 5d13fd08..67be4140 100644
--- a/template.c
+++ b/template.c
@@ -627,7 +627,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* Now i compile the regex */
/* Remember that the re is an attribute of the Template entry */
- if((iRetLocal = objUse(regexp, "regexp")) == RS_RET_OK) {
+ if((iRetLocal = objUse(regexp, "lmregexp")) == RS_RET_OK) {
if(regexp.regcomp(&(pTpe->data.field.re), (char*) regex_char, 0) != 0) {
dbgprintf("error: can not compile regex: '%s'\n", regex_char);
pTpe->data.field.has_regex = 2;