Bugzilla – Attachment 3512 Details for
Bug 3290
ControlPersist opens shell even with -N
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
handle -N with ControlPersist
bz3290.diff (text/plain), 2.66 KB, created by
Damien Miller
on 2021-05-07 14:35:01 AEST
(
hide
)
Description:
handle -N with ControlPersist
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2021-05-07 14:35:01 AEST
Size:
2.66 KB
patch
obsolete
>commit ca4f69615649527939790c24b84b399e43d49ebc >Author: Damien Miller <djm@mindrot.org> >Date: Fri May 7 14:25:05 2021 +1000 > > bz3290 > >diff --git a/ssh.c b/ssh.c >index 6085f3d..3065719 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -1717,6 +1717,7 @@ control_persist_detach(void) > /* muxclient() doesn't return on success. */ > fatal("Failed to connect to new control master"); > } >+ /* XXX redundant: above fork(), daemon() here and fork_postauth() */ > if (stdfd_devnull(1, 1, !(log_is_on_stderr() && debug_flag)) == -1) > error_f("stdfd_devnull failed"); > daemon(1, 1); >@@ -2117,18 +2118,46 @@ ssh_session2(struct ssh *ssh, const struct ssh_conn_info *cinfo) > * the backgrounding, since we defer attachment of the client until > * after the connection is fully established (in particular, > * async rfwd replies have been received for ExitOnForwardFailure). >+ * >+ * There are three cases to consider here: >+ * 1) ssh -oControlPersist=... -N user@host >+ * >+ * The user does not want forking or command execution. ssh will >+ * stick around in the foreground until ControlPersist is done. >+ * >+ * 2) ssh -oControlPersist=... -Nf user@host >+ * >+ * The user wants a mux-master that runs in the background >+ * until ControlPersist expires. No command execution. Process >+ * backgrounding occurs via usual fork_after_authentication_flag. >+ * >+ * 1) ssh -oControlPersist=... user@host [...] >+ * >+ * The user wants a session in the foreground (implicitly a >+ * mux-client) and a mux-master that runs in the background >+ * until ControlPersist expires. need_controlpersist_detach will >+ * ensure the mux-master process gets backgrounded and the >+ * initial process will continue as the mux-client. > */ > if (options.control_persist && muxserver_sock != -1) { >- ostdin_null_flag = stdin_null_flag; >- ono_shell_flag = no_shell_flag; >- orequest_tty = options.request_tty; >- otty_flag = tty_flag; >- stdin_null_flag = 1; >- no_shell_flag = 1; >- tty_flag = 0; >- if (!fork_after_authentication_flag) >- need_controlpersist_detach = 1; >- fork_after_authentication_flag = 1; >+ if (no_shell_flag && !fork_after_authentication_flag) { >+ /* case #1 above */ >+ stdin_null_flag = 1; >+ tty_flag = 0; >+ } else { >+ ostdin_null_flag = stdin_null_flag; >+ ono_shell_flag = no_shell_flag; >+ orequest_tty = options.request_tty; >+ otty_flag = tty_flag; >+ stdin_null_flag = 1; >+ no_shell_flag = 1; >+ tty_flag = 0; >+ if (!fork_after_authentication_flag) { >+ /* case #3 above */ >+ need_controlpersist_detach = 1; >+ } /* otherwise case #2 */ >+ fork_after_authentication_flag = 1; >+ } > } > /* > * ControlPersist mux listen socket setup failed, attempt the
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 3290
:
3490
|
3491
|
3492
|
3493
| 3512