xserver: Branch 'master'

Peter Hutterer whot at kemper.freedesktop.org
Thu Oct 1 02:28:03 PDT 2009


 xkb/ddxLoad.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 9bc7cbf9c02656982c2525836b5498993f708e02
Author: Nirbheek Chauhan <nirbheek at gentoo.org>
Date:   Tue Sep 29 22:35:06 2009 +0530

    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 at gentoo.org>
    Signed-off-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 6954dd1..ba8d50b 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -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


More information about the xorg-commit mailing list