mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-16 08:30:28 +01:00
xkb: check permissions on XKM_OUTPUT_DIR
Checking just for root is insufficient since that does not guarantee write/read
permissions in XKM_OUTPUT_DIR (for example with sandbox).
Check if we can write a file, as well as read it later. Otherwise, invoke the
fallback to /tmp
Signed-off-by: Nirbheek Chauhan <nirbheek@gentoo.org>
Signed-off-by: Rémi Cardona <remi@gentoo.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9bc7cbf9c0)
This commit is contained in:
parent
616c7a009d
commit
80735dbf56
1 changed files with 2 additions and 3 deletions
|
|
@ -158,10 +158,9 @@ OutputDirectory(
|
|||
size_t size)
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size))
|
||||
/* Can we write an xkm and then open it too? */
|
||||
if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 && (strlen(XKM_OUTPUT_DIR) < size))
|
||||
{
|
||||
/* if server running as root it *may* be able to write */
|
||||
/* FIXME: check whether directory is writable at all */
|
||||
(void) strcpy (outdir, XKM_OUTPUT_DIR);
|
||||
} else
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue