Skip to content
Permalink
Browse files
upstream commit
tighten permissions on pty when the "tty" group does
 not exist; pointed out by Corinna Vinschen; ok markus
  • Loading branch information
djmdjm committed Oct 13, 2014
1 parent 180bcb4 commit a5883d4
Showing 1 changed file with 3 additions and 8 deletions.
@@ -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
@@ -196,13 +196,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.

0 comments on commit a5883d4

Please sign in to comment.