summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-08-01 10:14:37 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-08-01 10:14:37 +0200
commit4d01df57c2f378ceda3bcc400a9df5e50a0c007b (patch)
tree777c3c2827d7468f31594cc0d5fdff965e22463d /tools
parent617a7aaa1dc4569e6c151a14889bffe808f984c5 (diff)
downloadrsyslog-4d01df57c2f378ceda3bcc400a9df5e50a0c007b.tar.gz
rsyslog-4d01df57c2f378ceda3bcc400a9df5e50a0c007b.tar.xz
rsyslog-4d01df57c2f378ceda3bcc400a9df5e50a0c007b.zip
bugfix: potential abort if output plugin logged message during shutdown
note that none of the rsyslog-provided plugins does this Thanks to bodik and Rohit Prasad for alerting us on this bug and analyzing it. fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=347
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index cbbb66bc..8fc1d1e1 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -725,11 +725,19 @@ submitMsg(msg_t *pMsg)
ISOBJ_TYPE_assert(pMsg, msg);
pRuleset = MsgGetRuleset(pMsg);
-
pQueue = (pRuleset == NULL) ? pMsgQueue : ruleset.GetRulesetQueue(pRuleset);
+
+ /* if a plugin logs a message during shutdown, the queue may no longer exist */
+ if(pQueue == NULL) {
+ DBGPRINTF("submitMsg() could not submit message - "
+ "queue does (no longer?) exist - ignored\n");
+ FINALIZE;
+ }
+
MsgPrepareEnqueue(pMsg);
qqueueEnqObj(pQueue, pMsg->flowCtlType, (void*) pMsg);
+finalize_it:
RETiRet;
}
@@ -750,12 +758,20 @@ multiSubmitMsg(multi_submit_t *pMultiSub)
if(pMultiSub->nElem == 0)
FINALIZE;
+ pRuleset = MsgGetRuleset(pMultiSub->ppMsgs[0]);
+ pQueue = (pRuleset == NULL) ? pMsgQueue : ruleset.GetRulesetQueue(pRuleset);
+
+ /* if a plugin logs a message during shutdown, the queue may no longer exist */
+ if(pQueue == NULL) {
+ DBGPRINTF("multiSubmitMsg() could not submit message - "
+ "queue does (no longer?) exist - ignored\n");
+ FINALIZE;
+ }
+
for(i = 0 ; i < pMultiSub->nElem ; ++i) {
MsgPrepareEnqueue(pMultiSub->ppMsgs[i]);
}
- pRuleset = MsgGetRuleset(pMultiSub->ppMsgs[0]);
- pQueue = (pRuleset == NULL) ? pMsgQueue : ruleset.GetRulesetQueue(pRuleset);
iRet = pQueue->MultiEnq(pQueue, pMultiSub);
pMultiSub->nElem = 0;