summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/session.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2003-05-14 22:24:43 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2003-05-14 22:24:43 +0000
commit4a0a04af86bb3e83fd505f3536ea1faccef68e3c (patch)
treed08e31392373f1937c4784d6dff6b2d82f8b5349 /usr.bin/ssh/session.c
parenta678a91d15934167f08c4151f30323cc222af86a (diff)
allow to send a BREAK to the remote system; ok various
Diffstat (limited to 'usr.bin/ssh/session.c')
-rw-r--r--usr.bin/ssh/session.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index ae671ef2331..db0a4313da9 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/session.c
@@ -33,7 +33,7 @@
*/
#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 "ssh1.h"
@@ -1505,6 +1505,26 @@ session_exec_req(Session *s)
}
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
session_auth_agent_req(Session *s)
{
static int called = 0;
@@ -1551,6 +1571,8 @@ session_input_channel_req(Channel *c, const char *rtype)
success = session_auth_agent_req(s);
} else if (strcmp(rtype, "subsystem") == 0) {
success = session_subsystem_req(s);
+ } else if (strcmp(rtype, "break") == 0) {
+ success = session_break_req(s);
}
}
if (strcmp(rtype, "window-change") == 0) {