Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/syslogd - when checking hostname of incoming remote...
details: https://anonhg.NetBSD.org/src/rev/8898c3a5b377
branches: trunk
changeset: 331649:8898c3a5b377
user: jnemeth <jnemeth%NetBSD.org@localhost>
date: Mon Aug 18 05:21:16 2014 +0000
description:
- when checking hostname of incoming remote messages, fallback to checking
remote host if the message doesn't contain a hostname
- don't truncate IP addresses when reading syslogd.conf
diffstat:
usr.sbin/syslogd/syslogd.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diffs (59 lines):
diff -r 70ba46e82b0a -r 8898c3a5b377 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c Mon Aug 18 04:40:51 2014 +0000
+++ b/usr.sbin/syslogd/syslogd.c Mon Aug 18 05:21:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $ */
+/* $NetBSD: syslogd.c,v 1.120 2014/08/18 05:21:16 jnemeth Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-__RCSID("$NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.120 2014/08/18 05:21:16 jnemeth Exp $");
#endif
#endif /* not lint */
@@ -1854,21 +1854,22 @@
}
for (f = Files; f; f = f->f_next) {
+ char *h; /* host to use for comparing */
+
/* skip messages that are incorrect priority */
if (!MATCH_PRI(f, fac, prilev)
|| f->f_pmask[fac] == INTERNAL_NOPRI)
continue;
/* skip messages with the incorrect host name */
- /* do we compare with host (IMHO correct) or recvhost */
- /* (compatible)? */
- if (f->f_host != NULL && buffer->host != NULL) {
- char shost[MAXHOSTNAMELEN + 1], *h;
- if (!BSDOutputFormat) {
- h = buffer->host;
- } else {
- (void)strlcpy(shost, buffer->host,
- sizeof(shost));
+ /* compare with host (which is supposedly more correct), */
+ /* but fallback to recvhost if host is NULL */
+ h = (buffer->host != NULL) ? buffer->host : buffer->recvhost;
+ if (f->f_host != NULL && h != NULL) {
+ char shost[MAXHOSTNAMELEN + 1];
+
+ if (BSDOutputFormat) {
+ (void)strlcpy(shost, h, sizeof(shost));
trim_anydomain(shost);
h = shost;
}
@@ -3740,7 +3741,7 @@
f->f_host = NULL;
else {
f->f_host = strdup(host);
- trim_anydomain(f->f_host);
+ trim_anydomain(&f->f_host[1]); /* skip +/- at beginning */
}
/* save program name, if any */
Home |
Main Index |
Thread Index |
Old Index