permitnonkernelfacility doesn't work when the new configuration syntax is used, e.g. 'module(load="imklog" permitnonkernelfacility="on")'. It does work with the old syntax, e.g. '$KLogPermitNonKernelFacility on'
This is because the old style config is stored in a static global struct "cs", while the new style config is passed in as a pointer. Code in imklog will put old style config entries into the new config struct, and almost all the code in imklog uses the new config struct like it should. Except for a check for bPermitNonKernel in Syslog() that continued to use the static global that only has old style configs. Fix this by passing pModConf down into Syslog() and using that in place of the static global. This fixes issue 477 on github. Signed-off-by: Trent Piepho <[email protected]> --- plugins/imklog/bsd.c | 4 ++-- plugins/imklog/imklog.c | 4 ++-- plugins/imklog/imklog.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/imklog/bsd.c b/plugins/imklog/bsd.c index 928cf9b..ff91cb2 100644 --- a/plugins/imklog/bsd.c +++ b/plugins/imklog/bsd.c @@ -144,13 +144,13 @@ submitSyslog(modConfData_t *pModConf, syslog_pri_t pri, uchar *buf) tp = &tv; done: - Syslog(pri, buf, tp); + Syslog(pModConf, pri, buf, tp); } #else /* now comes the BSD "code" (just a shim) */ static void submitSyslog(modConfData_t *pModConf, syslog_pri_t pri, uchar *buf) { - Syslog(pri, buf, NULL); + Syslog(pModConf, pri, buf, NULL); } #endif /* #ifdef LINUX */ diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c index 77f3791..92185be 100644 --- a/plugins/imklog/imklog.c +++ b/plugins/imklog/imklog.c @@ -219,7 +219,7 @@ rsRetVal imklogLogIntMsg(syslog_pri_t priority, const char *fmt, ...) * time to use. * rgerhards, 2008-04-14 */ -rsRetVal Syslog(syslog_pri_t priority, uchar *pMsg, struct timeval *tp) +rsRetVal Syslog(modConfData_t *pModConf, syslog_pri_t priority, uchar *pMsg, struct timeval *tp) { syslog_pri_t pri; int bPRISet = 0; @@ -248,7 +248,7 @@ rsRetVal Syslog(syslog_pri_t priority, uchar *pMsg, struct timeval *tp) /* if we don't get the pri, we use whatever we were supplied */ /* ignore non-kernel messages if not permitted */ - if(cs.bPermitNonKernel == 0 && pri2fac(priority) != LOG_KERN) + if(pModConf->bPermitNonKernel == 0 && pri2fac(priority) != LOG_KERN) FINALIZE; /* silently ignore */ iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", priority, tp); diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h index 4761132..13fa83a 100644 --- a/plugins/imklog/imklog.h +++ b/plugins/imklog/imklog.h @@ -55,7 +55,7 @@ int klogFacilIntMsg(void); /* the functions below may be called by the drivers */ rsRetVal imklogLogIntMsg(syslog_pri_t priority, const char *fmt, ...) __attribute__((format(printf,2, 3))); -rsRetVal Syslog(syslog_pri_t priority, uchar *msg, struct timeval *tp); +rsRetVal Syslog(modConfData_t *pModConf, syslog_pri_t priority, uchar *msg, struct timeval *tp); /* prototypes */ extern int klog_getMaxLine(void); /* work-around for klog drivers to get configured max line size */ -- 2.7.0.25.gfc10eb5.dirty _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com/professional-services/ What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.

