summaryrefslogtreecommitdiffstats
path: root/ommysql.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 /ommysql.c
parentf1e14aefde8c295a2cbd93b9118d32961b6c373f (diff)
downloadrsyslog-5cbb54ed6ad1934875b080286b9933400c817e85.tar.gz
rsyslog-5cbb54ed6ad1934875b080286b9933400c817e85.tar.xz
rsyslog-5cbb54ed6ad1934875b080286b9933400c817e85.zip
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 'ommysql.c')
-rw-r--r--ommysql.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/ommysql.c b/ommysql.c
index d5613ce8..4d87d950 100644
--- a/ommysql.c
+++ b/ommysql.c
@@ -339,29 +339,23 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
szTemplateName[0] = '\0';
} else {
/* we have a template specifier! */
- cflineParseTemplateName(&p, szTemplateName,
- sizeof(szTemplateName) / sizeof(char));
+ if((iRet = cflineParseTemplateName(&p, szTemplateName,
+ sizeof(szTemplateName) / sizeof(char))) != RS_RET_OK)
+ break;
}
if(szTemplateName[0] == '\0')
strcpy(szTemplateName, " StdDBFmt");
- cflineSetTemplateAndIOV(f, szTemplateName);
-
- /* we now check if the template was present. If not, we
- * can abort this run as the selector line has been
- * disabled. If we don't abort, we'll core dump
- * below. rgerhards 2005-07-29
- */
- if(f->f_type == F_UNUSED)
+ if((iRet = cflineSetTemplateAndIOV(f, szTemplateName)) != RS_RET_OK)
break;
-
+
dprintf(" template '%s'\n", szTemplateName);
/* If db used, the template have to use the SQL option.
This is for your own protection (prevent sql injection). */
if (f->f_pTpl->optFormatForSQL == 0) {
- f->f_type = F_UNUSED;
+ iRet = RS_RET_NO_SQL_STRING;
logerror("DB logging disabled. You have to use"
" the SQL or stdSQL option in your template!\n");
break;
@@ -372,9 +366,10 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
* Retries make no sense.
*/
if (iMySQLPropErr) {
- f->f_type = F_UNUSED;
+ iRet = RS_RET_ERR; /* re-vist error code when working on this module */
dprintf("Trouble with MySQL conncetion properties.\n"
"MySQL logging disabled.\n");
+ break;
} else {
initMySQL(f);
}
@@ -385,6 +380,9 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f)
break;
}
+ if(iRet == RS_RET_OK)
+ iRet = RS_RET_CONFLINE_PROCESSED;
+
if(iRet == RS_RET_CONFLINE_PROCESSED)
*pp = p;
return iRet;