2 * ux_x11.c: fetch local auth data for X forwarding.
14 void platform_get_x11_auth(struct X11Display
*disp
, const Config
*cfg
)
20 * Upgrade an IP-style localhost display to a Unix-socket
23 if (!disp
->unixdomain
&& sk_address_is_local(disp
->addr
)) {
24 sk_addr_free(disp
->addr
);
25 disp
->unixdomain
= TRUE
;
26 disp
->addr
= platform_get_x11_unix_address(NULL
, disp
->displaynum
);
27 disp
->realhost
= dupprintf("unix:%d", disp
->displaynum
);
32 * Set the hostname for Unix-socket displays, so that we'll
33 * look it up correctly in the X authority file.
35 if (disp
->unixdomain
) {
38 sfree(disp
->hostname
);
42 disp
->hostname
= snewn(len
, char);
43 if (gethostname(disp
->hostname
, len
) < 0) {
44 disp
->hostname
= NULL
;
47 } while (strlen(disp
->hostname
) >= len
-1);
51 * Find the .Xauthority file.
54 xauthfile
= getenv("XAUTHORITY");
56 xauthfile
= getenv("HOME");
58 xauthfile
= dupcat(xauthfile
, "/.Xauthority", NULL
);
64 x11_get_auth_from_authfile(disp
, xauthfile
);
70 const int platform_uses_x11_unix_by_default
= TRUE
;