xfree86/linux: don't change VT perms unless we're running as root
In non-setuid root installations, we shouldn't try to adjust VT/tty ownership. It will fail, and shouldn't be necessary anyway (since startup scripts or PAM should be handling perms for us in that case). Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
41884b8f4d
commit
d225230148
|
@ -74,9 +74,11 @@ saveVtPerms(void)
|
||||||
static void
|
static void
|
||||||
restoreVtPerms(void)
|
restoreVtPerms(void)
|
||||||
{
|
{
|
||||||
/* Set the terminal permissions back to before we started. */
|
if (geteuid() == 0) {
|
||||||
chown("/dev/tty0", vtPermSave[0], vtPermSave[1]);
|
/* Set the terminal permissions back to before we started. */
|
||||||
chown(vtname, vtPermSave[2], vtPermSave[3]);
|
(void)chown("/dev/tty0", vtPermSave[0], vtPermSave[1]);
|
||||||
|
(void)chown(vtname, vtPermSave[2], vtPermSave[3]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *console_handler;
|
static void *console_handler;
|
||||||
|
@ -184,20 +186,22 @@ xf86OpenConsole(void)
|
||||||
xf86Msg(X_WARNING,
|
xf86Msg(X_WARNING,
|
||||||
"xf86OpenConsole: Could not save ownership of VT\n");
|
"xf86OpenConsole: Could not save ownership of VT\n");
|
||||||
|
|
||||||
/* change ownership of the vt */
|
if (geteuid() == 0) {
|
||||||
if (chown(vtname, getuid(), getgid()) < 0)
|
/* change ownership of the vt */
|
||||||
xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
|
if (chown(vtname, getuid(), getgid()) < 0)
|
||||||
vtname, strerror(errno));
|
xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
|
||||||
|
vtname, strerror(errno));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the current VT device we're running on is not "console", we want
|
* the current VT device we're running on is not
|
||||||
* to grab all consoles too
|
* "console", we want to grab all consoles too
|
||||||
*
|
*
|
||||||
* Why is this needed??
|
* Why is this needed??
|
||||||
*/
|
*/
|
||||||
if (chown("/dev/tty0", getuid(), getgid()) < 0)
|
if (chown("/dev/tty0", getuid(), getgid()) < 0)
|
||||||
xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
|
xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user