upstream: fatal() if getgrnam() cannot find "tty"

OpenBSD-Commit-ID: d148c1c052fa0ed7d105b5428b5c1bab91630048
This commit is contained in:
[email protected] authored and Damien Miller committed 2019-07-05 11:15:30 +10:00
1 parent 48cccc275c
commit 8b4cc4bdc8
1 file changed
+3 -1
+3 -1
View File
@@ -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 <[email protected]>
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -171,6 +171,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;