downstream: allow regular users to launch Weston
authorStephane Desneux <stephane.desneux@open.eurogiciel.org>
Thu, 25 Sep 2014 01:42:25 +0000 (03:42 +0200)
committerJan Ekström <jan.ekstrom@intel.com>
Thu, 4 Dec 2014 11:31:52 +0000 (13:31 +0200)
Change-Id: I04ac3457aebdcd629ee70e6915f71bce89f9cea8
Author:    Stephane Desneux <stephane.desneux@open.eurogiciel.org>
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
configure.ac
src/launcher-util.c

index 05e883d..abaa945 100644 (file)
@@ -83,6 +83,12 @@ if test x$enable_xkbcommon = xyes; then
        COMPOSITOR_MODULES="$COMPOSITOR_MODULES xkbcommon >= 0.3.0"
 fi
 
+AC_ARG_ENABLE(sys-uid, [  --enable-sys-uid],,
+              enable_sys_uid=no)
+if test x$enable_sys_uid = xyes; then
+       AC_DEFINE(ENABLE_SYS_UID, [1], [Allow regular users to launch Weston])
+fi
+
 AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
              enable_setuid_install=yes)
 AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes)
index ac764dc..fdf4967 100644 (file)
@@ -409,7 +409,11 @@ weston_launcher_connect(struct weston_compositor *compositor, int tty,
                                          seat_id, tty);
                if (r < 0) {
                        launcher->logind = NULL;
+#ifdef ENABLE_SYS_UID
+                       if (geteuid() <= 499) { /* 499 = SYS_UID_MAX in login.defs, but it should be parsed */
+#else
                        if (geteuid() == 0) {
+#endif
                                if (setup_tty(launcher, tty) == -1) {
                                        free(launcher);
                                        return NULL;