View | Details | Raw Unified | Return to bug 2577
Collapse All | Expand All

(-)mux.c (-5 / +3 lines)
Lines 75-82 extern char *host; Link Here
75
extern int subsystem_flag;
75
extern int subsystem_flag;
76
extern Buffer command;
76
extern Buffer command;
77
extern volatile sig_atomic_t quit_pending;
77
extern volatile sig_atomic_t quit_pending;
78
extern char *stdio_forward_host;
79
extern int stdio_forward_port;
80
78
81
/* Context for session open confirmation callback */
79
/* Context for session open confirmation callback */
82
struct mux_session_confirm_ctx {
80
struct mux_session_confirm_ctx {
Lines 1971-1978 mux_client_request_stdio_fwd(int fd) Link Here
1971
	buffer_put_int(&m, MUX_C_NEW_STDIO_FWD);
1969
	buffer_put_int(&m, MUX_C_NEW_STDIO_FWD);
1972
	buffer_put_int(&m, muxclient_request_id);
1970
	buffer_put_int(&m, muxclient_request_id);
1973
	buffer_put_cstring(&m, ""); /* reserved */
1971
	buffer_put_cstring(&m, ""); /* reserved */
1974
	buffer_put_cstring(&m, stdio_forward_host);
1972
	buffer_put_cstring(&m, options.stdio_forward_host);
1975
	buffer_put_int(&m, stdio_forward_port);
1973
	buffer_put_int(&m, options.stdio_forward_port);
1976
1974
1977
	if (mux_client_write_packet(fd, &m) != 0)
1975
	if (mux_client_write_packet(fd, &m) != 0)
1978
		fatal("%s: write packet: %s", __func__, strerror(errno));
1976
		fatal("%s: write packet: %s", __func__, strerror(errno));
Lines 2094-2100 muxclient(const char *path) Link Here
2094
	u_int pid;
2092
	u_int pid;
2095
2093
2096
	if (muxclient_command == 0) {
2094
	if (muxclient_command == 0) {
2097
		if (stdio_forward_host != NULL)
2095
		if (options.stdio_forward_host != NULL)
2098
			muxclient_command = SSHMUX_COMMAND_STDIO_FWD;
2096
			muxclient_command = SSHMUX_COMMAND_STDIO_FWD;
2099
		else
2097
		else
2100
			muxclient_command = SSHMUX_COMMAND_OPEN;
2098
			muxclient_command = SSHMUX_COMMAND_OPEN;
(-)readconf.c (-4 / +15 lines)
Lines 1733-1738 initialize_options(Options * options) Link Here
1733
	options->forward_x11 = -1;
1733
	options->forward_x11 = -1;
1734
	options->forward_x11_trusted = -1;
1734
	options->forward_x11_trusted = -1;
1735
	options->forward_x11_timeout = -1;
1735
	options->forward_x11_timeout = -1;
1736
	options->clear_forwardings = -1;
1737
	options->stdio_forward_host = NULL;
1738
	options->stdio_forward_port = 0;
1736
	options->exit_on_forward_failure = -1;
1739
	options->exit_on_forward_failure = -1;
1737
	options->xauth_location = NULL;
1740
	options->xauth_location = NULL;
1738
	options->fwd_opts.gateway_ports = -1;
1741
	options->fwd_opts.gateway_ports = -1;
Lines 1779-1785 initialize_options(Options * options) Link Here
1779
	options->num_local_forwards = 0;
1782
	options->num_local_forwards = 0;
1780
	options->remote_forwards = NULL;
1783
	options->remote_forwards = NULL;
1781
	options->num_remote_forwards = 0;
1784
	options->num_remote_forwards = 0;
1782
	options->clear_forwardings = -1;
1783
	options->log_level = SYSLOG_LEVEL_NOT_SET;
1785
	options->log_level = SYSLOG_LEVEL_NOT_SET;
1784
	options->preferred_authentications = NULL;
1786
	options->preferred_authentications = NULL;
1785
	options->bind_address = NULL;
1787
	options->bind_address = NULL;
Lines 1853-1860 fill_default_options(Options * options) Link Here
1853
		options->forward_x11_trusted = 0;
1855
		options->forward_x11_trusted = 0;
1854
	if (options->forward_x11_timeout == -1)
1856
	if (options->forward_x11_timeout == -1)
1855
		options->forward_x11_timeout = 1200;
1857
		options->forward_x11_timeout = 1200;
1858
	/*
1859
	 * stdio forwarding (-W) changes the default for these but we defer
1860
	 * setting the values so they can be overridden.
1861
	 */
1856
	if (options->exit_on_forward_failure == -1)
1862
	if (options->exit_on_forward_failure == -1)
1857
		options->exit_on_forward_failure = 0;
1863
		options->exit_on_forward_failure =
1864
		    options->stdio_forward_host != NULL ? 1 : 0;
1865
	if (options->clear_forwardings == -1)
1866
		options->clear_forwardings =
1867
		    options->stdio_forward_host != NULL ? 1 : 0;
1868
	if (options->clear_forwardings == 1)
1869
		clear_forwardings(options);
1858
	if (options->xauth_location == NULL)
1870
	if (options->xauth_location == NULL)
1859
		options->xauth_location = _PATH_XAUTH;
1871
		options->xauth_location = _PATH_XAUTH;
1860
	if (options->fwd_opts.gateway_ports == -1)
1872
	if (options->fwd_opts.gateway_ports == -1)
Lines 1943-1950 fill_default_options(Options * options) Link Here
1943
	}
1955
	}
1944
	if (options->log_level == SYSLOG_LEVEL_NOT_SET)
1956
	if (options->log_level == SYSLOG_LEVEL_NOT_SET)
1945
		options->log_level = SYSLOG_LEVEL_INFO;
1957
		options->log_level = SYSLOG_LEVEL_INFO;
1946
	if (options->clear_forwardings == 1)
1947
		clear_forwardings(options);
1948
	if (options->no_host_authentication_for_localhost == - 1)
1958
	if (options->no_host_authentication_for_localhost == - 1)
1949
		options->no_host_authentication_for_localhost = 0;
1959
		options->no_host_authentication_for_localhost = 0;
1950
	if (options->identities_only == -1)
1960
	if (options->identities_only == -1)
Lines 2405-2410 dump_client_config(Options *o, const cha Link Here
2405
	dump_cfg_fmtint(oCompression, o->compression);
2415
	dump_cfg_fmtint(oCompression, o->compression);
2406
	dump_cfg_fmtint(oControlMaster, o->control_master);
2416
	dump_cfg_fmtint(oControlMaster, o->control_master);
2407
	dump_cfg_fmtint(oEnableSSHKeysign, o->enable_ssh_keysign);
2417
	dump_cfg_fmtint(oEnableSSHKeysign, o->enable_ssh_keysign);
2418
	dump_cfg_fmtint(oClearAllForwardings, o->clear_forwardings);
2408
	dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure);
2419
	dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure);
2409
	dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash);
