summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-30 18:45:41 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-30 18:45:41 +0200
commitaaffc4281e0b26f419a3fc341461f2fc479080b8 (patch)
treef605da690f7e095c4a0bba4139c5f45cff687fef /tools
parente397c34d2a6c7c1e4c116fd2363cb173e32eb2a2 (diff)
downloadrsyslog-aaffc4281e0b26f419a3fc341461f2fc479080b8.tar.gz
rsyslog-aaffc4281e0b26f419a3fc341461f2fc479080b8.tar.xz
rsyslog-aaffc4281e0b26f419a3fc341461f2fc479080b8.zip
introduced a new way of handling the RcvFrom property
... plus a fix for a long-time bug in obj-types.h. That lead to the object pointer only then to become NULL when the object was actually destructed, I discovered this issue during introduction of the pRcvFrom property in msg_t, but it potentially had other effects, too. I am not sure if some experienced instability resulted from this bug OR if its fix will cause harm to so-far "correctly" running code. The later may very well be. Thus I will change it only for the current branch and also the beta, but not in all old builds. Let's see how things evolve.
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index f1c43602..3694c70a 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -596,7 +596,7 @@ static inline rsRetVal printline(uchar *hname, uchar *hnameIP, uchar *msg, int f
*/
if((pMsg->msgFlags & PARSE_HOSTNAME) == 0)
MsgSetHOSTNAME(pMsg, hname, ustrlen(hname));
- MsgSetRcvFrom(pMsg, hname);
+ MsgSetRcvFromStr(pMsg, hname, ustrlen(hname));
MsgSetAfterPRIOffs(pMsg, p - msg);
CHKiRet(MsgSetRcvFromIP(pMsg, hnameIP));
@@ -870,7 +870,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
MsgSetInputName(pMsg, pInternalInputName);
MsgSetRawMsgWOSize(pMsg, (char*)msg);
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
- MsgSetRcvFrom(pMsg, glbl.GetLocalHostName());
+ MsgSetRcvFrom(pMsg, glbl.GetLocalHostNameProp());
MsgSetRcvFromIP(pMsg, UCHAR_CONSTANT("127.0.0.1"));
/* check if we have an error code associated and, if so,
* adjust the tag. -- rgerhards, 2008-06-27
@@ -3259,6 +3259,7 @@ int realMain(int argc, char **argv)
*/
glbl.SetLocalHostName(LocalHostName);
glbl.SetLocalDomain(LocalDomain);
+ glbl.GenerateLocalHostNameProperty(); /* must be redone after conf processing, FQDN setting may have changed */
/* initialize the objects */
if((iRet = modInitIminternal()) != RS_RET_OK) {
@@ -3455,6 +3456,9 @@ int realMain(int argc, char **argv)
if(!iConfigVerify)
CHKiRet(doGlblProcessInit());
+ /* re-generate local host name property, as the config may have changed our FQDN settings */
+ glbl.GenerateLocalHostNameProperty();
+
CHKiRet(mainThread());
/* do any de-init's that need to be done AFTER this comment */