From owner-svn-src-all@freebsd.org Fri Apr 6 16:24:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46D28F92C77; Fri, 6 Apr 2018 16:24:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F141084B06; Fri, 6 Apr 2018 16:24:03 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBD8514357; Fri, 6 Apr 2018 16:24:03 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36GO3iW032430; Fri, 6 Apr 2018 16:24:03 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36GO3hF032429; Fri, 6 Apr 2018 16:24:03 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201804061624.w36GO3hF032429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 6 Apr 2018 16:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332110 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 332110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 16:24:04 -0000 Author: ed Date: Fri Apr 6 16:24:03 2018 New Revision: 332110 URL: https://svnweb.freebsd.org/changeset/base/332110 Log: 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. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Fri Apr 6 16:22:14 2018 (r332109) +++ head/usr.sbin/syslogd/syslogd.c Fri Apr 6 16:24:03 2018 (r332110) @@ -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); }