Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/syslogd PR/47449: David Holland: Don't log to termi...



details:   https://anonhg.NetBSD.org/src/rev/2e16ed7a89b5
branches:  trunk
changeset: 784041:2e16ed7a89b5
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 15 22:37:04 2013 +0000

description:
PR/47449: David Holland: Don't log to terminals with mesg n, unless it is a
wall message.

diffstat:

 usr.sbin/syslogd/syslogd.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 5429bc1d21e1 -r 2e16ed7a89b5 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c        Tue Jan 15 21:04:41 2013 +0000
+++ b/usr.sbin/syslogd/syslogd.c        Tue Jan 15 22:37:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslogd.c,v 1.112 2012/06/20 01:39:34 christos Exp $   */
+/*     $NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos 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.112 2012/06/20 01:39:34 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -2562,6 +2562,12 @@
                        if (!f->f_un.f_uname[i][0])
                                break;
                        if (strcmp(f->f_un.f_uname[i], ep->name) == 0) {
+                               struct stat st;
+
+                               if (stat(ep->line, &st) != -1 &&
+                                   (st.st_mode & S_IWGRP) == 0)
+                                       break;
+
                                if ((p = ttymsg(iov, iovcnt, ep->line,
                                    TTYMSGTIME)) != NULL) {
                                        errno = 0;      /* already in msg */



Home | Main Index | Thread Index | Old Index