diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2014-09-03 18:55:08 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2014-09-03 18:55:08 +0000 |
commit | b5ad88ddb796bef23cc61631cf5ce51c3fe41f81 (patch) | |
tree | 165c1085c602d82427450d7059ee8e3022125432 /usr.bin | |
parent | 2dbfdf16737db51001d6a75042ed25ba8bcaea06 (diff) |
tighten permissions on pty when the "tty" group does not exist;
pointed out by Corinna Vinschen; ok markus
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sshpty.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.bin/ssh/sshpty.c b/usr.bin/ssh/sshpty.c index eb48969d78c..a2ac1d7b578 100644 --- a/usr.bin/ssh/sshpty.c +++ b/usr.bin/ssh/sshpty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshpty.c,v 1.28 2007/09/11 23:49:09 stevesk Exp $ */ +/* $OpenBSD: sshpty.c,v 1.29 2014/09/03 18:55:07 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -141,13 +141,8 @@ pty_setowner(struct passwd *pw, const char *tty) /* Determine the group to make the owner of the tty. */ grp = getgrnam("tty"); - if (grp) { - gid = grp->gr_gid; - mode = S_IRUSR | S_IWUSR | S_IWGRP; - } else { - gid = pw->pw_gid; - mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; - } + gid = (grp != NULL) ? grp->gr_gid : pw->pw_gid; + mode = (grp != NULL) ? 0622 : 0600; /* * Change owner and mode of the tty as required. |