diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-09-12 15:11:38 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-09-12 15:11:38 +0200 |
commit | 63994d092c3567030b96d28dbdc3db5f0e22fba2 (patch) | |
tree | 42d94ec95dc0231b0a8a86c52fd9605e524e6b09 /runtime | |
parent | 2082d963975a88c8e4dee3a43b98d939f9a2323f (diff) | |
parent | c04f196e25d63a7f45bf2ad79b48019fed98e5c9 (diff) | |
download | rsyslog-63994d092c3567030b96d28dbdc3db5f0e22fba2.tar.gz rsyslog-63994d092c3567030b96d28dbdc3db5f0e22fba2.tar.xz rsyslog-63994d092c3567030b96d28dbdc3db5f0e22fba2.zip |
Merge branch 'v3-stable' into beta
Conflicts:
runtime/datetime.h
runtime/rsyslog.h
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/datetime.c | 17 | ||||
-rw-r--r-- | runtime/datetime.h | 8 | ||||
-rw-r--r-- | runtime/rsyslog.h | 2 |
3 files changed, 22 insertions, 5 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 95b2c756..8843df85 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -170,7 +170,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 */ @@ -248,6 +247,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_RETRY = -2100, /**< call should be retried (e.g. EGAIN on recv) */ RS_RET_GSS_ERR = -2101, /**< generic error occured in GSSAPI subsystem */ RS_RET_CERTLESS = -2102, /**< state: we run without machine cert (this may be OK) */ + RS_RET_QUEUE_FULL = -2103, /**< queue is full, operation could not be completed */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ |