Module Name:    src
Committed By:   christos
Date:           Sat Oct  1 03:46:00 UTC 2016

Modified Files:
        src/sys/kern: tty.c

Log Message:
Weaken the test a bit to still allow non-root to use TIOCSTI; we need to have
the same creds as the session leader process for the tty session.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/kern/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.272 src/sys/kern/tty.c:1.273
--- src/sys/kern/tty.c:1.272	Thu Sep 29 17:46:32 2016
+++ src/sys/kern/tty.c	Fri Sep 30 23:46:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.272 2016/09/29 21:46:32 christos Exp $	*/
+/*	$NetBSD: tty.c,v 1.273 2016/10/01 03:46:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.272 2016/09/29 21:46:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.273 2016/10/01 03:46:00 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1246,6 +1246,9 @@ ttioctl(struct tty *tp, u_long cmd, void
 				return EPERM;
 			if (!isctty(p, tp))
 				return EACCES;
+			if (!proc_uidmatch(tp->t_session->s_leader->p_cred,
+			    p->p_cred))
+				return error;
 			return error;
 		}
 		(*tp->t_linesw->l_rint)(*(u_char *)data, tp);

Reply via email to