summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2019-08-19 15:50:54 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2019-08-19 17:14:40 +0200
commiteac227a203dba4d45398dfb85ec5b4610b5f3be7 (patch)
treef8ff616c55e6ee2e0211e79d01637ad620ee1961
parentbc166aa6b44bd08714cfe42430741a3ad18b8c9c (diff)
downloadmutter-eac227a203dba4d45398dfb85ec5b4610b5f3be7.tar.gz
xwayland: Add local user to xhost
With the addition of xauth support (commit a8984a81c), Xwayland would rely only on the provided cookies for authentication. As a result, running an Xclient from another VT (hence without the XAUTHORITY environment variable set) would result in an access denied. The same on X11 is granted because the local user is automatically granted access to Xserver by the startup scripts. Add the local user to xhost at startup on Xwayland so that the user can still run a client by setting the DISPLAY as long as it's the same user on the same host. https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
-rw-r--r--src/wayland/meta-xwayland.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index a7b44453a..948f26518 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -566,6 +566,23 @@ prepare_auth_file (MetaXWaylandManager *manager)
}
static void
+add_local_user_to_xhost (Display *xdisplay)
+{
+ XHostAddress host_entry;
+ XServerInterpretedAddress siaddr;
+
+ siaddr.type = (char *) "localuser";
+ siaddr.typelength = strlen (siaddr.type);
+ siaddr.value = (char *) g_get_user_name();
+ siaddr.valuelength = strlen (siaddr.value);
+
+ host_entry.family = FamilyServerInterpreted;
+ host_entry.address = (char *) &siaddr;
+
+ XAddHost (xdisplay, &host_entry);
+}
+
+static void
xserver_finished_init (MetaXWaylandManager *manager)
{
/* At this point xwayland is all setup to start accepting
@@ -808,6 +825,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
g_signal_connect (display, "x11-display-closing",
G_CALLBACK (on_x11_display_closing), NULL);
meta_xwayland_init_dnd (xdisplay);
+ add_local_user_to_xhost (xdisplay);
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND)
{