[BACK]Return to ssh.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/ssh.c between version 1.563 and 1.564

version 1.563, 2021/07/23 04:00:59 version 1.564, 2021/07/23 04:04:52
Line 120 
Line 120 
 int ostdin_null_flag, osession_type, otty_flag, orequest_tty;  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   * General data structure for command line options and options configurable
  * in configuration files.  See readconf.h.   * in configuration files.  See readconf.h.
  */   */
Line 694 
Line 687 
                         options.stdin_null = 1;                          options.stdin_null = 1;
                         break;                          break;
                 case 'f':                  case 'f':
                         fork_after_authentication_flag = 1;                          options.fork_after_authentication = 1;
                         options.stdin_null = 1;                          options.stdin_null = 1;
                         break;                          break;
                 case 'x':                  case 'x':
Line 1303 
Line 1296 
                 fatal("Cannot execute command-line and remote command.");                  fatal("Cannot execute command-line and remote command.");
   
         /* Cannot fork to background if no 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.remote_command == NULL &&
             options.session_type != SESSION_TYPE_NONE)              options.session_type != SESSION_TYPE_NONE)
                 fatal("Cannot fork into background without a command "                  fatal("Cannot fork into background without a command "
Line 1731 
Line 1724 
         if (need_controlpersist_detach)          if (need_controlpersist_detach)
                 control_persist_detach();                  control_persist_detach();
         debug("forking to background");          debug("forking to background");
         fork_after_authentication_flag = 0;          options.fork_after_authentication = 0;
         if (daemon(1, 1) == -1)          if (daemon(1, 1) == -1)
                 fatal("daemon() failed: %.200s", strerror(errno));                  fatal("daemon() failed: %.200s", strerror(errno));
         if (stdfd_devnull(1, 1, !(log_is_on_stderr() && debug_flag)) == -1)          if (stdfd_devnull(1, 1, !(log_is_on_stderr() && debug_flag)) == -1)
Line 1745 
Line 1738 
                 return;                  return;
         if (--forward_confirms_pending == 0) {          if (--forward_confirms_pending == 0) {
                 debug_f("all expected forwarding replies received");                  debug_f("all expected forwarding replies received");
                 if (fork_after_authentication_flag)                  if (options.fork_after_authentication)
                         fork_postauth();                          fork_postauth();
         } else {          } else {
                 debug2_f("%d expected forwarding replies remaining",                  debug2_f("%d expected forwarding replies remaining",
Line 2124 
Line 2117 
                 options.stdin_null = 1;                  options.stdin_null = 1;
                 options.session_type = SESSION_TYPE_NONE;                  options.session_type = SESSION_TYPE_NONE;
                 tty_flag = 0;                  tty_flag = 0;
                 if (!fork_after_authentication_flag &&                  if (!options.fork_after_authentication &&
                     (osession_type != SESSION_TYPE_NONE ||                      (osession_type != SESSION_TYPE_NONE ||
                     options.stdio_forward_host != NULL))                      options.stdio_forward_host != NULL))
                         need_controlpersist_detach = 1;                          need_controlpersist_detach = 1;
                 fork_after_authentication_flag = 1;                  options.fork_after_authentication = 1;
         }          }
         /*          /*
          * ControlPersist mux listen socket setup failed, attempt the           * ControlPersist mux listen socket setup failed, attempt the
Line 2175 
Line 2168 
          * If requested and we are not interested in replies to remote           * If requested and we are not interested in replies to remote
          * forwarding requests, then let ssh continue in the background.           * 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 &&                  if (options.exit_on_forward_failure &&
                     options.num_remote_forwards > 0) {                      options.num_remote_forwards > 0) {
                         debug("deferring postauth fork until remote forward "                          debug("deferring postauth fork until remote forward "

Legend:
Removed from v.1.563  
changed lines
  Added in v.1.564