summaryrefslogtreecommitdiff
path: root/usr.bin/wall/ttymsg.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-18 02:57:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-18 02:57:23 +0000
commit411b09d8db89b43c4f63ce76a38d9443a0bbce1d (patch)
treef95339d61d0d092922d2a43bb00e4d40e118ed95 /usr.bin/wall/ttymsg.c
parentef082b516fe84e3dbb06d3725ab3a12dac39e924 (diff)
do S_IWGRP checking just like write(1)
Diffstat (limited to 'usr.bin/wall/ttymsg.c')
-rw-r--r--usr.bin/wall/ttymsg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c
index 5f1545b5e1b..6fe3f9ebb30 100644
--- a/usr.bin/wall/ttymsg.c
+++ b/usr.bin/wall/ttymsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttymsg.c,v 1.4 1998/11/18 01:03:16 deraadt Exp $ */
+/* $OpenBSD: ttymsg.c,v 1.5 1998/11/18 02:57:22 deraadt Exp $ */
/* $NetBSD: ttymsg.c,v 1.3 1994/11/17 07:17:55 jtc Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ttymsg.c 8.2 (Berkeley) 11/16/93";
#endif
-static char rcsid[] = "$OpenBSD: ttymsg.c,v 1.4 1998/11/18 01:03:16 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ttymsg.c,v 1.5 1998/11/18 02:57:22 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -73,6 +73,7 @@ ttymsg(iov, iovcnt, line, tmout)
register int cnt, fd, left, wret;
struct iovec localiov[6];
int forked = 0;
+ struct stat st;
if (iovcnt > sizeof(localiov) / sizeof(localiov[0]))
return ("too many iov's (change code in wall/ttymsg.c)");
@@ -92,6 +93,11 @@ ttymsg(iov, iovcnt, line, tmout)
return (errbuf);
}
+ if (stat(device, &st) < 0)
+ return (NULL);
+ if ((st.st_mode & S_IWGRP) == 0)
+ return (NULL);
+
seteuid(geteuid());
/*