2 * ux_x11.c: fetch local auth data for X forwarding.
15 void platform_get_x11_auth(struct X11Display *disp, const Config *cfg)
21 * Upgrade an IP-style localhost display to a Unix-socket
24 if (!disp->unixdomain && sk_address_is_local(disp->addr)) {
25 sk_addr_free(disp->addr);
26 disp->unixdomain = TRUE;
27 disp->addr = platform_get_x11_unix_address(NULL, disp->displaynum);
28 disp->realhost = dupprintf("unix:%d", disp->displaynum);
33 * Set the hostname for Unix-socket displays, so that we'll
34 * look it up correctly in the X authority file.
36 if (disp->unixdomain) {
39 sfree(disp->hostname);
43 disp->hostname = snewn(len, char);
44 if ((gethostname(disp->hostname, len) < 0) &&
45 (errno != ENAMETOOLONG)) {
46 disp->hostname = NULL;
49 } while (strlen(disp->hostname) >= len-1);
53 * Find the .Xauthority file.
56 xauthfile = getenv("XAUTHORITY");
58 xauthfile = getenv("HOME");
60 xauthfile = dupcat(xauthfile, "/.Xauthority", NULL);
66 x11_get_auth_from_authfile(disp, xauthfile);
72 const int platform_uses_x11_unix_by_default = TRUE;