Sebastian Kuschel reports that pfd_closing can be called for a socket
[u/mdw/putty] / unix / ux_x11.c
1 /*
2 * ux_x11.c: fetch local auth data for X forwarding.
3 */
4
5 #include <ctype.h>
6 #include <unistd.h>
7 #include <assert.h>
8 #include <stdlib.h>
9 #include <errno.h>
10
11 #include "putty.h"
12 #include "ssh.h"
13 #include "network.h"
14
15 void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
16 {
17 char *xauthfile;
18 int needs_free;
19
20 /*
21 * Find the .Xauthority file.
22 */
23 needs_free = FALSE;
24 xauthfile = getenv("XAUTHORITY");
25 if (!xauthfile) {
26 xauthfile = getenv("HOME");
27 if (xauthfile) {
28 xauthfile = dupcat(xauthfile, "/.Xauthority", NULL);
29 needs_free = TRUE;
30 }
31 }
32
33 if (xauthfile) {
34 x11_get_auth_from_authfile(disp, xauthfile);
35 if (needs_free)
36 sfree(xauthfile);
37 }
38 }
39
40 const int platform_uses_x11_unix_by_default = TRUE;