File lightdm-xauthlocalhostname-support.patch of Package lightdm
Set XAUTHLOCALHOSTNAME to the hostname for local logins to avoid issues in the
session in case the hostname changes.
--- a/src/seat-local.c
+++ b/src/seat-local.c
@@ -452,6 +452,7 @@ seat_local_run_script (Seat *seat, Displ
path = x_server_local_get_authority_file_path (x_server);
process_set_env (script, "DISPLAY", x_server_get_address (X_SERVER (x_server)));
process_set_env (script, "XAUTHORITY", path);
+ process_set_env (script, "XAUTHLOCALHOSTNAME", g_get_host_name ());
}
SEAT_CLASS (seat_local_parent_class)->run_script (seat, display_server, script);
--- a/src/x-authority.c
+++ b/src/x-authority.c
@@ -70,9 +70,9 @@ x_authority_new_cookie (guint16 family,
XAuthority *
x_authority_new_local_cookie (const gchar *number)
{
- gchar hostname[1024];
+ const gchar *hostname;
- gethostname (hostname, 1024);
+ hostname = g_get_host_name ();
return x_authority_new_cookie (XAUTH_FAMILY_LOCAL, (guint8 *) hostname, strlen (hostname), number);
}
--- a/src/x-server.c
+++ b/src/x-server.c
@@ -15,6 +15,7 @@
#include "x-server.h"
#include "configuration.h"
+#include "x-server-local.h"
struct XServerPrivate
{
@@ -154,6 +155,8 @@ x_server_connect_session (DisplayServer
else
l_debug (session, "Not setting XDG_VTNR");
+ if (IS_X_SERVER_LOCAL (display_server))
+ session_set_env (session, "XAUTHLOCALHOSTNAME", g_get_host_name ());
session_set_env (session, "DISPLAY", x_server_get_address (X_SERVER (display_server)));
session_set_xdisplay (session, x_server_get_address (X_SERVER (display_server)));
session_set_remote_host_name (session, x_server_get_hostname (X_SERVER (display_server)));