From addadb75ebd22d1175c7e20d1095e35a46b71448 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 25 Jun 2008 12:52:18 +0200 Subject: bugfix: comments after actions were not properly treated. For some actions (e.g. forwarding(, this could also lead to invalid configuration. --- ChangeLog | 2 ++ conf.c | 10 ++++------ omfwd.c | 27 +++++++++------------------ plugins/omgssapi/omgssapi.c | 21 +++++++-------------- 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e515f87..0e962776 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 3.17.5 (rgerhards), 2008-06-?? +- bugfix: comments after actions were not properly treated. For some + actions (e.g. forwarding(, this could also lead to invalid configuration --------------------------------------------------------------------------- Version 3.17.4 (rgerhards), 2008-06-16 - changed default for $KlogSymbolLookup to "off". The directive is diff --git a/conf.c b/conf.c index e11c609f..5a53480f 100644 --- a/conf.c +++ b/conf.c @@ -473,28 +473,26 @@ rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEn { uchar *p; uchar *tplName; - DEFiRet; cstr_t *pStrB; + DEFiRet; ASSERT(pp != NULL); ASSERT(*pp != NULL); ASSERT(pOMSR != NULL); p =*pp; - /* a template must follow - search it and complain, if not found - */ + /* a template must follow - search it and complain, if not found */ skipWhiteSpace(&p); if(*p == ';') ++p; /* eat it */ else if(*p != '\0' && *p != '#') { errmsg.LogError(NO_ERRCODE, "invalid character in selector line - ';template' expected"); - iRet = RS_RET_ERR; - goto finalize_it; + ABORT_FINALIZE(RS_RET_ERR); } skipWhiteSpace(&p); /* go to begin of template name */ - if(*p == '\0') { + if(*p == '\0' || *p == '#') { /* no template specified, use the default */ /* TODO: check NULL ptr */ tplName = (uchar*) strdup((char*)dfltTplName); diff --git a/omfwd.c b/omfwd.c index 67ef4b64..dfa9b98b 100644 --- a/omfwd.c +++ b/omfwd.c @@ -502,7 +502,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) /* extract the host first (we do a trick - we replace the ';' or ':' with a '\0') * now skip to port and then template name. rgerhards 2005-07-06 */ - for(q = p ; *p && *p != ';' && *p != ':' ; ++p) + for(q = p ; *p && *p != ';' && *p != ':' && *p != '#' ; ++p) /* JUST SKIP */; pData->port = NULL; @@ -528,30 +528,22 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) /* now skip to template */ bErr = 0; - while(*p && *p != ';') { - if(*p && *p != ';' && !isspace((int) *p)) { - if(bErr == 0) { /* only 1 error msg! */ - bErr = 1; - errno = 0; - errmsg.LogError(NO_ERRCODE, "invalid selector line (port), probably not doing " - "what was intended"); - } - } - ++p; - } - + while(*p && *p != ';' && *p != '#' && !isspace((int) *p)) + ++p; /*JUST SKIP*/ + /* TODO: make this if go away! */ - if(*p == ';') { + if(*p == ';' || *p == '#' || isspace(*p)) { + uchar cTmp = *p; *p = '\0'; /* trick to obtain hostname (later)! */ CHKmalloc(pData->f_hname = strdup((char*) q)); - *p = ';'; + *p = cTmp; } else { CHKmalloc(pData->f_hname = strdup((char*) q)); } /* process template */ CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, - (pszTplName == NULL) ? (uchar*)"RSYSLOG_TraditionalForwardFormat" : pszTplName)); + (pszTplName == NULL) ? (uchar*)"RSYSLOG_TraditionalForwardFormat" : pszTplName)); /* first set the pData->eDestState */ memset(&hints, 0, sizeof(hints)); @@ -566,8 +558,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) pData->eDestState = eDestFORW; pData->f_addr = res; } - /* - * Otherwise the host might be unknown due to an + /* Otherwise the host might be unknown due to an * inaccessible nameserver (perhaps on the same * host). We try to get the ip number later, like * FORW_SUSP. diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c index 28c3880b..34abfe0a 100644 --- a/plugins/omgssapi/omgssapi.c +++ b/plugins/omgssapi/omgssapi.c @@ -554,7 +554,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) /* extract the host first (we do a trick - we replace the ';' or ':' with a '\0') * now skip to port and then template name. rgerhards 2005-07-06 */ - for(q = p ; *p && *p != ';' && *p != ':' ; ++p) + for(q = p ; *p && *p != ';' && *p != ':' && *p != '#' ; ++p) /* JUST SKIP */; pData->port = NULL; @@ -578,25 +578,18 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) } } + /* now skip to template */ bErr = 0; - while(*p && *p != ';') { - if(*p && *p != ';' && !isspace((int) *p)) { - if(bErr == 0) { /* only 1 error msg! */ - bErr = 1; - errno = 0; - errmsg.LogError(NO_ERRCODE, "invalid selector line (port), probably not doing " - "what was intended"); - } - } - ++p; - } + while(*p && *p != ';' && *p != '#' && !isspace((int) *p)) + ++p; /*JUST SKIP*/ /* TODO: make this if go away! */ - if(*p == ';') { + if(*p == ';' || *p == '#' || isspace(*p)) { + uchar cTmp = *p; *p = '\0'; /* trick to obtain hostname (later)! */ CHKmalloc(pData->f_hname = strdup((char*) q)); - *p = ';'; + *p = cTmp; } else { CHKmalloc(pData->f_hname = strdup((char*) q)); } -- cgit