X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/3d88e64dfcf5dc0fd361ce0c504c67a9196ce44c..1ec39db1a3abacdffebec535b86b4475301470cf:/unix/ux_x11.c diff --git a/unix/ux_x11.c b/unix/ux_x11.c index 47d0ef5f..e8d71959 100644 --- a/unix/ux_x11.c +++ b/unix/ux_x11.c @@ -4,7 +4,9 @@ #include #include +#include #include "putty.h" +#include "ssh.h" void platform_get_x11_auth(char *display, int *protocol, unsigned char *data, int *datalen) @@ -13,16 +15,21 @@ void platform_get_x11_auth(char *display, int *protocol, char *command; int maxsize = *datalen; char *localbuf; + int proto = -1; + display = x11_display(display); /* * Normally we should run `xauth list DISPLAYNAME'. However, * there's an oddity when the display is local: the display * `localhost:0' (or `:0') should become just `:0'. */ - if (!strncmp(display, "localhost:", 10)) - command = dupprintf("xauth list %s 2>/dev/null", display+9); + if (!strncmp(display, "localhost:", 10) + || !strncmp(display, "unix:", 5)) + command = dupprintf("xauth list %s 2>/dev/null", + strchr(display, ':')); else command = dupprintf("xauth list %s 2>/dev/null", display); + sfree(display); fp = popen(command, "r"); sfree(command); @@ -36,7 +43,7 @@ void platform_get_x11_auth(char *display, int *protocol, * Read a line from stdin, and attempt to parse it into a * display name (ignored), auth protocol, and auth string. */ - int c, i, hexdigit, proto; + int c, i, hexdigit; char protoname[64]; /* Skip the display name. */