From 6155eb0850b4c91a5e9a80dc230cb1d12d5c4f8c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 18 Nov 2013 17:50:44 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/cerberus.c | 4 ++-- src/security.c | 8 ++++---- src/security.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/cerberus.c b/src/cerberus.c index ca4cf48..2199d7b 100644 --- a/src/cerberus.c +++ b/src/cerberus.c @@ -169,8 +169,8 @@ int main(int argc, char** argv) /* TODO login */ - /* Reset terminal ownership */ - chown_tty(0, 0, 0); + /* Reset terminal ownership and mode */ + chown_tty(0, -1, 0); return 0; } diff --git a/src/security.c b/src/security.c index 1dc8c8c..33342fc 100644 --- a/src/security.c +++ b/src/security.c @@ -38,7 +38,7 @@ void secure_tty(void) int fd, i; /* Set ownership of this TTY to root:root */ - chown_tty(0, 0, 1); + chown_tty(0, -1, 1); /* Get TTY name for last part of this functions */ tty_device = ttyname(STDIN_FILENO); @@ -74,11 +74,11 @@ void secure_tty(void) /** * Set ownership and mode of the TTY * - * @param owner The owner - * @param group The group + * @param owner The owner, -1 for unchanged + * @param group The group, -1 for unchanged * @param with_fail Abort on failure */ -void chown_tty(int owner, int group, int with_fail) +void chown_tty(uid_t owner, gid_t group, int with_fail) { struct vt_stat vtstat; diff --git a/src/security.h b/src/security.h index bbc0c4e..464afbf 100644 --- a/src/security.h +++ b/src/security.h @@ -41,9 +41,9 @@ void secure_tty(void); /** * Set ownership and mode of the TTY * - * @param owner The owner - * @param group The group + * @param owner The owner, -1 for unchanged + * @param group The group, -1 for unchanged * @param with_fail Abort on failure */ -void chown_tty(int owner, int group, int with_fail); +void chown_tty(uid_t owner, gid_t group, int with_fail); -- cgit v1.2.3-70-g09d2