summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-22 15:12:35 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-22 15:12:35 +0200
commit651bee9cf55ca6aaea73e7921928bf6f9bd65404 (patch)
tree8c3ce1b498e01839fe6ef0c6adb8cfbcb2f42bad /plugins
parentb5f3387357ffa11e238ddfe0fa38af4fffba6081 (diff)
parent3abf567d2b57014381eda49018a0e2c21fa1b853 (diff)
downloadrsyslog-651bee9cf55ca6aaea73e7921928bf6f9bd65404.tar.gz
rsyslog-651bee9cf55ca6aaea73e7921928bf6f9bd65404.tar.xz
rsyslog-651bee9cf55ca6aaea73e7921928bf6f9bd65404.zip
Merge branch 'omfile' into tmp
This was a complex manual merge, especially in action.c. So if there occur some problems, this would be a good point to start troubleshooting. I run a couple of tests before commiting and they all went well. Conflicts: action.c action.h runtime/queue.c runtime/queue.h runtime/wti.c runtime/wti.h
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imdiag/imdiag.c3
-rw-r--r--plugins/imfile/imfile.c8
-rw-r--r--plugins/imklog/imklog.c6
-rw-r--r--plugins/imudp/imudp.c5
4 files changed, 10 insertions, 12 deletions
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
index 501077eb..6edcb8b3 100644
--- a/plugins/imdiag/imdiag.c
+++ b/plugins/imdiag/imdiag.c
@@ -205,8 +205,7 @@ doInjectMsg(int iNum)
datetime.getCurrTime(&stTime, &ttGenTime);
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &stTime, ttGenTime));
- CHKmalloc(pMsg->pszRawMsg = ustrdup(szMsg));
- pMsg->iLenRawMsg = ustrlen(szMsg);
+ MsgSetRawMsg(pMsg, (char*) szMsg, ustrlen(szMsg));
MsgSetInputName(pMsg, UCHAR_CONSTANT("imdiag"), sizeof("imdiag")-1);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 86270e2d..0f5f49dc 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -61,6 +61,7 @@ DEFobjCurrIf(strm)
typedef struct fileInfo_s {
uchar *pszFileName;
uchar *pszTag;
+ size_t lenTag;
uchar *pszStateFile; /* file in which state between runs is to be stored */
int iFacility;
int iSeverity;
@@ -97,10 +98,10 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
CHKiRet(msgConstruct(&pMsg));
MsgSetFlowControlType(pMsg, eFLOWCTL_FULL_DELAY);
MsgSetInputName(pMsg, UCHAR_CONSTANT("imfile"), sizeof("imfile")-1);
- MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
- MsgSetMSG(pMsg, (char*)rsCStrGetSzStr(cstrLine));
+ MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine), cstrLen(cstrLine));
+ MsgSetMSGoffs(pMsg, 0); /* we do not have a header... */
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName());
- MsgSetTAG(pMsg, (char*)pInfo->pszTag);
+ MsgSetTAG(pMsg, pInfo->pszTag, pInfo->lenTag);
pMsg->iFacility = LOG_FAC(pInfo->iFacility);
pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
pMsg->bParseHOSTNAME = 0;
@@ -471,6 +472,7 @@ static rsRetVal addMonitor(void __attribute__((unused)) *pVal, uchar *pNewVal)
ABORT_FINALIZE(RS_RET_CONFIG_ERROR);
} else {
pThis->pszTag = (uchar*) strdup((char*) pszFileTag);
+ pThis->lenTag = ustrlen(pThis->pszTag);
}
if(pszStateFile == NULL) {
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 420ebbf1..67fdc8a3 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -96,12 +96,12 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity)
CHKiRet(msgConstruct(&pMsg));
MsgSetFlowControlType(pMsg, eFLOWCTL_LIGHT_DELAY);
MsgSetInputName(pMsg, UCHAR_CONSTANT("imklog"), sizeof("imklog")-1);
- MsgSetRawMsg(pMsg, (char*)msg);
- MsgSetMSG(pMsg, (char*)msg);
+ MsgSetRawMsgWOSize(pMsg, (char*)msg);
+ MsgSetMSGoffs(pMsg, 0); /* we do not have a header... */
MsgSetRcvFrom(pMsg, glbl.GetLocalHostName());
MsgSetRcvFromIP(pMsg, (uchar*)"127.0.0.1");
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName());
- MsgSetTAG(pMsg, (char*)pszTag);
+ MsgSetTAG(pMsg, pszTag, ustrlen(pszTag));
pMsg->iFacility = LOG_FAC(iFacility);
pMsg->iSeverity = LOG_PRI(iSeverity);
pMsg->bParseHOSTNAME = 0;
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 97e66e8e..2340aac4 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -241,10 +241,7 @@ processSocket(int fd, struct sockaddr_storage *frominetPrev, int *pbIsPermitted,
}
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &stTime, ttGenTime));
- /* first trim the buffer to what we have actually received */
- CHKmalloc(pMsg->pszRawMsg = malloc(sizeof(uchar)* lenRcvBuf));
- memcpy(pMsg->pszRawMsg, pRcvBuf, lenRcvBuf);
- pMsg->iLenRawMsg = lenRcvBuf;
+ MsgSetRawMsg(pMsg, (char*)pRcvBuf, lenRcvBuf);
MsgSetInputName(pMsg, UCHAR_CONSTANT("imudp"), sizeof("imudp")-1);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;