Permalink
Browse files

imklog: Fix permitnonkernelfacility not working

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.

closes rsyslog#477
  • Loading branch information...
1 parent 451d5e1 commit 5c35619385bbe50979fa417e6f1b14df531b2a4a Trent Piepho committed with Jul 18, 2017
Showing with 5 additions and 5 deletions.
  1. +2 −2 plugins/imklog/bsd.c
  2. +2 −2 plugins/imklog/imklog.c
  3. +1 −1 plugins/imklog/imklog.h
View
@@ -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 */
View
@@ -220,7 +220,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;
@@ -249,7 +249,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);
View
@@ -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 */

0 comments on commit 5c35619

Please sign in to comment.