From 95687f5831ae680f7959446d8ae4b52452ee05dd Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 1 Apr 2016 02:34:10 +0000 Subject: upstream commit whitespace at EOL Upstream-ID: 40ae2203d07cb14e0a89e1a0d4c6120ee8fd8c3a --- mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mux.c') diff --git a/mux.c b/mux.c index 6bf53ebd9..6086f1ce1 100644 --- a/mux.c +++ b/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.58 2016/01/13 23:04:47 djm Exp $ */ +/* $OpenBSD: mux.c,v 1.59 2016/04/01 02:34:10 djm Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -1297,7 +1297,7 @@ muxserver_listen(void) /* Now atomically "move" the mux socket into position */ if (link(options.control_path, orig_control_path) != 0) { if (errno != EEXIST) { - fatal("%s: link mux listener %s => %s: %s", __func__, + fatal("%s: link mux listener %s => %s: %s", __func__, options.control_path, orig_control_path, strerror(errno)); } -- cgit v1.2.3 From 8543ff3f5020fe659839b15f05b8c522bde6cee5 Mon Sep 17 00:00:00 2001 From: "dtucker@openbsd.org" Date: Fri, 3 Jun 2016 03:14:41 +0000 Subject: upstream commit Move the host and port used by ssh -W into the Options struct. This will make future changes a bit easier. ok djm@ Upstream-ID: 151bce5ecab2fbedf0d836250a27968d30389382 --- mux.c | 10 ++++------ readconf.c | 4 +++- readconf.h | 6 +++++- ssh.c | 23 ++++++++++------------- 4 files changed, 22 insertions(+), 21 deletions(-) (limited to 'mux.c') diff --git a/mux.c b/mux.c index 6086f1ce1..98e3c0068 100644 --- a/mux.c +++ b/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.59 2016/04/01 02:34:10 djm Exp $ */ +/* $OpenBSD: mux.c,v 1.60 2016/06/03 03:14:41 dtucker Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -88,8 +88,6 @@ extern char *host; extern int subsystem_flag; extern Buffer command; extern volatile sig_atomic_t quit_pending; -extern char *stdio_forward_host; -extern int stdio_forward_port; /* Context for session open confirmation callback */ struct mux_session_confirm_ctx { @@ -1991,8 +1989,8 @@ mux_client_request_stdio_fwd(int fd) buffer_put_int(&m, MUX_C_NEW_STDIO_FWD); buffer_put_int(&m, muxclient_request_id); buffer_put_cstring(&m, ""); /* reserved */ - buffer_put_cstring(&m, stdio_forward_host); - buffer_put_int(&m, stdio_forward_port); + buffer_put_cstring(&m, options.stdio_forward_host); + buffer_put_int(&m, options.stdio_forward_port); if (mux_client_write_packet(fd, &m) != 0) fatal("%s: write packet: %s", __func__, strerror(errno)); @@ -2116,7 +2114,7 @@ muxclient(const char *path) u_int pid; if (muxclient_command == 0) { - if (stdio_forward_host != NULL) + if (options.stdio_forward_host != NULL) muxclient_command = SSHMUX_COMMAND_STDIO_FWD; else muxclient_command = SSHMUX_COMMAND_OPEN; diff --git a/readconf.c b/readconf.c index c706fbf46..66a36a49f 100644 --- a/readconf.c +++ b/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.254 2016/05/04 14:29:58 markus Exp $ */ +/* $OpenBSD: readconf.c,v 1.255 2016/06/03 03:14:41 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1748,6 +1748,8 @@ initialize_options(Options * options) options->forward_x11 = -1; options->forward_x11_trusted = -1; options->forward_x11_timeout = -1; + options->stdio_forward_host = NULL; + options->stdio_forward_port = 0; options->exit_on_forward_failure = -1; options->xauth_location = NULL; options->fwd_opts.gateway_ports = -1; diff --git a/readconf.h b/readconf.h index f0e498ea2..a8b0b9188 100644 --- a/readconf.h +++ b/readconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.h,v 1.115 2016/05/04 12:21:53 markus Exp $ */ +/* $OpenBSD: readconf.h,v 1.116 2016/06/03 03:14:41 dtucker Exp $ */ /* * Author: Tatu Ylonen @@ -112,6 +112,10 @@ typedef struct { struct Forward *remote_forwards; int clear_forwardings; + /* stdio forwarding (-W) host and port */ + char *stdio_forward_host; + int stdio_forward_port; + int enable_ssh_keysign; int64_t rekey_limit; int rekey_interval; diff --git a/ssh.c b/ssh.c index 7a536a0f7..702631c76 100644 --- a/ssh.c +++ b/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.440 2016/05/04 14:29:58 markus Exp $ */ +/* $OpenBSD: ssh.c,v 1.441 2016/06/03 03:14:41 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -151,10 +151,6 @@ int ostdin_null_flag, ono_shell_flag, otty_flag, orequest_tty; */ int fork_after_authentication_flag = 0; -/* forward stdio to remote host and port */ -char *stdio_forward_host = NULL; -int stdio_forward_port = 0; - /* * General data structure for command line options and options configurable * in configuration files. See readconf.h. @@ -651,7 +647,7 @@ main(int ac, char **av) options.fwd_opts.gateway_ports = 1; break; case 'O': - if (stdio_forward_host != NULL) + if (options.stdio_forward_host != NULL) fatal("Cannot specify multiplexing " "command with -W"); else if (muxclient_command != 0) @@ -770,13 +766,13 @@ main(int ac, char **av) } break; case 'W': - if (stdio_forward_host != NULL) + if (options.stdio_forward_host != NULL) fatal("stdio forward already specified"); if (muxclient_command != 0) fatal("Cannot specify stdio forward with -O"); if (parse_forward(&fwd, optarg, 1, 0)) { - stdio_forward_host = fwd.listen_host; - stdio_forward_port = fwd.listen_port; + options.stdio_forward_host = fwd.listen_host; + options.stdio_forward_port = fwd.listen_port; free(fwd.connect_host); } else { fprintf(stderr, @@ -1538,18 +1534,19 @@ ssh_init_stdio_forwarding(void) Channel *c; int in, out; - if (stdio_forward_host == NULL) + if (options.stdio_forward_host == NULL) return; if (!compat20) fatal("stdio forwarding require Protocol 2"); - debug3("%s: %s:%d", __func__, stdio_forward_host, stdio_forward_port); + debug3("%s: %s:%d", __func__, options.stdio_forward_host, + options.stdio_forward_port); if ((in = dup(STDIN_FILENO)) < 0 || (out = dup(STDOUT_FILENO)) < 0) fatal("channel_connect_stdio_fwd: dup() in/out failed"); - if ((c = channel_connect_stdio_fwd(stdio_forward_host, - stdio_forward_port, in, out)) == NULL) + if ((c = channel_connect_stdio_fwd(options.stdio_forward_host, + options.stdio_forward_port, in, out)) == NULL) fatal("%s: channel_connect_stdio_fwd failed", __func__); channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL); -- cgit v1.2.3