From a7d3428b143ec462e9a5f5f0963952026df2199b Mon Sep 17 00:00:00 2001 From: Matthew Seaman Date: Wed, 14 Jun 2017 17:38:26 +0000 Subject: [PATCH] Fix for the omprog module -- calling execve() with a NULL second argument doesn't work. Instead supply an argv list with just a terminating NULL entry. Submitted upstream as https://github.com/rsyslog/rsyslog/pull/1618 Patch files regenerated by 'make makepatch' Reported by: (Chun-Tien Chang) --- sysutils/rsyslog8/Makefile | 1 + .../files/patch-grammar_rainerscript.c | 2 +- .../files/patch-plugins_impstats_impstats.c | 2 +- .../files/patch-plugins_omprog_omprog.c | 20 +++++++++++++++++++ .../rsyslog8/files/patch-runtime_nsd__ptcp.c | 8 ++++---- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 sysutils/rsyslog8/files/patch-plugins_omprog_omprog.c diff --git a/sysutils/rsyslog8/Makefile b/sysutils/rsyslog8/Makefile index 3a88ceefc6a8..f26c24046109 100644 --- a/sysutils/rsyslog8/Makefile +++ b/sysutils/rsyslog8/Makefile @@ -2,6 +2,7 @@ PORTNAME= rsyslog PORTVERSION= 8.27.0 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= http://www.rsyslog.com/files/download/rsyslog/ diff --git a/sysutils/rsyslog8/files/patch-grammar_rainerscript.c b/sysutils/rsyslog8/files/patch-grammar_rainerscript.c index f2e1f1656dc4..375ea60262a7 100644 --- a/sysutils/rsyslog8/files/patch-grammar_rainerscript.c +++ b/sysutils/rsyslog8/files/patch-grammar_rainerscript.c @@ -1,4 +1,4 @@ ---- grammar/rainerscript.c.orig 2016-11-13 15:46:26 UTC +--- grammar/rainerscript.c.orig 2017-04-28 07:04:53 UTC +++ grammar/rainerscript.c @@ -35,6 +35,7 @@ #include diff --git a/sysutils/rsyslog8/files/patch-plugins_impstats_impstats.c b/sysutils/rsyslog8/files/patch-plugins_impstats_impstats.c index 93822e020bc4..b58201bfd8d5 100644 --- a/sysutils/rsyslog8/files/patch-plugins_impstats_impstats.c +++ b/sysutils/rsyslog8/files/patch-plugins_impstats_impstats.c @@ -1,4 +1,4 @@ ---- plugins/impstats/impstats.c.orig 2016-11-13 15:46:26 UTC +--- plugins/impstats/impstats.c.orig 2017-04-28 07:04:53 UTC +++ plugins/impstats/impstats.c @@ -36,6 +36,7 @@ #include diff --git a/sysutils/rsyslog8/files/patch-plugins_omprog_omprog.c b/sysutils/rsyslog8/files/patch-plugins_omprog_omprog.c new file mode 100644 index 000000000000..614d70264107 --- /dev/null +++ b/sysutils/rsyslog8/files/patch-plugins_omprog_omprog.c @@ -0,0 +1,20 @@ +--- plugins/omprog/omprog.c.orig 2017-05-15 09:41:19 UTC ++++ plugins/omprog/omprog.c +@@ -231,6 +231,7 @@ execBinary(wrkrInstanceData_t *pWrkrData + sigset_t set; + char errStr[1024]; + char *newenviron[] = { NULL }; ++ char *emptyArgv[] = { NULL }; + + fclose(stdin); + if(dup(fdStdin) == -1) { +@@ -277,6 +278,9 @@ execBinary(wrkrInstanceData_t *pWrkrData + alarm(0); + + /* finally exec child */ ++ if(pWrkrData->pData->aParams==NULL){ ++ pWrkrData->pData->aParams=emptyArgv; ++ } + iRet = execve((char*)pWrkrData->pData->szBinary, pWrkrData->pData->aParams, newenviron); + if(iRet == -1) { + /* Note: this will go to stdout of the **child**, so rsyslog will never diff --git a/sysutils/rsyslog8/files/patch-runtime_nsd__ptcp.c b/sysutils/rsyslog8/files/patch-runtime_nsd__ptcp.c index 7eb0a31fe117..4bcb1acaa904 100644 --- a/sysutils/rsyslog8/files/patch-runtime_nsd__ptcp.c +++ b/sysutils/rsyslog8/files/patch-runtime_nsd__ptcp.c @@ -1,6 +1,6 @@ ---- runtime/nsd_ptcp.c.orig 2016-11-06 16:32:01 UTC +--- runtime/nsd_ptcp.c.orig 2017-04-28 07:04:53 UTC +++ runtime/nsd_ptcp.c -@@ -656,7 +656,11 @@ EnableKeepAlive(nsd_t *pNsd) +@@ -665,7 +665,11 @@ EnableKeepAlive(nsd_t *pNsd) if(pThis->iKeepAliveProbes > 0) { optval = pThis->iKeepAliveProbes; optlen = sizeof(optval); @@ -12,7 +12,7 @@ } else { ret = 0; } -@@ -671,7 +675,11 @@ EnableKeepAlive(nsd_t *pNsd) +@@ -680,7 +684,11 @@ EnableKeepAlive(nsd_t *pNsd) if(pThis->iKeepAliveTime > 0) { optval = pThis->iKeepAliveTime; optlen = sizeof(optval); @@ -24,7 +24,7 @@ } else { ret = 0; } -@@ -686,7 +694,11 @@ EnableKeepAlive(nsd_t *pNsd) +@@ -695,7 +703,11 @@ EnableKeepAlive(nsd_t *pNsd) if(pThis->iKeepAliveIntvl > 0) { optval = pThis->iKeepAliveIntvl; optlen = sizeof(optval);