|
|
b65758 |
From d649d77cd585f70c6122d7e4ce95e82ad0e9af5e Mon Sep 17 00:00:00 2001
|
|
|
b65758 |
From: Radovan Sroka <rsroka@redhat.com>
|
|
|
b65758 |
Date: Thu, 23 Feb 2017 15:05:27 +0100
|
|
|
b65758 |
Subject: [PATCH] Fixed segfault in glblDoneLoadCnf()
|
|
|
b65758 |
|
|
|
b65758 |
This is caused by uninitialized net static structure in glbl objUse(net)
|
|
|
b65758 |
is not called after start of glbl module.
|
|
|
b65758 |
|
|
|
b65758 |
It looks like it is not possible to use objUse(net) when glbl module
|
|
|
b65758 |
starts. So we call it inside of glblDoneLoadCnf().
|
|
|
b65758 |
---
|
|
|
b65758 |
runtime/glbl.c | 6 ++++--
|
|
|
b65758 |
runtime/glbl.h | 2 +-
|
|
|
b65758 |
runtime/rsconf.c | 6 +++---
|
|
|
b65758 |
3 files changed, 8 insertions(+), 6 deletions(-)
|
|
|
b65758 |
|
|
|
b65758 |
diff --git a/runtime/glbl.c b/runtime/glbl.c
|
|
|
b65758 |
index 2079c46..1a32c2d 100644
|
|
|
b65758 |
--- a/runtime/glbl.c
|
|
|
b65758 |
+++ b/runtime/glbl.c
|
|
|
b65758 |
@@ -1076,11 +1076,13 @@ do_setenv(const char *const var)
|
|
|
b65758 |
/* This processes the "regular" parameters which are to be set after the
|
|
|
b65758 |
* config has been fully loaded.
|
|
|
b65758 |
*/
|
|
|
b65758 |
-void
|
|
|
b65758 |
+rsRetVal
|
|
|
b65758 |
glblDoneLoadCnf(void)
|
|
|
b65758 |
{
|
|
|
b65758 |
int i;
|
|
|
b65758 |
unsigned char *cstr;
|
|
|
b65758 |
+ DEFiRet;
|
|
|
b65758 |
+ CHKiRet(objUse(net, CORE_COMPONENT));
|
|
|
b65758 |
|
|
|
b65758 |
qsort(tzinfos, ntzinfos, sizeof(tzinfo_t), qs_arrcmp_tzinfo);
|
|
|
b65758 |
DBGPRINTF("Timezone information table (%d entries):\n", ntzinfos);
|
|
|
b65758 |
@@ -1210,7 +1212,7 @@ glblDoneLoadCnf(void)
|
|
|
b65758 |
stddbg = -1;
|
|
|
b65758 |
}
|
|
|
b65758 |
|
|
|
b65758 |
-finalize_it: return;
|
|
|
b65758 |
+finalize_it: RETiRet;
|
|
|
b65758 |
}
|
|
|
b65758 |
|
|
|
b65758 |
|
|
|
b65758 |
diff --git a/runtime/glbl.h b/runtime/glbl.h
|
|
|
b65758 |
index 6d18a2c..048c0a6 100644
|
|
|
b65758 |
--- a/runtime/glbl.h
|
|
|
b65758 |
+++ b/runtime/glbl.h
|
|
|
b65758 |
@@ -125,7 +125,7 @@ void glblProcessCnf(struct cnfobj *o);
|
|
|
b65758 |
void glblProcessTimezone(struct cnfobj *o);
|
|
|
b65758 |
void glblProcessMainQCnf(struct cnfobj *o);
|
|
|
b65758 |
void glblDestructMainqCnfObj(void);
|
|
|
b65758 |
-void glblDoneLoadCnf(void);
|
|
|
b65758 |
+rsRetVal glblDoneLoadCnf(void);
|
|
|
b65758 |
const uchar * glblGetWorkDirRaw(void);
|
|
|
b65758 |
tzinfo_t* glblFindTimezoneInfo(char *id);
|
|
|
b65758 |
int GetGnuTLSLoglevel(void);
|
|
|
b65758 |
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
|
|
|
b65758 |
index dc6bd7f..f337e1f 100644
|
|
|
b65758 |
--- a/runtime/rsconf.c
|
|
|
b65758 |
+++ b/runtime/rsconf.c
|
|
|
b65758 |
@@ -627,11 +627,11 @@ dropPrivileges(rsconf_t *cnf)
|
|
|
b65758 |
/* tell the rsysog core (including ourselfs) that the config load is done and
|
|
|
b65758 |
* we need to prepare to move over to activate mode.
|
|
|
b65758 |
*/
|
|
|
b65758 |
-static inline void
|
|
|
b65758 |
+static inline rsRetVal
|
|
|
b65758 |
tellCoreConfigLoadDone(void)
|
|
|
b65758 |
{
|
|
|
b65758 |
DBGPRINTF("telling rsyslog core that config load for %p is done\n", loadConf);
|
|
|
b65758 |
- glblDoneLoadCnf();
|
|
|
b65758 |
+ return glblDoneLoadCnf();
|
|
|
b65758 |
}
|
|
|
b65758 |
|
|
|
b65758 |
|
|
|
b65758 |
@@ -1345,7 +1345,7 @@ ourConf = loadConf; // TODO: remove, once ourConf is gone!
|
|
|
b65758 |
DBGPRINTF("Number of actions in this configuration: %d\n", iActionNbr);
|
|
|
b65758 |
rulesetOptimizeAll(loadConf);
|
|
|
b65758 |
|
|
|
b65758 |
- tellCoreConfigLoadDone();
|
|
|
b65758 |
+ CHKiRet(tellCoreConfigLoadDone());
|
|
|
b65758 |
tellModulesConfigLoadDone();
|
|
|
b65758 |
|
|
|
b65758 |
tellModulesCheckConfig();
|