1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42:48 -05:00

A couple of X forwarding fixes for Unix Plink. Firstly, under Unix

the default X display should be whatever comes out of $DISPLAY,
rather than Windows's hardwired `localhost:0'. Secondly, this may
give rise to a display name without a hostname (`:0' or similar),
which we now need to be able to deal with. Of course, we still don't
_properly_ support X forwarding in Unix Plink, since we still can't
authenticate with the local display.

[originally from svn r2420]
This commit is contained in:
Simon Tatham
2003-01-02 10:45:56 +00:00
parent 368ead15bc
commit a298b2fe4b
2 changed files with 19 additions and 2 deletions

View File

@ -189,8 +189,16 @@ char *x11_init(Socket * s, char *display, void *c, void *auth)
displaynum = 0; /* sensible default */
if (n > sizeof(host) - 1)
n = sizeof(host) - 1;
strncpy(host, display, n);
host[n] = '\0';
if (n > 0) {
strncpy(host, display, n);
host[n] = '\0';
} else {
/*
* Local display numbers, particularly on Unix, often omit
* the display part completely.
*/
strcpy(host, "localhost");
}
/*
* Try to find host.