summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-07-23 17:33:08 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-07-23 17:33:08 +0200
commitc97b1d3c72ef1504a430f65ae017112d834a3127 (patch)
tree1e2e262ceb6f338919de6ec65fd368e886bd477e /runtime
parent4eadfb64818eef25510e5cd0abe001d00a1a0831 (diff)
downloadrsyslog-c97b1d3c72ef1504a430f65ae017112d834a3127.tar.gz
rsyslog-c97b1d3c72ef1504a430f65ae017112d834a3127.tar.xz
rsyslog-c97b1d3c72ef1504a430f65ae017112d834a3127.zip
added support to save/restore rsyslog core action settings...
... but not those of plugins (which are at least as important as the core ones). So this is an interim commit.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/conf.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/runtime/conf.c b/runtime/conf.c
index 8106a2f5..c4c72ec2 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -1266,7 +1266,9 @@ setActionScope(void)
currConfObj = eConfObjAction;
DBGPRINTF("entering action scope\n");
+ CHKiRet(actionNewScope());
+finalize_it:
RETiRet;
}
@@ -1322,6 +1324,7 @@ endConfObj(void __attribute__((unused)) *pVal, uchar *pszName)
ABORT_FINALIZE(RS_RET_CONF_INVLD_END);
}
currConfObj = eConfObjGlobal;
+ CHKiRet(actionRestoreScope());
} else {
errmsg.LogError(0, RS_RET_INVLD_CONF_OBJ, "invalid config object \"%s\" in $End", pszName);
ABORT_FINALIZE(RS_RET_INVLD_CONF_OBJ);
@@ -1333,6 +1336,21 @@ finalize_it:
}
+/* Reset config variables to default values. Note that
+ * when we are inside an scope, we simply reset this to global.
+ * However, $ResetConfigVariables is a global directive, and as such
+ * will not be honored inside a scope!
+ * rgerhards, 2010-07-23
+ */
+static rsRetVal
+resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
+{
+ currConfObj = eConfObjGlobal;
+ bConfStrictScoping = 0;
+ return RS_RET_OK;
+}
+
+
/* exit our class
* rgerhards, 2008-03-11
*/
@@ -1377,7 +1395,7 @@ BEGINAbstractObjClassInit(conf, 1, OBJ_IS_CORE_MODULE) /* class, version - CHANG
CHKiRet(regCfSysLineHdlr((uchar *)"begin", 0, eCmdHdlrGetWord, beginConfObj, NULL, NULL, eConfObjGlobal));
CHKiRet(regCfSysLineHdlr((uchar *)"end", 0, eCmdHdlrGetWord, endConfObj, NULL, NULL, eConfObjAlways));
CHKiRet(regCfSysLineHdlr((uchar *)"strictscoping", 0, eCmdHdlrBinary, NULL, &bConfStrictScoping, NULL, eConfObjGlobal));
-#warning add $reset
+ CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, NULL, eConfObjAction));
ENDObjClassInit(conf)
/* vi:set ai: