diff options
-rw-r--r-- | cfsysline.c | 7 | ||||
-rw-r--r-- | omfile.c | 20 | ||||
-rw-r--r-- | syslogd.c | 42 |
3 files changed, 46 insertions, 23 deletions
diff --git a/cfsysline.c b/cfsysline.c index 5b6c7b13..2c20b2bc 100644 --- a/cfsysline.c +++ b/cfsysline.c @@ -548,8 +548,14 @@ rsRetVal regCfSysLineHdlr(uchar *pCmdName, ecslCmdHdrlType eType, rsRetVal (*pHd } } else { /* command already exists, are we allowed to chain? */ +#if 0 iRet = RS_RET_NOT_IMPLEMENTED; // TODO: implement it! goto finalize_it; +#endif + CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData)) { + cslcDestruct(pThis); + goto finalize_it; + } } finalize_it: @@ -621,6 +627,7 @@ void dbgPrintCfSysLineHandlers(void) printf("\t\ttype : %d\n", pCmdHdlr->eType); printf("\t\tpData: 0x%x\n", (unsigned) pCmdHdlr->pData); printf("\t\tHdlr : 0x%x\n", (unsigned) pCmdHdlr->cslCmdHdlr); + printf("\n"); } } printf("\n"); @@ -738,6 +738,25 @@ CODESTARTparseSelectorAct ENDparseSelectorAct +/* Reset config variables for this module to default values. + * rgerhards, 2007-07-17 + */ +static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) +{ + fileUID = -1; + fileGID = -1; + dirUID = -1; + dirGID = -1; + bFailOnChown = 1; + iDynaFileCacheSize = 10; + fCreateMode = 0644; + fDirCreateMode = 0644; + bCreateDirs = 1; + + return RS_RET_OK; +} + + BEGINqueryEtryPt CODESTARTqueryEtryPt CODEqueryEtryPt_STD_OMOD_QUERIES @@ -757,6 +776,7 @@ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr((uchar *)"filecreatemode", eCmdHdlrFileCreateMode, NULL, &fCreateMode)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"createdirs", eCmdHdlrBinary, NULL, &bCreateDirs)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"failonchownfailure", eCmdHdlrBinary, NULL, &bFailOnChown)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", eCmdHdlrCustomHandler, resetConfigVariables, NULL)); ENDmodInit /* @@ -600,7 +600,7 @@ static char* getFIOPName(unsigned iFIOP) /* Reset config variables to default values. * rgerhards, 2007-07-17 */ -static void resetConfigVariables(void) +static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) { fileUID = -1; fileGID = -1; @@ -610,12 +610,15 @@ static void resetConfigVariables(void) iDynaFileCacheSize = 10; fCreateMode = 0644; fDirCreateMode = 0644; - cCCEscapeChar = '#'; bCreateDirs = 1; + cCCEscapeChar = '#'; bDebugPrintTemplateList = 1; + bDebugPrintCfSysLineHandlerList = 1; + bDebugPrintModuleList = 1; bEscapeCCOnRcv = 1; /* default is to escape control characters */ bReduceRepeatMsgs = (logEveryMsg == 1) ? 0 : 1; + return RS_RET_OK; } @@ -3561,26 +3564,16 @@ rsRetVal cfsysline(uchar *p) ABORT_FINALIZE(RS_RET_NOT_FOUND); } - /* check the command and carry out processing */ - if(!strcasecmp((char*) szCmd, "resetconfigvariables")) { - /* TODO: the compiler warning for the line below is OK for the time being. In the - * longer term, we should create a special parsing function which - * will also check if there are any spurios characters. - * rgerhards, 2007-07-31 - */ - CHKiRet(doCustomHdlr(&p , resetConfigVariables, NULL)); - } else { - /* we now try and see if we can find the command in the registered - * list of cfsysline handlers. -- rgerhards, 2007-07-31 - */ - if((iRet = processCfSysLineCommand(szCmd, &p)) != RS_RET_OK) { - /* invalid command! */ - char err[256]; - snprintf(err, sizeof(err)/sizeof(char), - "Invalid command in $-configline: '%s' (error %d) - line ignored\n", szCmd, iRet); - logerror(err); - ABORT_FINALIZE(RS_RET_INVALID_CMD); - } + /* we now try and see if we can find the command in the registered + * list of cfsysline handlers. -- rgerhards, 2007-07-31 + */ + if((iRet = processCfSysLineCommand(szCmd, &p)) != RS_RET_OK) { + /* invalid command! */ + char err[256]; + snprintf(err, sizeof(err)/sizeof(char), + "Invalid command in $-configline: '%s' (error %d) - line ignored\n", szCmd, iRet); + logerror(err); + ABORT_FINALIZE(RS_RET_INVALID_CMD); } /* now check if we have some extra characters left on the line - that @@ -3915,7 +3908,9 @@ static void init() tplDeleteNew(); /* re-setting values to defaults (where applicable) */ - resetConfigVariables(); +dprintf("check TODO in init()\n"); +// TODO: problem: the modules are not yet loaded here + cfsysline("ResetConfigVariables"); /* open the configuration file */ if((iRet = processConfFile(ConfFile)) != RS_RET_OK) { @@ -5271,6 +5266,7 @@ static rsRetVal loadBuildInModules(void) CHKiRet(regCfSysLineHdlr((uchar *)"debugprintmodulelist", eCmdHdlrBinary, NULL, &bDebugPrintModuleList)); CHKiRet(regCfSysLineHdlr((uchar *)"debugprintcfsyslinehandlerlist", eCmdHdlrBinary, NULL, &bDebugPrintCfSysLineHandlerList)); + CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", eCmdHdlrCustomHandler, resetConfigVariables, NULL)); finalize_it: return iRet; |