summaryrefslogtreecommitdiff
path: root/sys/kern/subr_log.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-31 20:42:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-31 20:42:33 +0000
commita92a8621636869003cc7fada3282dabf8e2908d8 (patch)
tree021ef70139e06dead02f634e58755fca23983d72 /sys/kern/subr_log.c
parent05848e415adc11c00256a98bcdc331082dfef00a (diff)
for non-tty TIOCSPGRP/F_SETOWN/FIOSETOWN pgid setting calls, store uid
and euid as well, then deliver them using new csignal() interface which ensures that pgid setting process is permitted to signal the pgid process(es). Thanks to newsham@aloha.net for extensive help and discussion.
Diffstat (limited to 'sys/kern/subr_log.c')
-rw-r--r--sys/kern/subr_log.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index d874fe87a3f..29cf214531e 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_log.c,v 1.3 1996/04/21 22:27:17 deraadt Exp $ */
+/* $OpenBSD: subr_log.c,v 1.4 1997/08/31 20:42:20 deraadt Exp $ */
/* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */
/*
@@ -60,6 +60,8 @@ struct logsoftc {
int sc_state; /* see above for possibilities */
struct selinfo sc_selp; /* process waiting on select call */
int sc_pgid; /* process/group for async I/O */
+ uid_t sc_siguid; /* uid for process that set sc_pgid */
+ uid_t sc_sigeuid; /* euid for process that set sc_pgid */
} logsoftc;
int log_open; /* also used in log() */
@@ -179,17 +181,12 @@ logselect(dev, rw, p)
void
logwakeup()
{
- struct proc *p;
-
if (!log_open)
return;
selwakeup(&logsoftc.sc_selp);
- if (logsoftc.sc_state & LOG_ASYNC) {
- if (logsoftc.sc_pgid < 0)
- gsignal(-logsoftc.sc_pgid, SIGIO);
- else if ((p = pfind(logsoftc.sc_pgid)) != NULL)
- psignal(p, SIGIO);
- }
+ if (logsoftc.sc_state & LOG_ASYNC)
+ csignal(logsoftc.sc_pgid, SIGIO,
+ logsoftc.sc_siguid, logsoftc.sc_sigeuid);
if (logsoftc.sc_state & LOG_RDWAIT) {
wakeup((caddr_t)msgbufp);
logsoftc.sc_state &= ~LOG_RDWAIT;
@@ -232,6 +229,8 @@ logioctl(dev, com, data, flag, p)
case TIOCSPGRP:
logsoftc.sc_pgid = *(int *)data;
+ logsoftc.sc_siguid = p->p_cred->p_ruid;
+ logsoftc.sc_sigeuid = p->p_ucred->cr_uid;
break;
case TIOCGPGRP: