summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-01-26 12:03:50 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-01-26 12:03:50 +0100
commit62e00d7a1c1d0301d50e7a28cb84563d61410ecd (patch)
treec7496b89e62eabe3fb376c0b1c9ea8f015f0afec
parentad58b9c8fbc6159a361d40d97decddb95758c0a7 (diff)
parent939852b1cdfaed376342a3a0aa4b0fb7c14f55c5 (diff)
downloadrsyslog-62e00d7a1c1d0301d50e7a28cb84563d61410ecd.tar.gz
rsyslog-62e00d7a1c1d0301d50e7a28cb84563d61410ecd.tar.xz
rsyslog-62e00d7a1c1d0301d50e7a28cb84563d61410ecd.zip
Merge branch 'v4-beta' into tmp
Conflicts: ChangeLog
-rw-r--r--ChangeLog21
-rw-r--r--doc/rsyslog_conf_actions.html10
-rw-r--r--doc/rsyslog_conf_filter.html4
-rw-r--r--runtime/conf.c3
-rw-r--r--runtime/queue.c23
-rw-r--r--runtime/stream.c13
-rw-r--r--runtime/stream.h3
-rw-r--r--tools/omfile.c22
-rw-r--r--tools/omfwd.c6
-rw-r--r--tools/rsyslog.conf.54
-rw-r--r--tools/syslogd.c1
11 files changed, 79 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 7386ee38..1f6a883c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,25 @@ Version 4.7.0 [v4-devel] (rgerhards), 2009-09-??
- imported changes from 4.5.7 and below
- bugfix: potential segfault when -p command line option was used
Thanks for varmojfekoj for pointing me at this bug.
+- bugfix: potential segfaults during queue shutdown
+ (bugs require certain non-standard settings to appear)
+ Thanks to varmojfekoj for the patch [imported from 4.5.8]
+---------------------------------------------------------------------------
+Version 4.5.8 [v4-beta] (rgerhards), 2010-01-??
+- bugfix: -d did not enable display of debug messages
+ regression from introduction of "debug on demand" mode
+ Thanks to Michael Biebl for reporting this bug
+- bugfix: blanks inside file names did not terminate file name parsing.
+ This could reslult in the whole rest of a line (including comments)
+ to be treated as file name in "write to file" actions.
+ Thanks to Jack for reporting this issue.
+- bugfix: rsyslog hang when writing to a named pipe which nobody was
+ reading. Thanks to Michael Biebl for reporting this bug.
+- bugfix: memory leak when sending messages in zip-compressed format
+ Thanks to Naoya Nakazawa for analyzing this issue and providing a patch.
+- bugfix: potential segfaults during queue shutdown
+ (bugs require certain non-standard settings to appear)
+ Thanks to varmojfekoj for the patch
---------------------------------------------------------------------------
Version 4.5.7 [v4-beta] (rgerhards), 2009-11-18
- added a so-called "On Demand Debug" mode, in which debug output can
@@ -201,6 +220,8 @@ Version 4.4.3 [v4-stable] (rgerhards), 2009-10-??
This was a regression from the time() optimizations done in v4.
Bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=143
Thanks to Klaus Tachtler for reporting this bug.
+- bugfix: potential segfault on queue shutdown
+ Thanks to varmojfekoj for the patch.
- bugfix: potential hang condition on queue shutdown
[imported from v3-stable]
- bugfix: segfault on startup when -q or -Q option was given
diff --git a/doc/rsyslog_conf_actions.html b/doc/rsyslog_conf_actions.html
index 2ef3f4b0..8c4b9cfc 100644
--- a/doc/rsyslog_conf_actions.html
+++ b/doc/rsyslog_conf_actions.html
@@ -98,18 +98,14 @@ done, same with /dev/console.</p>
messages to a remote host running rsyslogd(8) and to receive messages
from remote hosts. Using this feature you're able to control all syslog
messages on one host, if all other machines will log remotely to that.
-This tears down<br>
-administration needs.<br>
-<br>
-<b>Please note that this version of rsyslogd by default does NOT
-forward messages it has received from the network to another host.
-Specify the "-h" option to enable this.</b></p>
+This tears down administration needs.</p>
<p>To forward messages to another host, prepend the hostname with
the at sign ("@"). A single at sign means that messages will
be forwarded via UDP protocol (the standard for syslog). If you prepend
two at signs ("@@"), the messages will be transmitted via TCP. Please
note that plain TCP based syslog is not officially standardized, but
-most major syslogds support it (e.g. syslog-ng or WinSyslog). The
+most major syslogds support it (e.g. syslog-ng or
+<a href="http://www.winsyslog.com/">WinSyslog</a>). The
forwarding action indicator (at-sign) can be followed by one or more
options. If they are given, they must be immediately (without a space)
following the final at sign and be enclosed in parenthesis. The
diff --git a/doc/rsyslog_conf_filter.html b/doc/rsyslog_conf_filter.html
index 1d30d8ae..841ec9c7 100644
--- a/doc/rsyslog_conf_filter.html
+++ b/doc/rsyslog_conf_filter.html
@@ -48,8 +48,8 @@ in rsyslog and offer the best performance for this job.</p>
facility and a priority, separated by a period (".''). Both parts are
case insensitive and can also be specified as decimal numbers, but
don't do that, you have been warned. Both facilities and priorities are
-described in rsyslog(3). The names mentioned below correspond to the
-similar LOG_-values in /usr/include/rsyslog.h.<br>
+described in syslog(3). The names mentioned below correspond to the
+similar LOG_-values in /usr/include/syslog.h.<br>
<br>
The facility is one of the following keywords: auth, authpriv, cron,
daemon, kern, lpr, mail, mark, news, security (same as auth), syslog,
diff --git a/runtime/conf.c b/runtime/conf.c
index 83ed2e9b..b92664a1 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -568,6 +568,7 @@ finalize_it:
* rgerhards, 2007-07-25
* updated to include OMSR pointer -- rgerhards, 2007-07-27
* updated to include template name -- rgerhards, 2008-03-28
+ * rgerhards, 2010-01-19: file names end at the first space
*/
rsRetVal
cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *pszTpl)
@@ -580,7 +581,7 @@ cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int
pName = pFileName;
i = 1; /* we start at 1 so that we reseve space for the '\0'! */
- while(*p && *p != ';' && i < MAXFNAME) {
+ while(*p && *p != ';' && *p != ' ' && i < MAXFNAME) {
*pName++ = *p++;
++i;
}
diff --git a/runtime/queue.c b/runtime/queue.c
index ddff1bcf..9d7a9058 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -858,9 +858,11 @@ static rsRetVal qDestructDisk(qqueue_t *pThis)
DEFiRet;
ASSERT(pThis != NULL);
-
- strm.Destruct(&pThis->tVars.disk.pWrite);
- strm.Destruct(&pThis->tVars.disk.pRead);
+
+ if (pThis->tVars.disk.pWrite != NULL)
+ strm.Destruct(&pThis->tVars.disk.pWrite);
+ if (pThis->tVars.disk.pRead != NULL)
+ strm.Destruct(&pThis->tVars.disk.pRead);
RETiRet;
}
@@ -1214,7 +1216,7 @@ static rsRetVal qqueueShutdownWorkers(qqueue_t *pThis)
/* we need to re-aquire the mutex for the next check in this case! */
BEGIN_MTX_PROTECTED_OPERATIONS(pThis->mut, LOCK_MUTEX); /* some workers may be running in parallel! */
}
- if(pThis->bIsDA && wtpGetCurNumWrkr(pThis->pWtpDA, LOCK_MUTEX) > 0) {
+ if(pThis->bRunsDA && wtpGetCurNumWrkr(pThis->pWtpDA, LOCK_MUTEX) > 0) {
/* and now the same for the DA queue */
END_MTX_PROTECTED_OPERATIONS(pThis->mut);
dbgoprint((obj_t*) pThis, "trying immediate shutdown of DA workers\n");
@@ -1666,7 +1668,7 @@ qqueueChkStopWrkrDA(qqueue_t *pThis)
if(pThis->bEnqOnly) {
bStopWrkr = 1;
} else {
- if(pThis->bRunsDA) {
+ if(pThis->bRunsDA == 2) {
ASSERT(pThis->pqDA != NULL);
if( pThis->pqDA->bEnqOnly
&& pThis->pqDA->sizeOnDiskMax > 0
@@ -1921,7 +1923,8 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
pThis->bNeedDelQIF = 0;
}
/* indicate spool file needs to be deleted */
- CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
+ if (pThis->tVars.disk.pRead != NULL)
+ CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
FINALIZE; /* nothing left to do, so be happy */
}
@@ -1955,13 +1958,15 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
}
/* now persist the stream info */
- CHKiRet(strm.Serialize(pThis->tVars.disk.pWrite, psQIF));
- CHKiRet(strm.Serialize(pThis->tVars.disk.pRead, psQIF));
+ if (pThis->tVars.disk.pWrite != NULL)
+ CHKiRet(strm.Serialize(pThis->tVars.disk.pWrite, psQIF));
+ if (pThis->tVars.disk.pRead != NULL)
+ CHKiRet(strm.Serialize(pThis->tVars.disk.pRead, psQIF));
/* tell the input file object that it must not delete the file on close if the queue
* is non-empty - but only if we are not during a simple checkpoint
*/
- if(bIsCheckpoint != QUEUE_CHECKPOINT) {
+ if(bIsCheckpoint != QUEUE_CHECKPOINT && pThis->tVars.disk.pRead != NULL) {
CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pRead, 0));
}
diff --git a/runtime/stream.c b/runtime/stream.c
index 2d1e9380..36f44003 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -209,13 +209,19 @@ doPhysOpen(strm_t *pThis)
default:assert(0);
break;
}
+ if(pThis->sType == STREAMTYPE_NAMED_PIPE) {
+ DBGPRINTF("Note: stream '%s' is a named pipe, open with O_NONBLOCK\n", pThis->pszCurrFName);
+ iFlags |= O_NONBLOCK;
+ }
pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode);
DBGPRINTF("file '%s' opened as #%d with mode %d\n", pThis->pszCurrFName, pThis->fd, pThis->tOpenMode);
if(pThis->fd == -1) {
- int ierrnoSave = errno;
- dbgoprint((obj_t*) pThis, "open error %d, file '%s'\n", errno, pThis->pszCurrFName);
- if(ierrnoSave == ENOENT)
+ char errStr[1024];
+ int err = errno;
+ rs_strerror_r(err, errStr, sizeof(errStr));
+ dbgoprint((obj_t*) pThis, "open error %d, file '%s': %s\n", errno, pThis->pszCurrFName, errStr);
+ if(err == ENOENT)
ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND);
else
ABORT_FINALIZE(RS_RET_IO_ERROR);
@@ -429,6 +435,7 @@ strmHandleEOF(strm_t *pThis)
ISOBJ_TYPE_assert(pThis, strm);
switch(pThis->sType) {
case STREAMTYPE_FILE_SINGLE:
+ case STREAMTYPE_NAMED_PIPE:
ABORT_FINALIZE(RS_RET_EOF);
break;
case STREAMTYPE_FILE_CIRCULAR:
diff --git a/runtime/stream.h b/runtime/stream.h
index 64ffb6e1..89175b0f 100644
--- a/runtime/stream.h
+++ b/runtime/stream.h
@@ -76,7 +76,8 @@
typedef enum {
STREAMTYPE_FILE_SINGLE = 0, /**< read a single file */
STREAMTYPE_FILE_CIRCULAR = 1, /**< circular files */
- STREAMTYPE_FILE_MONITOR = 2 /**< monitor a (third-party) file */
+ STREAMTYPE_FILE_MONITOR = 2, /**< monitor a (third-party) file */
+ STREAMTYPE_NAMED_PIPE = 3 /**< file is a named pipe (so far, tested for output only) */
} strmType_t;
typedef enum { /* when extending, do NOT change existing modes! */
diff --git a/tools/omfile.c b/tools/omfile.c
index 2c547b2b..efdaead4 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -111,6 +111,7 @@ static uchar *pszTplName = NULL; /* name of the default template to use */
typedef struct _instanceData {
uchar f_fname[MAXFNAME];/* file or template name (display only) */
strm_t *pStrm; /* our output stream */
+ strmType_t strmType; /* stream type, used for named pipes */
char bDynamicName; /* 0 - static name, 1 - dynamic name (with properties) */
int fCreateMode; /* file creation mode for open() */
int fDirCreateMode; /* creation mode for mkdir() */
@@ -425,7 +426,7 @@ prepareFile(instanceData *pData, uchar *newFileName)
CHKiRet(strm.SettOperationsMode(pData->pStrm, STREAMMODE_WRITE_APPEND));
CHKiRet(strm.SettOpenMode(pData->pStrm, fCreateMode));
CHKiRet(strm.SetbSync(pData->pStrm, pData->bSyncFile));
- CHKiRet(strm.SetsType(pData->pStrm, STREAMTYPE_FILE_SINGLE));
+ CHKiRet(strm.SetsType(pData->pStrm, pData->strmType));
CHKiRet(strm.SetiSizeLimit(pData->pStrm, pData->iSizeLimit));
/* set the flush interval only if we actually use it - otherwise it will activate
* async processing, which is a real performance waste if we do not do buffered
@@ -596,8 +597,11 @@ writeFile(uchar **ppString, unsigned iMsgOpts, instanceData *pData)
finalize_it:
if(iRet != RS_RET_OK) {
- /* in v5, we shall return different states for message-cause failur (but only there!) */
- iRet = RS_RET_SUSPENDED;
+ /* in v5, we shall return different states for message-caused failure (but only there!) */
+ if(pData->strmType == STREAMTYPE_NAMED_PIPE)
+ iRet = RS_RET_DISABLE_ACTION; /* this is the traditional semantic -- rgerhards, 2010-01-15 */
+ else
+ iRet = RS_RET_SUSPENDED;
}
RETiRet;
}
@@ -685,11 +689,17 @@ CODESTARTparseSelectorAct
case '|':
case '/':
CODE_STD_STRING_REQUESTparseSelectorAct(1)
- /* we now have the same semantics for files and pipes, but we need to skip over
- * the pipe indicator traditionally seen in config files...
+ /* we now have *almost* the same semantics for files and pipes, but we still need
+ * to know we deal with a pipe, because we must do non-blocking opens in that case
+ * (to keep consistent with traditional semantics and prevent rsyslog from hanging).
*/
- if(*p == '|')
+ if(*p == '|') {
++p;
+ pData->strmType = STREAMTYPE_NAMED_PIPE;
+ } else {
+ pData->strmType = STREAMTYPE_FILE_SINGLE;
+ }
+
CHKiRet(cflineParseFileName(p, (uchar*) pData->f_fname, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,
(pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName));
pData->bDynamicName = 0;
diff --git a/tools/omfwd.c b/tools/omfwd.c
index fe65f515..02f19eac 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -483,6 +483,12 @@ CODESTARTdoAction
}
}
finalize_it:
+# ifdef USE_NETZIP
+ if(psz != (char*) ppString[0]) {
+ /* we need to free temporary buffer, alloced above - Naoya Nakazawa, 2010-01-11 */
+ free(psz);
+ }
+# endif
ENDdoAction
diff --git a/tools/rsyslog.conf.5 b/tools/rsyslog.conf.5
index 0a2422c6..f2b915e2 100644
--- a/tools/rsyslog.conf.5
+++ b/tools/rsyslog.conf.5
@@ -164,8 +164,8 @@ a pattern of facilities and priorities belonging to the specified action.
The selector field itself again consists of two parts, a facility and a
priority, separated by a period ('.'). Both parts are case insensitive and can
also be specified as decimal numbers, but don't do that, you have been warned.
-Both facilities and priorities are described in rsyslog(3). The names mentioned
-below correspond to the similar LOG_-values in /usr/include/rsyslog.h.
+Both facilities and priorities are described in syslog(3). The names mentioned
+below correspond to the similar LOG_-values in /usr/include/syslog.h.
The facility is one of the following keywords: auth, authpriv, cron, daemon,
kern, lpr, mail, mark, news, security (same as auth), syslog, user, uucp and
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 17fcf9f3..8fcb8dd0 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -3216,6 +3216,7 @@ int realMain(int argc, char **argv)
iCompatibilityMode = atoi(optarg);
break;
case 'd': /* debug - must be handled now, so that debug is active during init! */
+ debugging_on = 1;
Debug = 1;
break;
case 'e': /* log every message (no repeat message supression) */