summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-08-30 23:48:03 +0200
committerMichael Biebl <biebl@debian.org>2011-08-30 23:48:03 +0200
commitb9d0478eeb8b4f175704e012fcc06069b10e2553 (patch)
tree0be0af26b2ba76e79ae49f562852ef854393f74f /runtime
parent6b2af45bc8b2aa4292e3cf92986c01a728ef4d8c (diff)
downloadrsyslog-b9d0478eeb8b4f175704e012fcc06069b10e2553.tar.gz
Imported Upstream version 5.8.4upstream/5.8.4
Diffstat (limited to 'runtime')
-rw-r--r--runtime/Makefile.in1
-rw-r--r--runtime/msg.c29
-rw-r--r--runtime/net.c2
3 files changed, 21 insertions, 11 deletions
diff --git a/runtime/Makefile.in b/runtime/Makefile.in
index c74edfc..aa5af5e 100644
--- a/runtime/Makefile.in
+++ b/runtime/Makefile.in
@@ -369,6 +369,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
moddirs = @moddirs@
diff --git a/runtime/msg.c b/runtime/msg.c
index d1e67aa..cc7b463 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1629,14 +1629,21 @@ finalize_it:
}
-/* rgerhards, 2005-11-24
+/* al, 2011-07-26: LockMsg to avoid race conditions
*/
static inline char *getMSGID(msg_t *pM)
{
- return (pM->pCSMSGID == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSMSGID);
+ if (pM->pCSMSGID == NULL) {
+ return "-";
+ }
+ else {
+ MsgLock(pM);
+ char* pszreturn = (char*) rsCStrGetSzStrNoNULL(pM->pCSMSGID);
+ MsgUnlock(pM);
+ return pszreturn;
+ }
}
-
/* rgerhards 2009-06-12: set associated ruleset
*/
void MsgSetRuleset(msg_t *pMsg, ruleset_t *pRuleset)
@@ -2868,6 +2875,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
}
}
+dbgprintf("prop repl 4, pRes='%s', len %d\n", pRes, bufLen);
/* Take care of spurious characters to make the property safe
* for a path definition
*/
@@ -2945,7 +2953,13 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
}
/* check for "." and ".." (note the parenthesis in the if condition!) */
- if((*pRes == '.') && (*(pRes + 1) == '\0' || (*(pRes + 1) == '.' && *(pRes + 2) == '\0'))) {
+ if(*pRes == '\0') {
+ if(*pbMustBeFreed == 1)
+ free(pRes);
+ pRes = UCHAR_CONSTANT("_");
+ bufLen = 1;
+ *pbMustBeFreed = 0;
+ } else if((*pRes == '.') && (*(pRes + 1) == '\0' || (*(pRes + 1) == '.' && *(pRes + 2) == '\0'))) {
uchar *pTmp = pRes;
if(*(pRes + 1) == '\0')
@@ -2955,12 +2969,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
if(*pbMustBeFreed == 1)
free(pTmp);
*pbMustBeFreed = 0;
- } else if(*pRes == '\0') {
- if(*pbMustBeFreed == 1)
- free(pRes);
- pRes = UCHAR_CONSTANT("_");
- bufLen = 1;
- *pbMustBeFreed = 0;
}
}
@@ -3032,6 +3040,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
bufLen = ustrlen(pRes);
*pPropLen = bufLen;
+dbgprintf("end prop repl, pRes='%s', len %d\n", pRes, bufLen);
ENDfunc
return(pRes);
}
diff --git a/runtime/net.c b/runtime/net.c
index 789790f..4781739 100644
--- a/runtime/net.c
+++ b/runtime/net.c
@@ -722,7 +722,7 @@ static rsRetVal AddAllowedSender(struct AllowedSenders **ppRoot, struct AllowedS
SIN(allowIP.addr.NetAddr)->sin_port = 0;
memcpy(&(SIN(allowIP.addr.NetAddr)->sin_addr.s_addr),
&(SIN6(res->ai_addr)->sin6_addr.s6_addr32[3]),
- sizeof (struct sockaddr_in));
+ sizeof (in_addr_t));
if((iRet = AddAllowedSenderEntry(ppRoot, ppLast, &allowIP,
iSignificantBits))