summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-26 18:38:42 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-26 18:38:42 +0200
commit415b95cf453403f726f654cbc03ef3984446a870 (patch)
treed167c493d8c498e6016c31a162acff45c1bea50d
parentde77494415ae8c169949d13ed0df0af3b1949b54 (diff)
downloadrsyslog-415b95cf453403f726f654cbc03ef3984446a870.tar.gz
rsyslog-415b95cf453403f726f654cbc03ef3984446a870.tar.xz
rsyslog-415b95cf453403f726f654cbc03ef3984446a870.zip
bugfix: pipes not opened in full priv mode when privs are to be dropped
-rw-r--r--ChangeLog1
-rw-r--r--tools/ompipe.c18
2 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index f98057a6..d4fe37a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-03-??
user and/or group. Note that it was long said that this "functionality"
would break once we go for serious privilege drop code, so hopefully
nobody still depends on it (and, if so, they lost...).
+- bugfix: pipes not opened in full priv mode when privs are to be dropped
- this begins a new devel branch for v5
- added support for user-level PRI provided via systemd
- added new config directive $InputTCPFlowControl to select if tcp
diff --git a/tools/ompipe.c b/tools/ompipe.c
index 58725fb9..cbedb559 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -72,6 +72,7 @@ DEFobjCurrIf(errmsg)
typedef struct _instanceData {
uchar f_fname[MAXFNAME];/* pipe or template name (display only) */
short fd; /* pipe descriptor for (current) pipe */
+ sbool bHadError; /* did we already have/report an error on this pipe? */
} instanceData;
@@ -101,6 +102,17 @@ preparePipe(instanceData *pData)
{
DEFiRet;
pData->fd = open((char*) pData->f_fname, O_RDWR|O_NONBLOCK|O_CLOEXEC);
+ if(pData->fd < 0 ) {
+ pData->fd = -1;
+ if(!pData->bHadError) {
+ char errStr[1024];
+ rs_strerror_r(errno, errStr, sizeof(errStr));
+ errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output pipe '%s': %s",
+ pData->f_fname, errStr);
+ pData->bHadError = 1;
+ }
+ DBGPRINTF("Error opening log pipe: %s\n", pData->f_fname);
+ }
RETiRet;
}
@@ -150,6 +162,7 @@ finalize_it:
BEGINcreateInstance
CODESTARTcreateInstance
pData->fd = -1;
+ pData->bHadError = 0;
ENDcreateInstance
@@ -204,11 +217,6 @@ CODESTARTparseSelectorAct
*/
preparePipe(pData);
- if(pData->fd < 0 ) {
- pData->fd = -1;
- DBGPRINTF("Error opening log pipe: %s\n", pData->f_fname);
- errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output pipe '%s'", pData->f_fname);
- }
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct