summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-31 16:29:39 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-31 16:29:39 +0000
commit86afe5b17c5a097373b90d63502e1a983ed4d6bf (patch)
treeac351e78ed494c491e2c9443450745fc07b49fe9
parent9234c95d74fb015e839cf5fe5ebbdf138e4a760d (diff)
downloadrsyslog-86afe5b17c5a097373b90d63502e1a983ed4d6bf.tar.gz
rsyslog-86afe5b17c5a097373b90d63502e1a983ed4d6bf.tar.xz
rsyslog-86afe5b17c5a097373b90d63502e1a983ed4d6bf.zip
- all cfsysline directives now use new table-driven cfsysline system except
for $ResetConfigVariables
-rw-r--r--ChangeLog2
-rw-r--r--cfsysline.c2
-rw-r--r--cfsysline.h2
-rw-r--r--syslogd.c83
4 files changed, 37 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index cc44a2df..0dcf7e3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,8 @@ Version 1.17.6 (rgerhards), 2007-07-3?
an invalid assertion (in some cases)
- fixed a typo that caused the default template for MySQL to be wrong.
thanks to mildew for catching this.
+- added configuration file command $DebugPrintModuleList and
+ $DebugPrintCfSysLineHandlerList
---------------------------------------------------------------------------
Version 1.17.5 (rgerhards), 2007-07-30
- continued to work on output module modularization
diff --git a/cfsysline.c b/cfsysline.c
index 54fc20df..5b6c7b13 100644
--- a/cfsysline.c
+++ b/cfsysline.c
@@ -423,7 +423,7 @@ rsRetVal cslchCallHdlr(cslCmdHdlr_t *pThis, uchar **ppConfLine)
case eCmdHdlrInt:
pHdlr = doGetInt;
break;
- case eCmdHdlrFileGetChar:
+ case eCmdHdlrGetChar:
pHdlr = doGetChar;
break;
default:
diff --git a/cfsysline.h b/cfsysline.h
index 76ff310a..42edc0ec 100644
--- a/cfsysline.h
+++ b/cfsysline.h
@@ -34,7 +34,7 @@ typedef enum cslCmdHdlrType {
eCmdHdlrBinary,
eCmdHdlrFileCreateMode,
eCmdHdlrInt,
- eCmdHdlrFileGetChar
+ eCmdHdlrGetChar
} ecslCmdHdrlType;
/* this is a single entry for a parse routine. It describes exactly
diff --git a/syslogd.c b/syslogd.c
index 173015d4..59f6de12 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -527,7 +527,9 @@ uid_t fileGID; /* GID to be used for newly created files */
uid_t dirUID; /* UID to be used for newly created directories */
uid_t dirGID; /* GID to be used for newly created directories */
int bCreateDirs; /* auto-create directories for dynaFiles: 0 - no, 1 - yes */
-static int bDebugPrintTemplateList;/* output template list in debug mode? */
+static int bDebugPrintTemplateList = 1;/* output template list in debug mode? */
+static int bDebugPrintCfSysLineHandlerList = 1;/* output cfsyslinehandler list in debug mode? */
+static int bDebugPrintModuleList = 1;/* output module list in debug mode? */
int bDropMalPTRMsgs = 0;/* Drop messages which have malicious PTR records during DNS lookup */
static uchar cCCEscapeChar = '\\';/* character to be used to start an escape sequence for control chars */
static int bEscapeCCOnRcv; /* escape control characters on reception: 0 - no, 1 - yes */
@@ -3560,57 +3562,13 @@ rsRetVal cfsysline(uchar *p)
}
/* check the command and carry out processing */
- if(!strcasecmp((char*) szCmd, "template")) {
- CHKiRet(doCustomHdlr(&p, doNameLine, (void*) DIR_TEMPLATE));
- } else if(!strcasecmp((char*) szCmd, "outchannel")) {
- CHKiRet(doCustomHdlr(&p, doNameLine, (void*) DIR_OUTCHANNEL));
- } else if(!strcasecmp((char*) szCmd, "allowedsender")) {
- CHKiRet(doCustomHdlr(&p, doNameLine, (void*) DIR_ALLOWEDSENDER));
- } else if(!strcasecmp((char*) szCmd, "umask")) {
- CHKiRet(doFileCreateMode(&p, (void*) setUmask, NULL));
-#if 0
- } else if(!strcasecmp((char*) szCmd, "dircreatemode")) {
- CHKiRet(doFileCreateMode(&p, NULL, &fDirCreateMode));
- } else if(!strcasecmp((char*) szCmd, "filecreatemode")) {
- CHKiRet(doFileCreateMode(&p, NULL, &fCreateMode));
- } else if(!strcasecmp((char*) szCmd, "dirowner")) {
- CHKiRet(doGetUID(&p, NULL, &dirUID));
- } else if(!strcasecmp((char*) szCmd, "dirgroup")) {
- CHKiRet(doGetGID(&p, NULL, &dirGID));
- } else if(!strcasecmp((char*) szCmd, "fileowner")) {
- CHKiRet(doGetUID(&p, NULL, &fileUID));
- } else if(!strcasecmp((char*) szCmd, "filegroup")) {
- CHKiRet(doGetGID(&p, NULL, &fileGID));
- } else if(!strcasecmp((char*) szCmd, "dynafilecachesize")) {
- CHKiRet(doGetInt(&p, (void*) setDynaFileCacheSize, NULL));
-#endif
- } else if(!strcasecmp((char*) szCmd, "repeatedmsgreduction")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bReduceRepeatMsgs));
- } else if(!strcasecmp((char*) szCmd, "controlcharacterescapeprefix")) {
- CHKiRet(doGetChar(&p, NULL, &cCCEscapeChar));
- } else if(!strcasecmp((char*) szCmd, "escapecontrolcharactersonreceive")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bEscapeCCOnRcv));
- } else if(!strcasecmp((char*) szCmd, "dropmsgswithmaliciousdnsptrrecords")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bDropMalPTRMsgs));
-#if 0
- } else if(!strcasecmp((char*) szCmd, "createdirs")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bCreateDirs));
- } else if(!strcasecmp((char*) szCmd, "failonchownfailure")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bFailOnChown));
-#endif
- } else if(!strcasecmp((char*) szCmd, "debugprinttemplatelist")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bDebugPrintTemplateList));
- } else if(!strcasecmp((char*) szCmd, "droptrailinglfonreception")) {
- CHKiRet(doBinaryOptionLine(&p, NULL, &bDropTrailingLF));
- } else if(!strcasecmp((char*) szCmd, "resetconfigvariables")) {
+ 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 if(!strcasecmp((char*) szCmd, "modload")) {
- CHKiRet(doCustomHdlr(&p, doModLoad, NULL));
} else {
/* we now try and see if we can find the command in the registered
* list of cfsysline handlers. -- rgerhards, 2007-07-31
@@ -3747,10 +3705,12 @@ static void dbgPrintInitInfo(void)
printf("\n");
if(bDebugPrintTemplateList)
tplPrintList();
- modPrintList();
+ if(bDebugPrintModuleList)
+ modPrintList();
ochPrintList();
- dbgPrintCfSysLineHandlers();
+ if(bDebugPrintCfSysLineHandlerList)
+ dbgPrintCfSysLineHandlers();
#ifdef SYSLOG_INET
/* now the allowedSender lists: */
@@ -5263,7 +5223,7 @@ static void checkPermissions()
*/
static rsRetVal loadBuildInModules(void)
{
- rsRetVal iRet;
+ DEFiRet;
if((iRet = doModInit(modInitFile, (uchar*) "builtin-file")) != RS_RET_OK)
return iRet;
@@ -5290,7 +5250,30 @@ static rsRetVal loadBuildInModules(void)
if((iRet = doModInit(modInitUsrMsg, (uchar*) "builtin-usrmsg")) != RS_RET_OK)
return iRet;
- return RS_RET_OK;
+ /* ok, initialization of the command handler probably does not 100% belong right in
+ * this space here. However, with the current design, this is actually quite a good
+ * place to put it. We might decide to shuffle it around later, but for the time
+ * being, the code has found its home here. A not-just-sideeffect of this decision
+ * is that rsyslog will terminate if we can not register our built-in config commands.
+ * This, I think, is the right thing to do. -- rgerhards, 2007-07-31
+ */
+ CHKiRet(regCfSysLineHdlr((uchar *)"repeatedmsgreduction", eCmdHdlrBinary, NULL, &bReduceRepeatMsgs));
+ CHKiRet(regCfSysLineHdlr((uchar *)"controlcharacterescapeprefix", eCmdHdlrGetChar, NULL, &cCCEscapeChar));
+ CHKiRet(regCfSysLineHdlr((uchar *)"escapecontrolcharactersonreceive", eCmdHdlrBinary, NULL, &bEscapeCCOnRcv));
+ CHKiRet(regCfSysLineHdlr((uchar *)"dropmsgswithmaliciousdnsptrrecords", eCmdHdlrBinary, NULL, &bDropMalPTRMsgs));
+ CHKiRet(regCfSysLineHdlr((uchar *)"droptrailinglfonreception", eCmdHdlrBinary, NULL, &bDropTrailingLF));
+ CHKiRet(regCfSysLineHdlr((uchar *)"template", eCmdHdlrCustomHandler, doNameLine, (void*)DIR_TEMPLATE));
+ CHKiRet(regCfSysLineHdlr((uchar *)"outchannel", eCmdHdlrCustomHandler, doNameLine, (void*)DIR_OUTCHANNEL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"allowedsender", eCmdHdlrCustomHandler, doNameLine, (void*)DIR_ALLOWEDSENDER));
+ CHKiRet(regCfSysLineHdlr((uchar *)"modload", eCmdHdlrCustomHandler, doModLoad, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"umask", eCmdHdlrFileCreateMode, setUmask, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"debugprinttemplatelist", eCmdHdlrBinary, NULL, &bDebugPrintTemplateList));
+ CHKiRet(regCfSysLineHdlr((uchar *)"debugprintmodulelist", eCmdHdlrBinary, NULL, &bDebugPrintModuleList));
+ CHKiRet(regCfSysLineHdlr((uchar *)"debugprintcfsyslinehandlerlist", eCmdHdlrBinary,
+ NULL, &bDebugPrintCfSysLineHandlerList));
+
+finalize_it:
+ return iRet;
}