Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.sbin/syslogd Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/b350eb7cab39
branches:  netbsd-7
changeset: 799316:b350eb7cab39
user:      snj <snj%NetBSD.org@localhost>
date:      Wed May 13 19:19:19 2015 +0000

description:
Pull up following revision(s) (requested by jnemeth in ticket #760):
        usr.sbin/syslogd/syslogd.c: revision 1.120
- 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 8c52db0146e7 -r b350eb7cab39 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c        Wed May 13 19:16:14 2015 +0000
+++ b/usr.sbin/syslogd/syslogd.c        Wed May 13 19:19:19 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $   */
+/*     $NetBSD: syslogd.c,v 1.119.4.1 2015/05/13 19:19:19 snj 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.119.4.1 2015/05/13 19:19:19 snj 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