mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 02:46:58 +00:00
Merge pull request #201 from mkj/test-pty-gid
Allow users's own gid in pty permission check
This commit is contained in:
commit
6fa49f98c5
4
sshpty.c
4
sshpty.c
@ -380,7 +380,9 @@ pty_setowner(struct passwd *pw, const char *tty_name)
|
|||||||
tty_name, strerror(errno));
|
tty_name, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
|
/* Allow either "tty" gid or user's own gid. On Linux with openpty()
|
||||||
|
* this varies depending on the devpts mount options */
|
||||||
|
if (st.st_uid != pw->pw_uid || !(st.st_gid == gid || st.st_gid == pw->pw_gid)) {
|
||||||
if (chown(tty_name, pw->pw_uid, gid) < 0) {
|
if (chown(tty_name, pw->pw_uid, gid) < 0) {
|
||||||
if (errno == EROFS &&
|
if (errno == EROFS &&
|
||||||
(st.st_uid == pw->pw_uid || st.st_uid == 0)) {
|
(st.st_uid == pw->pw_uid || st.st_uid == 0)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user