Module Name: src
Committed By: christos
Date: Tue Jan 15 22:37:04 UTC 2013
Modified Files:
src/usr.sbin/syslogd: syslogd.c
Log Message:
PR/47449: David Holland: Don't log to terminals with mesg n, unless it is a
wall message.
To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.sbin/syslogd/syslogd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.112 src/usr.sbin/syslogd/syslogd.c:1.113
--- src/usr.sbin/syslogd/syslogd.c:1.112 Tue Jun 19 21:39:34 2012
+++ src/usr.sbin/syslogd/syslogd.c Tue Jan 15 17:37:04 2013
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
#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 @@ wallmsg(struct filed *f, struct iovec *i
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 */