summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-04 16:20:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-04 16:20:11 +0000
commit6a9db0e175182fe8ff9b92c3e101ba0f1fc45d60 (patch)
treee7580988798cd8ba3ae2011329543fe0241cb06a
parent1bbc5e75071577b8e7ba811cd4b92d1dcc78cd67 (diff)
fatal() if getgrnam() cannot find "tty"
-rw-r--r--usr.bin/ssh/sshpty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshpty.c b/usr.bin/ssh/sshpty.c
index 5eeffb89d6e..faf8960cfb5 100644
--- a/usr.bin/ssh/sshpty.c
+++ b/usr.bin/ssh/sshpty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshpty.c,v 1.33 2019/07/04 16:16:51 deraadt Exp $ */
+/* $OpenBSD: sshpty.c,v 1.34 2019/07/04 16:20:10 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -141,6 +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 == NULL)
+ fatal("no tty group");
gid = (grp != NULL) ? grp->gr_gid : pw->pw_gid;
mode = (grp != NULL) ? 0620 : 0600;