mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
X forwarding changes:
- new function platform_get_x_display() to find a sensible local display. On Unix, the Gtk apps weren't taking account of --display when determining where to send forwarded X traffic. - explicitly document that leaving X display location blank in config tries to do something sensible (and that it's now blank by default) - don't override X11Display setting in plink, since that's more properly done later [originally from svn r4604]
This commit is contained in:
parent
e375ba107d
commit
98028c746f
@ -1,4 +1,4 @@
|
|||||||
\versionid $Id: config.but,v 1.91 2004/10/02 00:33:27 jacob Exp $
|
\versionid $Id: config.but,v 1.92 2004/10/06 22:31:07 jacob Exp $
|
||||||
|
|
||||||
\C{config} Configuring PuTTY
|
\C{config} Configuring PuTTY
|
||||||
|
|
||||||
@ -2106,10 +2106,10 @@ forwarding allows you to securely give those applications access to
|
|||||||
a local X display on your PC.
|
a local X display on your PC.
|
||||||
|
|
||||||
To enable X11 forwarding, check the \q{Enable X11 forwarding} box.
|
To enable X11 forwarding, check the \q{Enable X11 forwarding} box.
|
||||||
If your X display is not the primary display on your local machine
|
If your X display is somewhere unusual, you will need to enter its
|
||||||
(which it almost certainly will be unless you have deliberately
|
location in the \q{X display location} box; if this is left blank,
|
||||||
arranged otherwise), you need to enter its location in the \q{X
|
PuTTY try to find a sensible default in the environment, or use the
|
||||||
display location} box.
|
primary local display (\c{:0}) if that fails.
|
||||||
|
|
||||||
See \k{using-x-forwarding} for more information about X11
|
See \k{using-x-forwarding} for more information about X11
|
||||||
forwarding.
|
forwarding.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
\versionid $Id: using.but,v 1.32 2004/09/22 22:15:25 jacob Exp $
|
\versionid $Id: using.but,v 1.33 2004/10/06 22:31:07 jacob Exp $
|
||||||
|
|
||||||
\C{using} Using PuTTY
|
\C{using} Using PuTTY
|
||||||
|
|
||||||
@ -304,9 +304,10 @@ does do.
|
|||||||
|
|
||||||
You should then tick the \q{Enable X11 forwarding} box in the
|
You should then tick the \q{Enable X11 forwarding} box in the
|
||||||
Tunnels panel (see \k{config-ssh-x11}) before starting your SSH
|
Tunnels panel (see \k{config-ssh-x11}) before starting your SSH
|
||||||
session. The \q{X display location} box reads \c{localhost:0} by
|
session. The \q{X display location} box is blank by default, which
|
||||||
default, which is the usual display location where your X server
|
means that PuTTY will try to use a sensible default such as \c{:0},
|
||||||
will be installed. If that needs changing, then change it.
|
which is the usual display location where your X server will be
|
||||||
|
installed. If that needs changing, then change it.
|
||||||
|
|
||||||
Now you should be able to log in to the SSH server as normal. To
|
Now you should be able to log in to the SSH server as normal. To
|
||||||
check that X forwarding has been successfully negotiated during
|
check that X forwarding has been successfully negotiated during
|
||||||
|
2
ssh.h
2
ssh.h
@ -298,6 +298,8 @@ extern const char platform_x11_best_transport[];
|
|||||||
/* best X11 hostname for this platform if none specified */
|
/* best X11 hostname for this platform if none specified */
|
||||||
SockAddr platform_get_x11_unix_address(int displaynum, char **canonicalname);
|
SockAddr platform_get_x11_unix_address(int displaynum, char **canonicalname);
|
||||||
/* make up a SockAddr naming the address for displaynum */
|
/* make up a SockAddr naming the address for displaynum */
|
||||||
|
char *platform_get_x_display(void);
|
||||||
|
/* allocated local X display string, if any */
|
||||||
|
|
||||||
Bignum copybn(Bignum b);
|
Bignum copybn(Bignum b);
|
||||||
Bignum bn_power_2(int n);
|
Bignum bn_power_2(int n);
|
||||||
|
@ -119,5 +119,3 @@ void platform_get_x11_auth(char *display, int *protocol,
|
|||||||
pclose(fp);
|
pclose(fp);
|
||||||
sfree(localbuf);
|
sfree(localbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char platform_x11_best_transport[] = "unix";
|
|
||||||
|
@ -318,3 +318,13 @@ int is_interactive(void)
|
|||||||
{
|
{
|
||||||
return isatty(0);
|
return isatty(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* X11-forwarding-related things suitable for console.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char platform_x11_best_transport[] = "unix";
|
||||||
|
|
||||||
|
char *platform_get_x_display(void) {
|
||||||
|
return dupstr(getenv("DISPLAY"));
|
||||||
|
}
|
||||||
|
@ -73,8 +73,6 @@ static Config cfg;
|
|||||||
*/
|
*/
|
||||||
char *platform_default_s(const char *name)
|
char *platform_default_s(const char *name)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "X11Display"))
|
|
||||||
return dupstr(getenv("DISPLAY"));
|
|
||||||
if (!strcmp(name, "TermType"))
|
if (!strcmp(name, "TermType"))
|
||||||
return dupstr(getenv("TERM"));
|
return dupstr(getenv("TERM"));
|
||||||
if (!strcmp(name, "UserName"))
|
if (!strcmp(name, "UserName"))
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <gdk/gdk.h>
|
||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
@ -105,6 +106,21 @@ char *make_default_wintitle(char *hostname)
|
|||||||
return dupcat(hostname, " - PuTTY", NULL);
|
return dupcat(hostname, " - PuTTY", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* X11-forwarding-related things suitable for Gtk app.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char platform_x11_best_transport[] = "unix";
|
||||||
|
|
||||||
|
char *platform_get_x_display(void) {
|
||||||
|
const char *display;
|
||||||
|
/* Try to take account of --display and what have you. */
|
||||||
|
if (!(display = gdk_get_display()))
|
||||||
|
/* fall back to traditional method */
|
||||||
|
display = getenv("DISPLAY");
|
||||||
|
return dupstr(display);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
extern int pt_main(int argc, char **argv);
|
extern int pt_main(int argc, char **argv);
|
||||||
|
@ -34,8 +34,6 @@ void platform_get_x11_auth(char *display, int *protocol,
|
|||||||
/* Do nothing, therefore no auth. */
|
/* Do nothing, therefore no auth. */
|
||||||
}
|
}
|
||||||
|
|
||||||
const char platform_x11_best_transport[] = "unix";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default settings that are specific to PSFTP.
|
* Default settings that are specific to PSFTP.
|
||||||
*/
|
*/
|
||||||
|
@ -16,6 +16,11 @@ void platform_get_x11_auth(char *display, int *proto,
|
|||||||
|
|
||||||
const char platform_x11_best_transport[] = "localhost";
|
const char platform_x11_best_transport[] = "localhost";
|
||||||
|
|
||||||
|
char *platform_get_x_display(void) {
|
||||||
|
/* We may as well check for DISPLAY in case it's useful. */
|
||||||
|
return dupstr(getenv("DISPLAY"));
|
||||||
|
}
|
||||||
|
|
||||||
Filename filename_from_str(const char *str)
|
Filename filename_from_str(const char *str)
|
||||||
{
|
{
|
||||||
Filename ret;
|
Filename ret;
|
||||||
|
25
x11fwd.c
25
x11fwd.c
@ -1,3 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Platform-independent bits of X11 forwarding.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -228,14 +232,21 @@ int x11_get_screen_number(char *display)
|
|||||||
|
|
||||||
/* Find the right display, returns an allocated string */
|
/* Find the right display, returns an allocated string */
|
||||||
char *x11_display(const char *display) {
|
char *x11_display(const char *display) {
|
||||||
if(!display || !*display)
|
char *ret;
|
||||||
if(!(display = getenv("DISPLAY")))
|
if(!display || !*display) {
|
||||||
display = ":0";
|
/* try to find platform-specific local display */
|
||||||
if(display[0] == ':') {
|
if(!(ret = platform_get_x_display()))
|
||||||
/* no transport specified, use whatever we think is best */
|
/* plausible default for all platforms */
|
||||||
return dupcat(platform_x11_best_transport, display, (char *)0);
|
ret = dupstr(":0");
|
||||||
} else
|
} else
|
||||||
return dupstr(display);
|
ret = dupstr(display);
|
||||||
|
if(ret[0] == ':') {
|
||||||
|
/* no transport specified, use whatever we think is best */
|
||||||
|
char *s = dupcat(platform_x11_best_transport, display, (char *)0);
|
||||||
|
sfree(ret);
|
||||||
|
return s;
|
||||||
|
} else
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user