2420
	dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash);
2410
	dump_cfg_fmtint(oForwardAgent, o->forward_agent);
2421
	dump_cfg_fmtint(oForwardAgent, o->forward_agent);
(-)readconf.h (+4 lines)
Lines 112-117 typedef struct { Link Here
112
	struct Forward *remote_forwards;
112
	struct Forward *remote_forwards;
113
	int	clear_forwardings;
113
	int	clear_forwardings;
114
114
115
	/* stdio forwarding (-W) host and port */
116
	char   *stdio_forward_host;
117
	int	stdio_forward_port;
118
115
	int	enable_ssh_keysign;
119
	int	enable_ssh_keysign;
116
	int64_t rekey_limit;
120
	int64_t rekey_limit;
117
	int	rekey_interval;
121
	int	rekey_interval;
(-)ssh.1 (-1 / +4 lines)
Lines 709-715 Implies Link Here
709
.Fl T ,
709
.Fl T ,
710
.Cm ExitOnForwardFailure
710
.Cm ExitOnForwardFailure
711
and
711
and
712
.Cm ClearAllForwardings .
712
.Cm ClearAllForwardings
713
although these can be overridden by the configuration file or
714
.Fl o
715
command line options.
713
.Pp
716
.Pp
714
.It Fl w Xo
717
.It Fl w Xo
715
.Ar local_tun Ns Op : Ns Ar remote_tun
718
.Ar local_tun Ns Op : Ns Ar remote_tun
(-)ssh.c (-14 / +9 lines)
Lines 136-145 int ostdin_null_flag, ono_shell_flag, ot Link Here
136
 */
136
 */
137
int fork_after_authentication_flag = 0;
137
int fork_after_authentication_flag = 0;
138
138
139
/* forward stdio to remote host and port */
140
char *stdio_forward_host = NULL;
141
int stdio_forward_port = 0;
142
143
/*
139
/*
144
 * General data structure for command line options and options configurable
140
 * General data structure for command line options and options configurable
145
 * in configuration files.  See readconf.h.
141
 * in configuration files.  See readconf.h.
Lines 621-627 main(int ac, char **av) Link Here
621
			options.fwd_opts.gateway_ports = 1;
617
			options.fwd_opts.gateway_ports = 1;
622
			break;
618
			break;
623
		case 'O':
619
		case 'O':
624
			if (stdio_forward_host != NULL)
620
			if (options.stdio_forward_host != NULL)
625
				fatal("Cannot specify multiplexing "
621
				fatal("Cannot specify multiplexing "
626
				    "command with -W");
622
				    "command with -W");
627
			else if (muxclient_command != 0)
623
			else if (muxclient_command != 0)
Lines 740-752 main(int ac, char **av) Link Here
740
			}
736
			}
741
			break;
737
			break;
742
		case 'W':
738
		case 'W':
743
			if (stdio_forward_host != NULL)
739
			if (options.stdio_forward_host != NULL)
744
				fatal("stdio forward already specified");
740
				fatal("stdio forward already specified");
745
			if (muxclient_command != 0)
741
			if (muxclient_command != 0)
746
				fatal("Cannot specify stdio forward with -O");
742
				fatal("Cannot specify stdio forward with -O");
747
			if (parse_forward(&fwd, optarg, 1, 0)) {
743
			if (parse_forward(&fwd, optarg, 1, 0)) {
748
				stdio_forward_host = fwd.listen_host;
744
				options.stdio_forward_host = fwd.listen_host;
749
				stdio_forward_port = fwd.listen_port;
745
				options.stdio_forward_port = fwd.listen_port;
750
				free(fwd.connect_host);
746
				free(fwd.connect_host);
751
			} else {
747
			} else {
752
				fprintf(stderr,
748
				fprintf(stderr,
Lines 756-763 main(int ac, char **av) Link Here
756
			}
752
			}
757
			options.request_tty = REQUEST_TTY_NO;
753
			options.request_tty = REQUEST_TTY_NO;
758
			no_shell_flag = 1;
754
			no_shell_flag = 1;
759
			options.clear_forwardings = 1;
760
			options.exit_on_forward_failure = 1;
761
			break;
755
			break;
762
		case 'q':
756
		case 'q':
763
			options.log_level = SYSLOG_LEVEL_QUIET;
757
			options.log_level = SYSLOG_LEVEL_QUIET;
Lines 1489-1506 ssh_init_stdio_forwarding(void) Link Here
1489
	Channel *c;
1483
	Channel *c;
1490
	int in, out;
1484
	int in, out;
1491
1485
1492
	if (stdio_forward_host == NULL)
1486
	if (options.stdio_forward_host == NULL)
1493
		return;
1487
		return;
1494
	if (!compat20)
1488
	if (!compat20)
1495
		fatal("stdio forwarding require Protocol 2");
1489
		fatal("stdio forwarding require Protocol 2");
1496
1490
1497
	debug3("%s: %s:%d", __func__, stdio_forward_host, stdio_forward_port);
1491
	debug3("%s: %s:%d", __func__, options.stdio_forward_host,
1492
	    options.stdio_forward_port);
1498
1493
1499
	if ((in = dup(STDIN_FILENO)) < 0 ||
1494
	if ((in = dup(STDIN_FILENO)) < 0 ||
1500
	    (out = dup(STDOUT_FILENO)) < 0)
1495
	    (out = dup(STDOUT_FILENO)) < 0)
1501
		fatal("channel_connect_stdio_fwd: dup() in/out failed");
1496
		fatal("channel_connect_stdio_fwd: dup() in/out failed");
1502
	if ((c = channel_connect_stdio_fwd(stdio_forward_host,
1497
	if ((c = channel_connect_stdio_fwd(options.stdio_forward_host,
1503
	    stdio_forward_port, in, out)) == NULL)
1498
	    options.stdio_forward_port, in, out)) == NULL)
1504
		fatal("%s: channel_connect_stdio_fwd failed", __func__);
1499
		fatal("%s: channel_connect_stdio_fwd failed", __func__);
1505
	channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0);
1500
	channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0);
1506
	channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL);
1501
	channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL);

Return to bug 2577