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
This commit is contained in:
parent
bc166aa6b4
commit
eac227a203
@ -565,6 +565,23 @@ prepare_auth_file (MetaXWaylandManager *manager)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user