summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.com>2020-09-09 17:10:10 +0300
committerPekka Paalanen <pq@iki.fi>2020-12-11 10:18:19 +0000
commit4e9f4d04745049ca3d763f447bfd853a0e3532a9 (patch)
tree2b38781176cc6251eb9af7979b34a4aaf775771d
parent6aa46844a6b8856636dc52546f15fd2c45e9300d (diff)
launcher-direct: allow non-root on non-seat0
If the launcher is told to use a non-default seat (not seat0), there will not be a VT or tty to set up. VT/tty setup requires privileges. This patch allows a non-root user to use launcher-direct, provided that the seat is not the default. There is still the problem of opening DRM and input devices, which is left for the user to solve. This mode of operation is useful for developers who can set up a secondary seat on their machine. You can run Weston/DRM from a terminal window by pointing it to a non-default seat. You have to arrange a DRM device by having an extra unused graphics card in the machine. You also need dedicated input devices. Both the DRM device and the input devices must be assigned to the secondary seat and device file permissions adjusted so that they can be opened. Doing so is an obvious security risk, as input could easily be eavesdropped. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-rw-r--r--libweston/launcher-direct.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c
index c20d70f2..3bee27a2 100644
--- a/libweston/launcher-direct.c
+++ b/libweston/launcher-direct.c
@@ -127,6 +127,9 @@ setup_tty(struct launcher_direct *launcher, int tty)
char tty_device[32] ="<stdin>";
int ret, kd_mode;
+ if (geteuid() != 0)
+ return -1;
+
if (tty == 0) {
launcher->tty = dup(tty);
if (launcher->tty == -1) {
@@ -290,9 +293,6 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
{
struct launcher_direct *launcher;
- if (geteuid() != 0)
- return -EINVAL;
-
launcher = zalloc(sizeof(*launcher));
if (launcher == NULL)
return -ENOMEM;