Bugzilla – Attachment 2819 Details for
Bug 2577
Port Forwarding on Proxy with ProxyCommand ssh -W does not work / bad file descriptor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Allow ExitOnForwardFailure=no and ClearAllForwardings=no to be overridden when using -W.
openssh-W-override-forwardings.patch (text/plain), 7.53 KB, created by
Darren Tucker
on 2016-06-01 13:21:11 AEST
(
hide
)
Description:
Allow ExitOnForwardFailure=no and ClearAllForwardings=no to be overridden when using -W.
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2016-06-01 13:21:11 AEST
Size:
7.53 KB
patch
obsolete
>Index: mux.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/mux.c,v >retrieving revision 1.59 >diff -u -p -r1.59 mux.c >--- mux.c 1 Apr 2016 02:34:10 -0000 1.59 >+++ mux.c 1 Jun 2016 03:18:09 -0000 >@@ -75,8 +75,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 { >@@ -1971,8 +1969,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)); >@@ -2094,7 +2092,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; >Index: readconf.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/readconf.c,v >retrieving revision 1.254 >diff -u -p -r1.254 readconf.c >--- readconf.c 4 May 2016 14:29:58 -0000 1.254 >+++ readconf.c 1 Jun 2016 03:18:09 -0000 >@@ -1733,6 +1733,9 @@ initialize_options(Options * options) > options->forward_x11 = -1; > options->forward_x11_trusted = -1; > options->forward_x11_timeout = -1; >+ options->clear_forwardings = -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; >@@ -1779,7 +1782,6 @@ initialize_options(Options * options) > options->num_local_forwards = 0; > options->remote_forwards = NULL; > options->num_remote_forwards = 0; >- options->clear_forwardings = -1; > options->log_level = SYSLOG_LEVEL_NOT_SET; > options->preferred_authentications = NULL; > options->bind_address = NULL; >@@ -1853,8 +1855,18 @@ fill_default_options(Options * options) > options->forward_x11_trusted = 0; > if (options->forward_x11_timeout == -1) > options->forward_x11_timeout = 1200; >+ /* >+ * stdio forwarding (-W) changes the default for these but we defer >+ * setting the values so they can be overridden. >+ */ > if (options->exit_on_forward_failure == -1) >- options->exit_on_forward_failure = 0; >+ options->exit_on_forward_failure = >+ options->stdio_forward_host != NULL ? 1 : 0; >+ if (options->clear_forwardings == -1) >+ options->clear_forwardings = >+ options->stdio_forward_host != NULL ? 1 : 0; >+ if (options->clear_forwardings == 1) >+ clear_forwardings(options); > if (options->xauth_location == NULL) > options->xauth_location = _PATH_XAUTH; > if (options->fwd_opts.gateway_ports == -1) >@@ -1943,8 +1955,6 @@ fill_default_options(Options * options) > } > if (options->log_level == SYSLOG_LEVEL_NOT_SET) > options->log_level = SYSLOG_LEVEL_INFO; >- if (options->clear_forwardings == 1) >- clear_forwardings(options); > if (options->no_host_authentication_for_localhost == - 1) > options->no_host_authentication_for_localhost = 0; > if (options->identities_only == -1) >@@ -2405,6 +2415,7 @@ dump_client_config(Options *o, const cha > dump_cfg_fmtint(oCompression, o->compression); > dump_cfg_fmtint(oControlMaster, o->control_master); > dump_cfg_fmtint(oEnableSSHKeysign, o->enable_ssh_keysign); >+ dump_cfg_fmtint(oClearAllForwardings, o->clear_forwardings); > dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure); > dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash); > dump_cfg_fmtint(oForwardAgent, o->forward_agent); >Index: readconf.h >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/readconf.h,v >retrieving revision 1.115 >diff -u -p -r1.115 readconf.h >--- readconf.h 4 May 2016 12:21:53 -0000 1.115 >+++ readconf.h 1 Jun 2016 03:18:09 -0000 >@@ -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; >Index: ssh.1 >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh.1,v >retrieving revision 1.371 >diff -u -p -r1.371 ssh.1 >--- ssh.1 4 May 2016 12:21:53 -0000 1.371 >+++ ssh.1 1 Jun 2016 03:18:09 -0000 >@@ -709,7 +709,10 @@ Implies > .Fl T , > .Cm ExitOnForwardFailure > and >-.Cm ClearAllForwardings . >+.Cm ClearAllForwardings >+although these can be overridden by the configuration file or >+.Fl o >+command line options. > .Pp > .It Fl w Xo > .Ar local_tun Ns Op : Ns Ar remote_tun >Index: ssh.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh.c,v >retrieving revision 1.440 >diff -u -p -r1.440 ssh.c >--- ssh.c 4 May 2016 14:29:58 -0000 1.440 >+++ ssh.c 1 Jun 2016 03:18:09 -0000 >@@ -136,10 +136,6 @@ int ostdin_null_flag, ono_shell_flag, ot > */ > 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. >@@ -621,7 +617,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) >@@ -740,13 +736,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, >@@ -756,8 +752,6 @@ main(int ac, char **av) > } > options.request_tty = REQUEST_TTY_NO; > no_shell_flag = 1; >- options.clear_forwardings = 1; >- options.exit_on_forward_failure = 1; > break; > case 'q': > options.log_level = SYSLOG_LEVEL_QUIET; >@@ -1489,18 +1483,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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2577
: 2819