mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
Always reset ownership and permissions on TTY device nodes
During /bin/login phase the TTY device node is chowned and chmodded to the authenticated user. It will remain in this state until the next call to getty. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -286,6 +286,12 @@ static void prepare_tty(char *tty, speed_t speed, const char *procname, struct r
|
||||
char name[80];
|
||||
int fd, dummy;
|
||||
|
||||
/* Set proper protections and ownership */
|
||||
if (chown(tty, 0, 0))
|
||||
logit(LOG_ERR, "failed chowning 0:0 %s: %s", tty, strerror(errno));
|
||||
if (chmod(tty, 0620))
|
||||
logit(LOG_ERR, "failed chmoding 620 %s: %s", tty, strerror(errno));
|
||||
|
||||
fd = open(tty, O_RDWR);
|
||||
if (fd < 0) {
|
||||
logit(LOG_ERR, "Failed opening %s: %s", tty, strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user