Properly respect the passed in hostname for RFC 5424 messages.

Only override the hostname in case none is provided or when remote
hostnames should be ignored.
This commit is contained in:
Ed Schouten 2018-04-06 16:24:03 +00:00
parent e0f92f5c77
commit 10b154332d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332110

View File

@ -1028,6 +1028,8 @@ parsemsg_rfc5424(const char *from, int pri, char *msg)
msg[-1] = '\0'; \
}
PARSE_STRING("HOSTNAME", hostname);
if (hostname == NULL || !RemoteHostname)
hostname = from;
PARSE_STRING("APP-NAME", app_name);
PARSE_STRING("PROCID", procid);
PARSE_STRING("MSGID", msgid);
@ -1079,7 +1081,7 @@ parsemsg_rfc5424(const char *from, int pri, char *msg)
#undef IF_NOT_NILVALUE
parsemsg_remove_unsafe_characters(msg, line, sizeof(line));
logmsg(pri, timestamp, from, app_name, procid, msgid,
logmsg(pri, timestamp, hostname, app_name, procid, msgid,
structured_data, line, 0);
}