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>
dev
Pekka Paalanen 4 years ago committed by Pekka Paalanen
parent 6aa46844a6
commit 4e9f4d0474
  1. 6
      libweston/launcher-direct.c

@ -127,6 +127,9 @@ setup_tty(struct launcher_direct *launcher, int tty)
char tty_device[32] ="<stdin>"; char tty_device[32] ="<stdin>";
int ret, kd_mode; int ret, kd_mode;
if (geteuid() != 0)
return -1;
if (tty == 0) { if (tty == 0) {
launcher->tty = dup(tty); launcher->tty = dup(tty);
if (launcher->tty == -1) { if (launcher->tty == -1) {
@ -290,9 +293,6 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
{ {
struct launcher_direct *launcher; struct launcher_direct *launcher;
if (geteuid() != 0)
return -EINVAL;
launcher = zalloc(sizeof(*launcher)); launcher = zalloc(sizeof(*launcher));
if (launcher == NULL) if (launcher == NULL)
return -ENOMEM; return -ENOMEM;

Loading…
Cancel
Save