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
);
40 disp
->hostname
= NULL
;
44 disp
->hostname
= sresize(disp
->hostname
, len
, char);
45 if ((gethostname(disp
->hostname
, len
) < 0) &&
46 (errno
!= ENAMETOOLONG
)) {
47 sfree(disp
->hostname
);
48 disp
->hostname
= NULL
;
51 } while (strlen(disp
->hostname
) >= len
-1);
55 * Find the .Xauthority file.
58 xauthfile
= getenv("XAUTHORITY");
60 xauthfile
= getenv("HOME");
62 xauthfile
= dupcat(xauthfile
, "/.Xauthority", NULL
);
68 x11_get_auth_from_authfile(disp
, xauthfile
);
74 const int platform_uses_x11_unix_by_default
= TRUE
;