Sebastian Kuschel reports that pfd_closing can be called for a socket
[u/mdw/putty] / unix / ux_x11.c
CommitLineData
e0e7dff8 1/*
2 * ux_x11.c: fetch local auth data for X forwarding.
3 */
4
5#include <ctype.h>
6#include <unistd.h>
fc0f17db 7#include <assert.h>
8def70c3 8#include <stdlib.h>
2726fc15 9#include <errno.h>
8def70c3 10
e0e7dff8 11#include "putty.h"
fc0f17db 12#include "ssh.h"
8def70c3 13#include "network.h"
e0e7dff8 14
4a693cfc 15void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
e0e7dff8 16{
8def70c3 17 char *xauthfile;
18 int needs_free;
e0e7dff8 19
9939292a 20 /*
8def70c3 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 }
e0e7dff8 32
8def70c3 33 if (xauthfile) {
34 x11_get_auth_from_authfile(disp, xauthfile);
35 if (needs_free)
36 sfree(xauthfile);
e0e7dff8 37 }
e0e7dff8 38}
8def70c3 39
40const int platform_uses_x11_unix_by_default = TRUE;