mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-21 22:28:37 -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:
parent
368ead15bc
commit
a298b2fe4b
@ -598,8 +598,17 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
|
|||||||
gppi(sesskey, "BCE", 1, &cfg->bce);
|
gppi(sesskey, "BCE", 1, &cfg->bce);
|
||||||
gppi(sesskey, "BlinkText", 0, &cfg->blinktext);
|
gppi(sesskey, "BlinkText", 0, &cfg->blinktext);
|
||||||
gppi(sesskey, "X11Forward", 0, &cfg->x11_forward);
|
gppi(sesskey, "X11Forward", 0, &cfg->x11_forward);
|
||||||
|
#ifdef _WINDOWS
|
||||||
gpps(sesskey, "X11Display", "localhost:0", cfg->x11_display,
|
gpps(sesskey, "X11Display", "localhost:0", cfg->x11_display,
|
||||||
sizeof(cfg->x11_display));
|
sizeof(cfg->x11_display));
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
/* On Unix, the default X display should simply be $DISPLAY. */
|
||||||
|
char *disp = getenv("DISPLAY");
|
||||||
|
gpps(sesskey, "X11Display", disp, cfg->x11_display,
|
||||||
|
sizeof(cfg->x11_display));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
|
gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
|
||||||
gppi(sesskey, "RemotePortAcceptAll", 0, &cfg->rport_acceptall);
|
gppi(sesskey, "RemotePortAcceptAll", 0, &cfg->rport_acceptall);
|
||||||
|
12
x11fwd.c
12
x11fwd.c
@ -189,8 +189,16 @@ char *x11_init(Socket * s, char *display, void *c, void *auth)
|
|||||||
displaynum = 0; /* sensible default */
|
displaynum = 0; /* sensible default */
|
||||||
if (n > sizeof(host) - 1)
|
if (n > sizeof(host) - 1)
|
||||||
n = sizeof(host) - 1;
|
n = sizeof(host) - 1;
|
||||||
strncpy(host, display, n);
|
if (n > 0) {
|
||||||
host[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.
|
* Try to find host.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user