summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-15 10:20:13 +1000
committerDamien Miller <djm@mindrot.org>2003-05-15 10:20:13 +1000
commit54c459866e2da288a3895eecf097104ac6f9f4d0 (patch)
tree153fc4387b34aaa23b9e088ceb44fbce325cdda3
parent37876e913a069036501086a247ed2ea430cea206 (diff)
- 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
-rw-r--r--ChangeLog5
-rw-r--r--clientloop.c18
-rw-r--r--session.c24
-rw-r--r--ssh.14
4 files changed, 46 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8feae8b23..6ec753efe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@
10 add experimental support for verifying hos keys using DNS as described 10 add experimental support for verifying hos keys using DNS as described
11 in draft-ietf-secsh-dns-xx.txt. more information in README.dns. 11 in draft-ietf-secsh-dns-xx.txt. more information in README.dns.
12 ok markus@ and henning@ 12 ok markus@ and henning@
13 - markus@cvs.openbsd.org 2003/05/14 22:24:42
14 [clientloop.c session.c ssh.1]
15 allow to send a BREAK to the remote system; ok various
13 16
1420030514 1720030514
15 - (djm) Bug #117: Don't lie to PAM about username 18 - (djm) Bug #117: Don't lie to PAM about username
@@ -1485,4 +1488,4 @@
1485 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1488 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1486 ok provos@ 1489 ok provos@
1487 1490
1488$Id: ChangeLog,v 1.2702 2003/05/15 00:19:46 djm Exp $ 1491$Id: ChangeLog,v 1.2703 2003/05/15 00:20:13 djm Exp $
diff --git a/clientloop.c b/clientloop.c
index e5270aa57..1c1acf481 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.110 2003/05/11 20:30:24 markus Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.111 2003/05/14 22:24:42 markus Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -574,6 +574,19 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
574 /* We have been continued. */ 574 /* We have been continued. */
575 continue; 575 continue;
576 576
577 case 'B':
578 if (compat20) {
579 snprintf(string, sizeof string,
580 "%cB\r\n", escape_char);
581 buffer_append(berr, string,
582 strlen(string));
583 channel_request_start(session_ident,
584 "break", 0);
585 packet_put_int(1000);
586 packet_send();
587 }
588 continue;
589
577 case 'R': 590 case 'R':
578 if (compat20) { 591 if (compat20) {
579 if (datafellows & SSH_BUG_NOREKEY) 592 if (datafellows & SSH_BUG_NOREKEY)
@@ -636,6 +649,7 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
636"%c?\r\n\ 649"%c?\r\n\
637Supported escape sequences:\r\n\ 650Supported escape sequences:\r\n\
638%c. - terminate connection\r\n\ 651%c. - terminate connection\r\n\
652%cB - send a BREAK to the remote system\r\n\
639%cC - open a command line\r\n\ 653%cC - open a command line\r\n\
640%cR - Request rekey (SSH protocol 2 only)\r\n\ 654%cR - Request rekey (SSH protocol 2 only)\r\n\
641%c^Z - suspend ssh\r\n\ 655%c^Z - suspend ssh\r\n\
@@ -646,7 +660,7 @@ Supported escape sequences:\r\n\
646(Note that escapes are only recognized immediately after newline.)\r\n", 660(Note that escapes are only recognized immediately after newline.)\r\n",
647 escape_char, escape_char, escape_char, escape_char, 661 escape_char, escape_char, escape_char, escape_char,
648 escape_char, escape_char, escape_char, escape_char, 662 escape_char, escape_char, escape_char, escape_char,
649 escape_char, escape_char); 663 escape_char, escape_char, escape_char);
650 buffer_append(berr, string, strlen(string)); 664 buffer_append(berr, string, strlen(string));
651 continue; 665 continue;
652 666
diff --git a/session.c b/session.c
index 5b445f93b..796c5177c 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.156 2003/05/11 20:30:25 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.157 2003/05/14 22:24:42 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -1743,6 +1743,26 @@ session_exec_req(Session *s)
1743} 1743}
1744 1744
1745static int 1745static int
1746session_break_req(Session *s)
1747{
1748 u_int break_length;
1749
1750 break_length = packet_get_int();
1751 packet_check_eom();
1752
1753 if (s->ttyfd == -1)
1754 return 0;
1755 /* we will sleep from 500ms to 3000ms */
1756 break_length = MIN(break_length, 3000);
1757 break_length = MAX(break_length, 500);
1758 ioctl(s->ttyfd, TIOCSBRK, NULL);
1759 /* should we care about EINTR? */
1760 usleep(break_length * 1000);
1761 ioctl(s->ttyfd, TIOCCBRK, NULL);
1762 return 1;
1763}
1764
1765static int
1746session_auth_agent_req(Session *s) 1766session_auth_agent_req(Session *s)
1747{ 1767{
1748 static int called = 0; 1768 static int called = 0;
@@ -1789,6 +1809,8 @@ session_input_channel_req(Channel *c, const char *rtype)
1789 success = session_auth_agent_req(s); 1809 success = session_auth_agent_req(s);
1790 } else if (strcmp(rtype, "subsystem") == 0) { 1810 } else if (strcmp(rtype, "subsystem") == 0) {
1791 success = session_subsystem_req(s); 1811 success = session_subsystem_req(s);
1812 } else if (strcmp(rtype, "break") == 0) {
1813 success = session_break_req(s);
1792 } 1814 }
1793 } 1815 }
1794 if (strcmp(rtype, "window-change") == 0) { 1816 if (strcmp(rtype, "window-change") == 0) {
diff --git a/ssh.1 b/ssh.1
index a7e95c1f4..8f91ba754 100644
--- a/ssh.1
+++ b/ssh.1
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: ssh.1,v 1.169 2003/04/12 11:40:15 naddy Exp $ 37.\" $OpenBSD: ssh.1,v 1.170 2003/05/14 22:24:42 markus Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSH 1 39.Dt SSH 1
40.Os 40.Os
@@ -301,6 +301,8 @@ Background ssh at logout when waiting for forwarded connection / X11 sessions
301to terminate 301to terminate
302.It Cm ~? 302.It Cm ~?
303Display a list of escape characters 303Display a list of escape characters
304.It Cm ~B
305Send a BREAK to the remote system.
304.It Cm ~C 306.It Cm ~C
305Open command line (only useful for adding port forwardings using the 307Open command line (only useful for adding port forwardings using the
306.Fl L 308.Fl L