summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--outchannel.c19
-rw-r--r--runtime/rsconf.c4
-rw-r--r--runtime/rsconf.h6
-rw-r--r--runtime/typedefs.h1
-rw-r--r--tools/syslogd.c61
5 files changed, 39 insertions, 52 deletions
diff --git a/outchannel.c b/outchannel.c
index b9b4a6b1..9a3733d8 100644
--- a/outchannel.c
+++ b/outchannel.c
@@ -37,12 +37,9 @@
#include <assert.h>
#include "stringbuf.h"
#include "outchannel.h"
-#include "dirty.h"
+#include "rsconf.h"
#include "debug.h"
-static struct outchannel *ochRoot = NULL; /* the root of the outchannel list */
-static struct outchannel *ochLast = NULL; /* points to the last element of the outchannel list */
-
/* Constructs a outchannel list object. Returns pointer to it
* or NULL (if it fails).
*/
@@ -55,14 +52,14 @@ struct outchannel* ochConstruct(void)
/* basic initialisaion is done via calloc() - need to
* initialize only values != 0. */
- if(ochLast == NULL)
+ if(loadConf->och.ochLast == NULL)
{ /* we are the first element! */
- ochRoot = ochLast = pOch;
+ loadConf->och.ochRoot = loadConf->och.ochLast = pOch;
}
else
{
- ochLast->pNext = pOch;
- ochLast = pOch;
+ loadConf->och.ochLast->pNext = pOch;
+ loadConf->och.ochLast = pOch;
}
return(pOch);
@@ -251,7 +248,7 @@ struct outchannel *ochFind(char *pName, int iLenName)
assert(pName != NULL);
- pOch = ochRoot;
+ pOch = loadConf->och.ochRoot;
while(pOch != NULL &&
!(pOch->iLenName == iLenName &&
!strcmp(pOch->pszName, pName)
@@ -270,7 +267,7 @@ void ochDeleteAll(void)
{
struct outchannel *pOch, *pOchDel;
- pOch = ochRoot;
+ pOch = loadConf->och.ochRoot;
while(pOch != NULL) {
dbgprintf("Delete Outchannel: Name='%s'\n ", pOch->pszName == NULL? "NULL" : pOch->pszName);
pOchDel = pOch;
@@ -289,7 +286,7 @@ void ochPrintList(void)
{
struct outchannel *pOch;
- pOch = ochRoot;
+ pOch = loadConf->och.ochRoot;
while(pOch != NULL) {
dbgprintf("Outchannel: Name='%s'\n", pOch->pszName == NULL? "NULL" : pOch->pszName);
dbgprintf("\tFile Template: '%s'\n", pOch->pszFileTemplate == NULL ? "NULL" : (char*) pOch->pszFileTemplate);
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index eecdbb01..47a6f00b 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -59,6 +59,7 @@
#include "smfwd.h"
#include "smtradfwd.h"
#include "parser.h"
+#include "outchannel.h"
/* static data */
DEFobjStaticHelpers
@@ -162,6 +163,8 @@ BEGINobjDebugPrint(rsconf) /* be sure to specify the object type also in END and
pThis->globals.bLogStatusMsgs);
dbgprintf(" bErrMsgToStderr.....................: %d\n",
pThis->globals.bErrMsgToStderr);
+ dbgprintf(" drop Msgs with malicious PTR Record : %d\n",
+ glbl.GetDropMalPTRMsgs());
ruleset.DebugPrintAll(pThis);
DBGPRINTF("\n");
if(pThis->globals.bDebugPrintTemplateList)
@@ -190,6 +193,7 @@ BEGINobjDebugPrint(rsconf) /* be sure to specify the object type also in END and
setQPROP(qqueueSetbSaveOnShutdown, "$MainMsgQueueSaveOnShutdown", 1);
*/
DBGPRINTF("Work Directory: '%s'.\n", glbl.GetWorkDir());
+ ochPrintList();
CODESTARTobjDebugPrint(rsconf)
ENDobjDebugPrint(rsconf)
diff --git a/runtime/rsconf.h b/runtime/rsconf.h
index 5229b9f7..5cd6bfd0 100644
--- a/runtime/rsconf.h
+++ b/runtime/rsconf.h
@@ -91,6 +91,11 @@ struct globals_s {
struct defaults_s {
};
+/* outchannel-specific data */
+struct outchannels_s {
+ struct outchannel *ochRoot; /* the root of the outchannel list */
+ struct outchannel *ochLast; /* points to the last element of the outchannel list */
+};
struct templates_s {
struct template *root; /* the root of the template list */
@@ -121,6 +126,7 @@ struct rsconf_s {
globals_t globals;
defaults_t defaults;
templates_t templates;
+ outchannels_t och;
actions_t actions;
rulesets_t rulesets;
/* note: rulesets include the complete output part:
diff --git a/runtime/typedefs.h b/runtime/typedefs.h
index b7df0464..0d23e880 100644
--- a/runtime/typedefs.h
+++ b/runtime/typedefs.h
@@ -87,6 +87,7 @@ typedef struct globals_s globals_t;
typedef struct defaults_s defaults_t;
typedef struct actions_s actions_t;
typedef struct rsconf_s rsconf_t;
+typedef struct outchannels_s outchannels_t;
typedef rsRetVal (*prsf_t)(struct vmstk_s*, int); /* pointer to a RainerScript function */
typedef uint64 qDeqID; /* queue Dequeue order ID. 32 bits is considered dangerously few */
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 63eb55b9..318031a1 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1280,23 +1280,6 @@ finalize_it:
}
-/* print debug information as part of init(). This pretty much
- * outputs the whole config of rsyslogd. I've moved this code
- * out of init() to clean it somewhat up.
- * rgerhards, 2007-07-31
- */
-static void dbgPrintInitInfo(void)
-{
- dbgprintf("The following is the old-style, to-be-replaced, current config dump at the end "
- " of the config load process ;)\n");
- ochPrintList();
-
- DBGPRINTF("Messages with malicious PTR DNS Records are %sdropped.\n",
- glbl.GetDropMalPTRMsgs() ? "" : "not ");
-
-}
-
-
/* Actually run the input modules. This happens after privileges are dropped,
* if that is requested.
*/
@@ -1441,31 +1424,31 @@ init(void)
* If not, terminate. -- rgerhards, 2008-07-25
*/
if(iConfigVerify) {
- if(bHadConfigErr) {
- /* a bit dirty, but useful... */
- exit(1);
- }
- ABORT_FINALIZE(RS_RET_VALIDATION_RUN);
+ if(bHadConfigErr) {
+ /* a bit dirty, but useful... */
+ exit(1);
}
+ ABORT_FINALIZE(RS_RET_VALIDATION_RUN);
+}
#warning restructure following if to use return value of loadConf
- if(loadConf->globals.bAbortOnUncleanConfig && bHadConfigErr) {
- fprintf(stderr, "rsyslogd: $AbortOnUncleanConfig is set, and config is not clean.\n"
- "Check error log for details, fix errors and restart. As a last\n"
- "resort, you may want to remove $AbortOnUncleanConfig to permit a\n"
- "startup with a dirty config.\n");
- exit(2);
- }
+if(loadConf->globals.bAbortOnUncleanConfig && bHadConfigErr) {
+ fprintf(stderr, "rsyslogd: $AbortOnUncleanConfig is set, and config is not clean.\n"
+ "Check error log for details, fix errors and restart. As a last\n"
+ "resort, you may want to remove $AbortOnUncleanConfig to permit a\n"
+ "startup with a dirty config.\n");
+ exit(2);
+}
- /* create message queue */
- CHKiRet_Hdlr(createMainQueue(&pMsgQueue, UCHAR_CONSTANT("main Q"))) {
- /* no queue is fatal, we need to give up in that case... */
- fprintf(stderr, "fatal error %d: could not create message queue - rsyslogd can not run!\n", iRet);
- exit(1);
- }
+/* create message queue */
+CHKiRet_Hdlr(createMainQueue(&pMsgQueue, UCHAR_CONSTANT("main Q"))) {
+ /* no queue is fatal, we need to give up in that case... */
+ fprintf(stderr, "fatal error %d: could not create message queue - rsyslogd can not run!\n", iRet);
+ exit(1);
+}
- bHaveMainQueue = (ourConf->globals.mainQ.MainMsgQueType == QUEUETYPE_DIRECT) ? 0 : 1;
- DBGPRINTF("Main processing queue is initialized and running\n");
+bHaveMainQueue = (ourConf->globals.mainQ.MainMsgQueType == QUEUETYPE_DIRECT) ? 0 : 1;
+DBGPRINTF("Main processing queue is initialized and running\n");
/* the output part and the queue is now ready to run. So it is a good time
* to initialize the inputs. Please note that the net code above should be
@@ -1477,10 +1460,6 @@ init(void)
*/
startInputModules();
- if(Debug) {
- dbgPrintInitInfo();
- }
-
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);
sigAct.sa_handler = sighup_handler;