diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2003-05-14 22:24:43 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2003-05-14 22:24:43 +0000 |
commit | 4a0a04af86bb3e83fd505f3536ea1faccef68e3c (patch) | |
tree | d08e31392373f1937c4784d6dff6b2d82f8b5349 /usr.bin | |
parent | a678a91d15934167f08c4151f30323cc222af86a (diff) |
allow to send a BREAK to the remote system; ok various
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/clientloop.c | 18 | ||||
-rw-r--r-- | usr.bin/ssh/session.c | 24 | ||||
-rw-r--r-- | usr.bin/ssh/ssh.1 | 4 |
3 files changed, 42 insertions, 4 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index e5270aa57f1..1c1acf48123 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -59,7 +59,7 @@ */ #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 "ssh1.h" @@ -574,6 +574,19 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) /* We have been continued. */ 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': if (compat20) { if (datafellows & SSH_BUG_NOREKEY) @@ -636,6 +649,7 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) "%c?\r\n\ Supported escape sequences:\r\n\ %c. - terminate connection\r\n\ +%cB - send a BREAK to the remote system\r\n\ %cC - open a command line\r\n\ %cR - Request rekey (SSH protocol 2 only)\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", 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)); continue; 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) { diff --git a/usr.bin/ssh/ssh.1 b/usr.bin/ssh/ssh.1 index a7e95c1f487..8f91ba754ca 100644 --- a/usr.bin/ssh/ssh.1 +++ b/usr.bin/ssh/ssh.1 @@ -34,7 +34,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" 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 .Dt SSH 1 .Os @@ -301,6 +301,8 @@ Background ssh at logout when waiting for forwarded connection / X11 sessions to terminate .It Cm ~? Display a list of escape characters +.It Cm ~B +Send a BREAK to the remote system. .It Cm ~C Open command line (only useful for adding port forwardings using the .Fl L |