diff options
author | Mark Johnston <markj@FreeBSD.org> | 2020-10-09 15:19:29 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2020-10-09 15:19:29 +0000 |
commit | b0eefff78b8b2f3848544d644a001c7efa434b34 (patch) | |
tree | 336b82c522f24bdf64f7b87bfeefbf76842da9cc /usr.sbin/syslogd | |
parent | 812b09037daa73a977753d6ee88e6f0dad35acb2 (diff) |
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@ya.ru>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26644
Notes
Notes:
svn path=/head/; revision=366576
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 7c5dcc66cfe0..8cd4cdde9db9 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -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 *host, 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 */ |