summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2016-02-17 21:52:07 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2016-02-17 21:52:07 +0000
commita25990d84abf079293ebc30d9008ff5787b0b54e (patch)
treeba9fa0ac4037a30188cc3af81a84c97346feeca9 /sys/kern
parenta80f7843d5562492cd0e090d2466f937afe217f4 (diff)
Return ENOTTY for TIOCFLUSH when allowed by pledge but the fd is
not a tty. Fixes a pledge failure in telnet when piping the output. OK deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_pledge.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_pledge.c b/sys/kern/kern_pledge.c
index 3434877b95e..e682b56b7b3 100644
--- a/sys/kern/kern_pledge.c
+++ b/sys/kern/kern_pledge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_pledge.c,v 1.148 2016/01/19 07:31:48 ratchov Exp $ */
+/* $OpenBSD: kern_pledge.c,v 1.149 2016/02/17 21:52:06 millert Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -1290,6 +1290,7 @@ pledge_ioctl(struct proc *p, long com, struct file *fp)
if ((p->p_p->ps_pledge & PLEDGE_PROC) == 0)
break;
/* FALLTHROUGH */
+ case TIOCFLUSH: /* getty, telnet */
case TIOCGPGRP:
case TIOCGETA:
case TIOCGWINSZ: /* ENOTTY return for non-tty */
@@ -1306,7 +1307,6 @@ pledge_ioctl(struct proc *p, long com, struct file *fp)
case TIOCSETA: /* cu, ... */
case TIOCSETAW: /* cu, ... */
case TIOCSETAF: /* tcsetattr TCSAFLUSH, script */
- case TIOCFLUSH: /* getty */
case TIOCSCTTY: /* forkpty(3), login_tty(3), ... */
if (fp->f_type == DTYPE_VNODE && (vp->v_flag & VISTTY))
return (0);