[PATCH] Add -xkbcompdir parameter to modify "xkbcomp" path from commandline.

Adam Tkac atkac at redhat.com
Wed Sep 8 09:06:17 PDT 2010


Hello,

this message belongs to thread
http://lists.x.org/archives/xorg-devel/2010-September/012519.html.

Improved patch addresses issue with the SUID servers.

Reason why I need -xkbcompdir parameter is that in TigerVNC upstream
we ship prebuilt Xvnc server. Different distributions can have
different locations of the xkbcomp utility so when we, for example,
compile Xvnc with hardcoded "/usr/bin/xkbcomp" path then it's
impossible to start this precompiled Xvnc with xkbcomp somewhere in
/opt/* or in /usr/local/bin/.

I would like to ask you to reconsider your nack, please, improved
patch is attached.

Regards, Adam

-- 
Adam Tkac, Red Hat, Inc.
-------------- next part --------------
Subject: [PATCH 2/2] Add -xkbcompdir parameter to modify "xkbcomp" path from commandline.

Signed-off-by: Adam Tkac <atkac at redhat.com>
---
 xkb/xkbInit.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index fbf8f14..29fb33e 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -742,7 +742,28 @@ XkbProcessArguments(int argc,char *argv[],int i)
 	    }
 	}
 	return j;
+    } else if (strncmp(argv[i], "-xkbcompdir", 11)==0) {
+	if (++i < argc) {
+#if !defined(WIN32) && !defined(__CYGWIN__)
+            if (getuid() != geteuid()) {
+                LogMessage(X_WARNING, "-xkbcompdir is not available for setuid X servers\n");
+                return -1;
+            } else
+#endif
+	    {
+		if (strlen(argv[i]) < PATH_MAX) {
+		    XkbBinDirectory = argv[i];
+		    return 2;
+		} else {
+		    LogMessage(X_ERROR, "-xkbcompdir pathname too long\n");
+		    return -1;
+		}
+	    }
+	} else {
+	    return -1;
+	}
     }
+
     if ((strcmp(argv[i], "-ardelay") == 0) ||
         (strcmp (argv[i], "-ar1") == 0)) {	/* -ardelay int */
 	if (++i >= argc) UseMsg ();
-- 
1.7.2.2



More information about the xorg-devel mailing list