=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/ssh.c,v retrieving revision 1.563 retrieving revision 1.564 diff -u -r1.563 -r1.564 --- src/usr.bin/ssh/ssh.c 2021/07/23 04:00:59 1.563 +++ src/usr.bin/ssh/ssh.c 2021/07/23 04:04:52 1.564 @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.563 2021/07/23 04:00:59 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.564 2021/07/23 04:04:52 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -120,13 +120,6 @@ int ostdin_null_flag, osession_type, otty_flag, orequest_tty; /* - * Flag indicating that ssh should fork after authentication. This is useful - * so that the passphrase can be entered manually, and then ssh goes to the - * background. - */ -int fork_after_authentication_flag = 0; - -/* * General data structure for command line options and options configurable * in configuration files. See readconf.h. */ @@ -694,7 +687,7 @@ options.stdin_null = 1; break; case 'f': - fork_after_authentication_flag = 1; + options.fork_after_authentication = 1; options.stdin_null = 1; break; case 'x': @@ -1303,7 +1296,7 @@ fatal("Cannot execute command-line and remote command."); /* Cannot fork to background if no command. */ - if (fork_after_authentication_flag && sshbuf_len(command) == 0 && + if (options.fork_after_authentication && sshbuf_len(command) == 0 && options.remote_command == NULL && options.session_type != SESSION_TYPE_NONE) fatal("Cannot fork into background without a command " @@ -1731,7 +1724,7 @@ if (need_controlpersist_detach) control_persist_detach(); debug("forking to background"); - fork_after_authentication_flag = 0; + options.fork_after_authentication = 0; if (daemon(1, 1) == -1) fatal("daemon() failed: %.200s", strerror(errno)); if (stdfd_devnull(1, 1, !(log_is_on_stderr() && debug_flag)) == -1) @@ -1745,7 +1738,7 @@ return; if (--forward_confirms_pending == 0) { debug_f("all expected forwarding replies received"); - if (fork_after_authentication_flag) + if (options.fork_after_authentication) fork_postauth(); } else { debug2_f("%d expected forwarding replies remaining", @@ -2124,11 +2117,11 @@ options.stdin_null = 1; options.session_type = SESSION_TYPE_NONE; tty_flag = 0; - if (!fork_after_authentication_flag && + if (!options.fork_after_authentication && (osession_type != SESSION_TYPE_NONE || options.stdio_forward_host != NULL)) need_controlpersist_detach = 1; - fork_after_authentication_flag = 1; + options.fork_after_authentication = 1; } /* * ControlPersist mux listen socket setup failed, attempt the @@ -2175,7 +2168,7 @@ * If requested and we are not interested in replies to remote * forwarding requests, then let ssh continue in the background. */ - if (fork_after_authentication_flag) { + if (options.fork_after_authentication) { if (options.exit_on_forward_failure && options.num_remote_forwards > 0) { debug("deferring postauth fork until remote forward "