summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--grammar/rainerscript.c11
-rw-r--r--plugins/imptcp/imptcp.c5
-rw-r--r--plugins/imudp/imudp.c5
4 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index d076258e..045a653d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 7.4.2 [v7.4-stable] 2013-06-??
+- bugfix: RainerScript object required parameters were not properly
+ checked - this clould result to segfaults on startup if parameters
+ were missing.
- bugfix: small memory leak when $uptime property was used
- solved build problems on FreeBSD
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=457
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 89cf946c..95972fbe 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -938,8 +938,14 @@ nvlstGetParams(struct nvlst *lst, struct cnfparamblk *params,
for(i = 0 ; i < params->nParams ; ++i) {
param = params->descr + i;
- if((valnode = nvlstFindNameCStr(lst, param->name)) == NULL)
+ if((valnode = nvlstFindNameCStr(lst, param->name)) == NULL) {
+ if(param->flags & CNFPARAM_REQUIRED) {
+ parser_errmsg("parameter '%s' required but not specified - "
+ "fix config", param->name);
+ bInError = 1;
+ }
continue;
+ }
if(vals[i].bUsed) {
parser_errmsg("parameter '%s' specified more than once - "
"one instance is ignored. Fix config", param->name);
@@ -950,7 +956,6 @@ nvlstGetParams(struct nvlst *lst, struct cnfparamblk *params,
}
}
-
if(bInError) {
if(bValsWasNULL)
cnfparamvalsDestruct(vals, params);
@@ -3444,6 +3449,8 @@ void
cnfparamvalsDestruct(struct cnfparamvals *paramvals, struct cnfparamblk *blk)
{
int i;
+ if(paramvals == NULL)
+ return;
for(i = 0 ; i < blk->nParams ; ++i) {
if(paramvals[i].bUsed) {
varDelete(&paramvals[i].val);
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index 5c8bb67a..906521dd 100644
--- a/plugins/imptcp/imptcp.c
+++ b/plugins/imptcp/imptcp.c
@@ -1419,10 +1419,7 @@ BEGINnewInpInst
CODESTARTnewInpInst
DBGPRINTF("newInpInst (imptcp)\n");
- pvals = nvlstGetParams(lst, &inppblk, NULL);
- if(pvals == NULL) {
- errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS,
- "imptcp: required parameter are missing\n");
+ if((pvals = nvlstGetParams(lst, &inppblk, NULL)) == NULL) {
ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
}
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 7bf1473a..1bdd0868 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -746,10 +746,7 @@ BEGINnewInpInst
CODESTARTnewInpInst
DBGPRINTF("newInpInst (imudp)\n");
- pvals = nvlstGetParams(lst, &inppblk, NULL);
- if(pvals == NULL) {
- errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS,
- "imudp: required parameter are missing\n");
+ if((pvals = nvlstGetParams(lst, &inppblk, NULL)) == NULL) {
ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
}
if(Debug) {