summaryrefslogtreecommitdiffstats
path: root/omusrmsg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-24 11:33:39 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-24 11:33:39 +0000
commit5cbb54ed6ad1934875b080286b9933400c817e85 (patch)
tree8c45cde2e6fe16df01a63f45b2a8ef82645308ef /omusrmsg.c
parentf1e14aefde8c295a2cbd93b9118d32961b6c373f (diff)
downloadrsyslog-5cbb54ed6ad1934875b080286b9933400c817e85.zip
rsyslog-5cbb54ed6ad1934875b080286b9933400c817e85.tar.gz
rsyslog-5cbb54ed6ad1934875b080286b9933400c817e85.tar.xz
major task: made sure no selector_t is created for selector lines that can
not be successfully loaded. That forced me to change a lot of code, with potential for trouble.
Diffstat (limited to 'omusrmsg.c')
-rw-r--r--omusrmsg.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/omusrmsg.c b/omusrmsg.c
index da545f7..ecfc586 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -233,6 +233,7 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
uchar *p, *q;
int i;
char szTemplateName[128];
+ rsRetVal iRet = RS_RET_CONFLINE_PROCESSED;
assert(pp != NULL);
assert(f != NULL);
@@ -249,19 +250,15 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
if(*(p+1) == ';') {
/* we have a template specifier! */
p += 2; /* eat "*;" */
- cflineParseTemplateName(&p, szTemplateName,
- sizeof(szTemplateName) / sizeof(uchar));
+ if((iRet = cflineParseTemplateName(&p, szTemplateName,
+ sizeof(szTemplateName) / sizeof(uchar))) != RS_RET_OK)
+ return iRet;
}
else /* assign default format if none given! */
szTemplateName[0] = '\0';
if(szTemplateName[0] == '\0')
strcpy(szTemplateName, " WallFmt");
- cflineSetTemplateAndIOV(f, szTemplateName);
- if(f->f_type != F_UNUSED)
- /* safety measure to make sure we have a valid
- * selector line before we continue down below.
- * rgerhards 2005-07-29
- */
+ if((iRet = cflineSetTemplateAndIOV(f, szTemplateName)) == RS_RET_OK)
dprintf(" template '%s'\n", szTemplateName);
} else {
/* everything else is currently treated as a user name
@@ -289,12 +286,13 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
if(*p == ';') {
/* we have a template specifier! */
++p; /* eat ";" */
- cflineParseTemplateName(&p, szTemplateName,
- sizeof(szTemplateName) / sizeof(char));
+ if((iRet = cflineParseTemplateName(&p, szTemplateName,
+ sizeof(szTemplateName) / sizeof(char))) != RS_RET_OK)
+ return iRet;
}
if(szTemplateName[0] == '\0')
strcpy(szTemplateName, " StdUsrMsgFmt");
- cflineSetTemplateAndIOV(f, szTemplateName);
+ iRet = cflineSetTemplateAndIOV(f, szTemplateName);
/* Please note that we would need to check if the template
* was found. If not, f->f_type would be F_UNUSED and we
* can NOT carry on processing. These checks can be seen
@@ -307,8 +305,12 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
*/
}
- *pp = p;
- return RS_RET_CONFLINE_PROCESSED;
+ if(iRet == RS_RET_OK)
+ iRet = RS_RET_CONFLINE_PROCESSED;
+
+ if(iRet == RS_RET_CONFLINE_PROCESSED)
+ *pp = p;
+ return iRet;
}
/* query an entry point