svn commit: r366576 - head/usr.sbin/syslogd

Mark Johnston markj at FreeBSD.org
Fri Oct 9 15:19:30 UTC 2020


Author: markj
Date: Fri Oct  9 15:19:29 2020
New Revision: 366576
URL: https://svnweb.freebsd.org/changeset/base/366576

Log:
  syslogd: Avoid trimming host names in RFC 5424 mode
  
  RFC 5424 says that implementations should log hostnames in FQDN
  format.  Only trim host names in RFC 3164 mode.
  
  PR:		250014
  Submitted by:	Dmitry Wagin <dmitry.wagin at ya.ru>
  MFC after:	1 month
  Differential Revision:	https://reviews.freebsd.org/D26644

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c	Fri Oct  9 15:14:19 2020	(r366575)
+++ head/usr.sbin/syslogd/syslogd.c	Fri Oct  9 15:19:29 2020	(r366576)
@@ -2300,7 +2300,9 @@ cvthname(struct sockaddr *f)
 	hl = strlen(hname);
 	if (hl > 0 && hname[hl-1] == '.')
 		hname[--hl] = '\0';
-	trimdomain(hname, hl);
+	/* RFC 5424 prefers logging FQDNs. */
+	if (RFC3164OutputFormat)
+		trimdomain(hname, hl);
 	return (hname);
 }
 
@@ -2927,7 +2929,9 @@ cfline(const char *line, const char *prog, const char 
 		hl = strlen(f->f_host);
 		if (hl > 0 && f->f_host[hl-1] == '.')
 			f->f_host[--hl] = '\0';
-		trimdomain(f->f_host, hl);
+		/* RFC 5424 prefers logging FQDNs. */
+		if (RFC3164OutputFormat)
+			trimdomain(f->f_host, hl);
 	}
 
 	/* save program name if any */


More information about the svn-src-all mailing list