2003-01-10 18:33:35 +00:00
|
|
|
/*
|
|
|
|
* ux_x11.c: fetch local auth data for X forwarding.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <unistd.h>
|
2004-05-31 14:01:52 +00:00
|
|
|
#include <assert.h>
|
2008-11-17 18:38:09 +00:00
|
|
|
#include <stdlib.h>
|
2009-01-05 01:01:58 +00:00
|
|
|
#include <errno.h>
|
2008-11-17 18:38:09 +00:00
|
|
|
|
2003-01-10 18:33:35 +00:00
|
|
|
#include "putty.h"
|
2004-05-31 14:01:52 +00:00
|
|
|
#include "ssh.h"
|
2008-11-17 18:38:09 +00:00
|
|
|
#include "network.h"
|
2003-01-10 18:33:35 +00:00
|
|
|
|
2008-11-17 18:38:09 +00:00
|
|
|
void platform_get_x11_auth(struct X11Display *disp, const Config *cfg)
|
2003-01-10 18:33:35 +00:00
|
|
|
{
|
2008-11-17 18:38:09 +00:00
|
|
|
char *xauthfile;
|
|
|
|
int needs_free;
|
2003-01-10 18:33:35 +00:00
|
|
|
|
2008-11-17 18:38:09 +00:00
|
|
|
/*
|
|
|
|
* Find the .Xauthority file.
|
|
|
|
*/
|
|
|
|
needs_free = FALSE;
|
|
|
|
xauthfile = getenv("XAUTHORITY");
|
|
|
|
if (!xauthfile) {
|
|
|
|
xauthfile = getenv("HOME");
|
|
|
|
if (xauthfile) {
|
|
|
|
xauthfile = dupcat(xauthfile, "/.Xauthority", NULL);
|
|
|
|
needs_free = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2003-01-10 18:33:35 +00:00
|
|
|
|
2008-11-17 18:38:09 +00:00
|
|
|
if (xauthfile) {
|
|
|
|
x11_get_auth_from_authfile(disp, xauthfile);
|
|
|
|
if (needs_free)
|
|
|
|
sfree(xauthfile);
|
2003-01-10 18:33:35 +00:00
|
|
|
}
|
|
|
|
}
|
2008-11-17 18:38:09 +00:00
|
|
|
|
|
|
|
const int platform_uses_x11_unix_by_default = TRUE;
|