From f74255db2dbaf79fb3f43a23c4f6f19eb4fca87e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 19 Jun 2007 10:54:44 +0000 Subject: fixed a bug that caused the tag to be missing on internal message (like startup) --- syslogd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'syslogd.c') diff --git a/syslogd.c b/syslogd.c index 101df479..f6f8f4ff 100644 --- a/syslogd.c +++ b/syslogd.c @@ -435,7 +435,7 @@ int funix[MAXFUNIX] = { -1, }; /* read-only after startup */ /* Flags to logmsg(). */ -/* NO LONGER NEEDED: #define IGN_CONS 0x001 * don't print on console */ +#define INTERNAL_MSG 0x001 /* msg generated by logmsgInternal() --> special handling */ #define SYNC_FILE 0x002 /* do fsync on file after printing */ #define ADDDATE 0x004 /* add a date to the message */ #define MARK 0x008 /* this message is a mark */ @@ -4176,7 +4176,7 @@ static void logmsgInternal(int pri, char * msg, char* from, int flags) pMsg->bParseHOSTNAME = 0; getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */ - logmsg(pri, pMsg, flags); + logmsg(pri, pMsg, flags | INTERNAL_MSG); MsgDestruct(pMsg); } @@ -4870,7 +4870,7 @@ static int parseLegacySyslogMsg(struct msg *pMsg, int flags) * is meant to be an interim solution, but for now it is in the code. */ - if(bParseHOSTNAMEandTAG) { + if(bParseHOSTNAMEandTAG && !(flags & INTERNAL_MSG)) { /* parse HOSTNAME - but only if this is network-received! * rger, 2005-11-14: we still have a problem with BSD messages. These messages * do NOT include a host name. In most cases, this leads to the TAG to be treated @@ -4975,8 +4975,11 @@ static int parseLegacySyslogMsg(struct msg *pMsg, int flags) /* we enter this code area when the user has instructed rsyslog NOT * to parse HOSTNAME and TAG - rgerhards, 2006-03-13 */ - dprintf("HOSTNAME and TAG not parsed by user configuraton.\n"); - MsgSetHOSTNAME(pMsg, getRcvFrom(pMsg)); + if(!(flags & INTERNAL_MSG)) + { + dprintf("HOSTNAME and TAG not parsed by user configuraton.\n"); + MsgSetHOSTNAME(pMsg, getRcvFrom(pMsg)); + } } /* The rest is the actual MSG */ -- cgit