From 44716a78aa42f999ac618cec1dc04ddb0c2c42e0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 18 Nov 2013 18:29:22 +0100 Subject: use tty group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/security.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/security.c') diff --git a/src/security.c b/src/security.c index af7df30..1e1dd9e 100644 --- a/src/security.c +++ b/src/security.c @@ -29,8 +29,10 @@ static inline void fail(char* str) /** * Secure the TTY from spying + * + * @param group The group, -1 for unchanged */ -void secure_tty(void) +void secure_tty(gid_t group) { struct termios tty; struct termios saved_tty; @@ -38,7 +40,7 @@ void secure_tty(void) int fd, i; /* Set ownership of this TTY to root:root */ - chown_tty(0, -1, 1); + chown_tty(0, group, 1); /* Get TTY name for last part of this functions */ tty_device = ttyname(STDIN_FILENO); @@ -80,7 +82,9 @@ void secure_tty(void) */ void chown_tty(uid_t owner, gid_t group, int with_fail) { + #if defined(OWN_VCSA) || defined(OWN_VCS) struct vt_stat vtstat; + #endif /* Set ownership of this TTY */ if (fchown(STDIN_FILENO, owner, group) && with_fail) -- cgit v1.2.3-70-g09d2