version 1.65.2.2, 2001/11/15 00:15:19 |
version 1.65.2.3, 2001/11/15 22:51:15 |
|
|
if (session_closed && !channel_still_open() && |
if (session_closed && !channel_still_open() && |
!packet_have_data_to_write()) { |
!packet_have_data_to_write()) { |
/* clear mask since we did not call select() */ |
/* clear mask since we did not call select() */ |
memset(*readsetp, 0, *maxfdp); |
memset(*readsetp, 0, *nallocp); |
memset(*writesetp, 0, *maxfdp); |
memset(*writesetp, 0, *nallocp); |
return; |
return; |
} else { |
} else { |
FD_SET(connection_in, *readsetp); |
FD_SET(connection_in, *readsetp); |
|
|
* We have to return, because the mainloop checks for the flags |
* We have to return, because the mainloop checks for the flags |
* set by the signal handlers. |
* set by the signal handlers. |
*/ |
*/ |
memset(*readsetp, 0, *maxfdp); |
memset(*readsetp, 0, *nallocp); |
memset(*writesetp, 0, *maxfdp); |
memset(*writesetp, 0, *nallocp); |
|
|
if (errno == EINTR) |
if (errno == EINTR) |
return; |
return; |
|
|
continue; |
continue; |
|
|
case '&': |
case '&': |
/* XXX does not work yet with proto 2 */ |
|
if (compat20) |
|
continue; |
|
/* |
/* |
* Detach the program (continue to serve connections, |
* Detach the program (continue to serve connections, |
* but put in background and no more new connections). |
* but put in background and no more new connections). |
*/ |
*/ |
if (!stdin_eof) { |
|
/* |
|
* Sending SSH_CMSG_EOF alone does not always appear |
|
* to be enough. So we try to send an EOF character |
|
* first. |
|
*/ |
|
packet_start(SSH_CMSG_STDIN_DATA); |
|
packet_put_string("\004", 1); |
|
packet_send(); |
|
/* Close stdin. */ |
|
stdin_eof = 1; |
|
if (buffer_len(bin) == 0) { |
|
packet_start(SSH_CMSG_EOF); |
|
packet_send(); |
|
} |
|
} |
|
/* Restore tty modes. */ |
/* Restore tty modes. */ |
leave_raw_mode(); |
leave_raw_mode(); |
|
|
/* Stop listening for new connections. */ |
/* Stop listening for new connections. */ |
channel_close_all(); /* proto1 only XXXX */ |
channel_stop_listening(); |
|
|
printf("%c& [backgrounded]\n", escape_char); |
snprintf(string, sizeof string, |
|
"%c& [backgrounded]\n", escape_char); |
|
buffer_append(berr, string, strlen(string)); |
|
|
/* Fork into background. */ |
/* Fork into background. */ |
pid = fork(); |
pid = fork(); |
|
|
exit(0); |
exit(0); |
} |
} |
/* The child continues serving connections. */ |
/* The child continues serving connections. */ |
continue; /*XXX ? */ |
if (compat20) { |
|
buffer_append(bin, "\004", 1); |
|
/* fake EOF on stdin */ |
|
return -1; |
|
} else if (!stdin_eof) { |
|
/* |
|
* Sending SSH_CMSG_EOF alone does not always appear |
|
* to be enough. So we try to send an EOF character |
|
* first. |
|
*/ |
|
packet_start(SSH_CMSG_STDIN_DATA); |
|
packet_put_string("\004", 1); |
|
packet_send(); |
|
/* Close stdin. */ |
|
stdin_eof = 1; |
|
if (buffer_len(bin) == 0) { |
|
packet_start(SSH_CMSG_EOF); |
|
packet_send(); |
|
} |
|
} |
|
continue; |
|
|
case '?': |
case '?': |
snprintf(string, sizeof string, |
snprintf(string, sizeof string, |
|
|
signal(SIGINT, signal_handler); |
signal(SIGINT, signal_handler); |
signal(SIGQUIT, signal_handler); |
signal(SIGQUIT, signal_handler); |
signal(SIGTERM, signal_handler); |
signal(SIGTERM, signal_handler); |
signal(SIGPIPE, SIG_IGN); |
|
if (have_pty) |
if (have_pty) |
signal(SIGWINCH, window_change_handler); |
signal(SIGWINCH, window_change_handler); |
|
|