summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-09-12 15:17:47 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-09-12 15:17:47 +0200
commit1e819a8afe9494cc760196ac91f3b617bc073de9 (patch)
treec0701f10aecefb3a60af67c310b33b3d2bedeb0a /runtime
parent262f61d869b95f63b393ae48d683b13e70322478 (diff)
parent4e86efaf0e20626d8f740fcff131bfd38453de4d (diff)
downloadrsyslog-1e819a8afe9494cc760196ac91f3b617bc073de9.tar.gz
rsyslog-1e819a8afe9494cc760196ac91f3b617bc073de9.tar.xz
rsyslog-1e819a8afe9494cc760196ac91f3b617bc073de9.zip
Merge branch 'beta'
Conflicts: runtime/rsyslog.h tools/syslogd.c
Diffstat (limited to 'runtime')
-rw-r--r--runtime/datetime.c17
-rw-r--r--runtime/datetime.h8
-rw-r--r--runtime/rsyslog.h4
3 files changed, 23 insertions, 6 deletions
diff --git a/runtime/datetime.c b/runtime/datetime.c
index 5211b78a..6d5652ff 100644
--- a/runtime/datetime.c
+++ b/runtime/datetime.c
@@ -266,10 +266,14 @@ ParseTIMESTAMP3339(struct syslogTime *pTime, char** ppszTS)
* Returns TRUE on parse OK, FALSE on parse error.
*/
static int
-ParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS)
+ParseTIMESTAMP3164(struct syslogTime *pTime, char** ppszTS)
{
- assert(pTime != NULL);
+ char *pszTS;
+
+ assert(ppszTS != NULL);
+ pszTS = *ppszTS;
assert(pszTS != NULL);
+ assert(pTime != NULL);
getCurrTime(pTime); /* obtain the current year and UTC offsets! */
@@ -436,13 +440,20 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS)
pTime->second = srSLMGParseInt32(&pszTS);
if(pTime->second < 0 || pTime->second > 60)
return FALSE;
- if(*pszTS++ != ':')
+
+ /* we provide support for an exter ":" after the date. While this is an
+ * invalid format, it occurs frequently enough (e.g. with Cisco devices)
+ * to permit it as a valid case. -- rgerhards, 2008-09-12
+ */
+ if(*pszTS++ == ':')
+ ++pszTS;
/* OK, we actually have a 3164 timestamp, so let's indicate this
* and fill the rest of the properties. */
pTime->timeType = 1;
pTime->secfracPrecision = 0;
pTime->secfrac = 0;
+ *ppszTS = pszTS; /* provide updated parse position back to caller */
return TRUE;
}
diff --git a/runtime/datetime.h b/runtime/datetime.h
index 8f1bcb17..755cc0ed 100644
--- a/runtime/datetime.h
+++ b/runtime/datetime.h
@@ -37,7 +37,7 @@ typedef struct datetime_s {
BEGINinterface(datetime) /* name must also be changed in ENDinterface macro! */
void (*getCurrTime)(struct syslogTime *t);
int (*ParseTIMESTAMP3339)(struct syslogTime *pTime, char** ppszTS);
- int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char* pszTS);
+ int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char** pszTS);
int (*formatTimestampToMySQL)(struct syslogTime *ts, char* pDst, size_t iLenDst);
int (*formatTimestampToPgSQL)(struct syslogTime *ts, char *pDst, size_t iLenDst);
int (*formatTimestamp3339)(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
@@ -45,6 +45,12 @@ BEGINinterface(datetime) /* name must also be changed in ENDinterface macro! */
int (*formatTimestampSecFrac)(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
ENDinterface(datetime)
#define datetimeCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */
+/* interface changes:
+ * 1 - initial version
+ * 2 - not compatible to 1 - bugfix required ParseTIMESTAMP3164 to accept char ** as
+ * last parameter. Did not try to remain compatible as this is not something any
+ * third-party module should call. -- rgerhards, 2008.-09-12
+ */
/* prototypes */
PROTOTYPEObj(datetime);
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index f75a5663..a1d1d9fc 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -171,7 +171,6 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_GSS_SEND_ERROR = -2024, /**< error during GSS (via TCP) send process */
RS_RET_TCP_SOCKCREATE_ERR = -2025, /**< error during creation of TCP socket */
RS_RET_GSS_SENDINIT_ERROR = -2024, /**< error during GSS (via TCP) send initialization process */
- RS_RET_QUEUE_FULL = -2025, /**< queue is full, operation could not be completed */
RS_RET_EOF = -2026, /**< end of file reached, not necessarily an error */
RS_RET_IO_ERROR = -2027, /**< some kind of IO error happened */
RS_RET_INVALID_OID = -2028, /**< invalid object ID */
@@ -221,7 +220,6 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_MAIL_NO_FROM = -2072, /**< sender for mail destination is missing */
RS_RET_INVALID_PRI = -2073, /**< PRI value is invalid */
RS_RET_MALICIOUS_HNAME = -2074, /**< remote peer is trying malicious things with its hostname */
- RS_RET_ACCEPT_ERR = -2074, /**< error during accept() system call */
RS_RET_INVALID_HNAME = -2075, /**< remote peer's hostname invalid or unobtainable */
RS_RET_INVALID_PORT = -2076, /**< invalid port value */
RS_RET_COULD_NOT_BIND = -2077, /**< could not bind socket, defunct */
@@ -251,6 +249,8 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_CERTLESS = -2102, /**< state: we run without machine cert (this may be OK) */
RS_RET_NO_ACTIONS = -2103, /**< no active actions are configured (no output will be created) */
RS_RET_CONF_FILE_NOT_FOUND = -2104, /**< config file or directory not found */
+ RS_RET_QUEUE_FULL = -2105, /**< queue is full, operation could not be completed */
+ RS_RET_ACCEPT_ERR = -2106, /**< error during accept() system call */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */