summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/conf.c7
-rw-r--r--runtime/conf.h1
-rw-r--r--runtime/rsconf.c67
3 files changed, 59 insertions, 16 deletions
diff --git a/runtime/conf.c b/runtime/conf.c
index 8c7bc7b6..425d6259 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -75,7 +75,7 @@
#endif
/* forward definitions */
-static rsRetVal cfline(rsconf_t *conf, uchar *line, rule_t **pfCurr);
+//static rsRetVal cfline(rsconf_t *conf, uchar *line, rule_t **pfCurr);
/* static data */
@@ -715,6 +715,7 @@ finalize_it:
}
+#if 0
/* read the filter part of a configuration line and store the filter
* in the supplied rule_t
* rgerhards, 2007-08-01
@@ -751,6 +752,7 @@ static rsRetVal cflineDoFilter(uchar **pp, rule_t *f)
finalize_it:
RETiRet;
}
+#endif
/* process the action part of a selector line
@@ -817,6 +819,7 @@ rsRetVal cflineDoAction(rsconf_t *conf, uchar **p, action_t **ppAction)
}
+#if 0
/* Process a configuration file line in traditional "filter selector" format
* or one that builds upon this format. Note that ppRule may be a NULL pointer,
* which is valid and happens if there is no previous line (right at the start
@@ -894,6 +897,7 @@ cfline(rsconf_t *conf, uchar *line, rule_t **pfCurr)
RETiRet;
}
+#endif
/* return the current number of active actions
@@ -926,7 +930,6 @@ CODESTARTobjQueryInterface(conf)
pIf->doNameLine = doNameLine;
pIf->cfsysline = cfsysline;
pIf->doModLoad = doModLoad;
- pIf->cfline = cfline;
pIf->GetNbrActActions = GetNbrActActions;
finalize_it:
diff --git a/runtime/conf.h b/runtime/conf.h
index a74b99c5..9253e880 100644
--- a/runtime/conf.h
+++ b/runtime/conf.h
@@ -37,7 +37,6 @@ BEGINinterface(conf) /* name must also be changed in ENDinterface macro! */
rsRetVal (*doNameLine)(uchar **pp, void* pVal);
rsRetVal (*cfsysline)(uchar *p);
rsRetVal (*doModLoad)(uchar **pp, __attribute__((unused)) void* pVal);
- rsRetVal (*cfline)(rsconf_t *conf, uchar *line, rule_t **pfCurr);
rsRetVal (*GetNbrActActions)(rsconf_t *conf, int *);
/* version 4 -- 2010-07-23 rgerhards */
/* "just" added global variables
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index d2cb9332..2f0287c2 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -1206,6 +1206,56 @@ validateConf(void)
}
+#if 0
+/* create an emergency rule */
+static inline rsRetVal
+createEmergRule(char *PRIFilt, char *legact)
+{
+ rule_t *pRule;
+ action_t *pAction;
+ DEFiRet;
+
+ CHKiRet(rule.Construct(&pRule)); /* create "fresh" selector */
+ CHKiRet(rule.SetAssRuleset(pRule, ruleset.GetCurrent(loadConf)));
+ CHKiRet(rule.ConstructFinalize(pRule));
+ CHKiRet(cflineProcessTradPRIFilter((uchar**)&PRIFilt, pRule));
+ iRet = cflineDoAction(loadConf, (uchar**)&legact, &pAction);
+ iRet = llAppend(&(pRule)->llActList, NULL, (void*) pAction);
+ CHKiRet(ruleset.AddRule(loadConf, rule.GetAssRuleset(pRule), &pRule));
+
+finalize_it:
+ RETiRet;
+}
+
+
+/* start up an rsyslog emergency configuration. This is recovery if
+ * the config failed.
+ */
+static inline rsRetVal
+createEmergConf(void)
+{
+ DEFiRet;
+ errmsg.LogError(0, NO_ERRCODE, "EMERGENCY CONFIGURATION ACTIVATED - "
+ "fix rsyslog config file!");
+ /*
+ CHKiRet(rsconfConstruct(&loadConf));
+ourConf = loadConf; // TODO: remove, once ourConf is gone!
+ CHKiRet(loadBuildInModules());
+ CHKiRet(initLegacyConf());
+ */
+ ruleset.SetDefaultRuleset(loadConf, (uchar*) "RSYSLOG_DefaultRuleset");
+
+ CHKiRet(createEmergRule("*.err", _PATH_CONSOLE));
+ CHKiRet(createEmergRule("syslog.*", _PATH_CONSOLE));
+ CHKiRet(createEmergRule("*.panic", ":omusrmsg:*"));
+ CHKiRet(createEmergRule("syslog.*", ":omusrmsg:root"));
+CHKiRet(createEmergRule("*.*", "/tmp/emerg"));
+finalize_it:
+ RETiRet;
+}
+#endif
+
+
/* Load a configuration. This will do all necessary steps to create
* the in-memory representation of the configuration, including support
* for multiple configuration languages.
@@ -1219,9 +1269,7 @@ load(rsconf_t **cnf, uchar *confFile)
rsRetVal localRet;
int iNbrActions;
int bHadConfigErr = 0;
- char cbuf[BUFSIZ];
int r;
- char *emergConf;
DEFiRet;
CHKiRet(rsconfConstruct(&loadConf));
@@ -1253,17 +1301,10 @@ ourConf = loadConf; // TODO: remove, once ourConf is gone!
* very clever... So we stick with what we have.
* We ignore any errors while doing this - we would be lost anyhow...
*/
- errmsg.LogError(0, NO_ERRCODE, "EMERGENCY CONFIGURATION ACTIVATED - fix rsyslog config file!");
- emergConf =
- "*.err " _PATH_CONSOLE "\n"
- "syslog.* " _PATH_CONSOLE "\n"
- "*.panic :omusrmsg:*" "\n"
- "syslog.* :omusrmsg:root" "\n";
-dbgprintf("Emer Config '%s'\n",emergConf);
- cnfParseBuffer(emergConf, strlen(emergConf));
- r = yyparse();
- if(r != 0) {
- fprintf(stderr, "rsyslogd: could not even activate emergency conf - terminating\n");
+ // TODO: think about this! iRet = createEmergConf();
+ if(1) { //if(iRet != RS_RET_OK) {
+ fprintf(stderr, "rsyslogd: could not even activate emergency "
+ "conf - terminating\n");
exit(1);
}
}