[clientloop.c session.c ssh.1]
     allow to send a BREAK to the remote system; ok various
This commit is contained in:
Damien Miller 2003-05-15 10:20:13 +10:00
parent 37876e913a
commit 54c459866e
4 changed files with 46 additions and 5 deletions

View File

@ -10,6 +10,9 @@
add experimental support for verifying hos keys using DNS as described add experimental support for verifying hos keys using DNS as described
in draft-ietf-secsh-dns-xx.txt. more information in README.dns. in draft-ietf-secsh-dns-xx.txt. more information in README.dns.
ok markus@ and henning@ ok markus@ and henning@
- markus@cvs.openbsd.org 2003/05/14 22:24:42
[clientloop.c session.c ssh.1]
allow to send a BREAK to the remote system; ok various
20030514 20030514
- (djm) Bug #117: Don't lie to PAM about username - (djm) Bug #117: Don't lie to PAM about username
@ -1485,4 +1488,4 @@
save auth method before monitor_reset_key_state(); bugzilla bug #284; save auth method before monitor_reset_key_state(); bugzilla bug #284;
ok provos@ ok provos@
$Id: ChangeLog,v 1.2702 2003/05/15 00:19:46 djm Exp $ $Id: ChangeLog,v 1.2703 2003/05/15 00:20:13 djm Exp $

View File

@ -59,7 +59,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: clientloop.c,v 1.110 2003/05/11 20:30:24 markus Exp $"); RCSID("$OpenBSD: clientloop.c,v 1.111 2003/05/14 22:24:42 markus Exp $");
#include "ssh.h" #include "ssh.h"
#include "ssh1.h" #include "ssh1.h"
@ -574,6 +574,19 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
/* We have been continued. */ /* We have been continued. */
continue; continue;
case 'B':
if (compat20) {
snprintf(string, sizeof string,
"%cB\r\n", escape_char);
buffer_append(berr, string,
strlen(string));
channel_request_start(session_ident,
"break", 0);
packet_put_int(1000);
packet_send();
}
continue;
case 'R': case 'R':
if (compat20) { if (compat20) {
if (datafellows & SSH_BUG_NOREKEY) if (datafellows & SSH_BUG_NOREKEY)
@ -636,6 +649,7 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
"%c?\r\n\ "%c?\r\n\
Supported escape sequences:\r\n\ Supported escape sequences:\r\n\
%c. - terminate connection\r\n\ %c. - terminate connection\r\n\
%cB - send a BREAK to the remote system\r\n\
%cC - open a command line\r\n\ %cC - open a command line\r\n\
%cR - Request rekey (SSH protocol 2 only)\r\n\ %cR - Request rekey (SSH protocol 2 only)\r\n\
%c^Z - suspend ssh\r\n\ %c^Z - suspend ssh\r\n\
@ -646,7 +660,7 @@ Supported escape sequences:\r\n\
(Note that escapes are only recognized immediately after newline.)\r\n", (Note that escapes are only recognized immediately after newline.)\r\n",
escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char,
escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char,
escape_char, escape_char); escape_char, escape_char, escape_char);
buffer_append(berr, string, strlen(string)); buffer_append(berr, string, strlen(string));
continue; continue;

View File

@ -33,7 +33,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: session.c,v 1.156 2003/05/11 20:30:25 markus Exp $"); RCSID("$OpenBSD: session.c,v 1.157 2003/05/14 22:24:42 markus Exp $");
#include "ssh.h" #include "ssh.h"
#include "ssh1.h" #include "ssh1.h"
@ -1742,6 +1742,26 @@ session_exec_req(Session *s)
return 1; return 1;
} }
static int
session_break_req(Session *s)
{
u_int break_length;
break_length = packet_get_int();
packet_check_eom();
if (s->ttyfd == -1)
return 0;
/* we will sleep from 500ms to 3000ms */
break_length = MIN(break_length, 3000);
break_length = MAX(break_length, 500);
ioctl(s->ttyfd, TIOCSBRK, NULL);
/* should we care about EINTR? */
usleep(break_length * 1000);
ioctl(s->ttyfd, TIOCCBRK, NULL);
return 1;
}
static int static int
session_auth_agent_req(Session *s) session_auth_agent_req(Session *s)
{ {
@ -1789,6 +1809,8 @@ session_input_channel_req(Channel *c, const char *rtype)
success = session_auth_agent_req(s); success = session_auth_agent_req(s);
} else if (strcmp(rtype, "subsystem") == 0) { } else if (strcmp(rtype, "subsystem") == 0) {
success = session_subsystem_req(s); success = session_subsystem_req(s);
} else if (strcmp(rtype, "break") == 0) {
success = session_break_req(s);
} }
} }
if (strcmp(rtype, "window-change") == 0) { if (strcmp(rtype, "window-change") == 0) {

4
ssh.1
View File

@ -34,7 +34,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: ssh.1,v 1.169 2003/04/12 11:40:15 naddy Exp $ .\" $OpenBSD: ssh.1,v 1.170 2003/05/14 22:24:42 markus Exp $
.Dd September 25, 1999 .Dd September 25, 1999
.Dt SSH 1 .Dt SSH 1
.Os .Os
@ -301,6 +301,8 @@ Background ssh at logout when waiting for forwarded connection / X11 sessions
to terminate to terminate
.It Cm ~? .It Cm ~?
Display a list of escape characters Display a list of escape characters
.It Cm ~B
Send a BREAK to the remote system.
.It Cm ~C .It Cm ~C
Open command line (only useful for adding port forwardings using the Open command line (only useful for adding port forwardings using the
.Fl L .Fl L