View | Details | Raw Unified | Return to bug 1689
Collapse All | Expand All

(-)clientloop.c (-9 / +12 lines)
Lines 122-127 extern int muxserver_sock; Link Here
122
 */
122
 */
123
extern char *host;
123
extern char *host;
124
124
125
/* Force TTY allocation */
126
extern int force_tty_flag;
127
125
/*
128
/*
126
 * Flag to indicate that we have received a window change signal which has
129
 * Flag to indicate that we have received a window change signal which has
127
 * not yet been processed.  This will cause a message indicating the new
130
 * not yet been processed.  This will cause a message indicating the new
Lines 602-608 client_suspend_self(Buffer *bin, Buffer Link Here
602
		atomicio(vwrite, fileno(stderr), buffer_ptr(berr),
605
		atomicio(vwrite, fileno(stderr), buffer_ptr(berr),
603
		    buffer_len(berr));
606
		    buffer_len(berr));
604
607
605
	leave_raw_mode();
608
	leave_raw_mode(force_tty_flag);
606
609
607
	/*
610
	/*
608
	 * Free (and clear) the buffer to reduce the amount of data that gets
611
	 * Free (and clear) the buffer to reduce the amount of data that gets
Lines 623-629 client_suspend_self(Buffer *bin, Buffer Link Here
623
	buffer_init(bout);
626
	buffer_init(bout);
624
	buffer_init(berr);
627
	buffer_init(berr);
625
628
626
	enter_raw_mode();
629
	enter_raw_mode(force_tty_flag);
627
}
630
}
628
631
629
static void
632
static void
Lines 765-771 process_cmdline(void) Link Here
765
	bzero(&fwd, sizeof(fwd));
768
	bzero(&fwd, sizeof(fwd));
766
	fwd.listen_host = fwd.connect_host = NULL;
769
	fwd.listen_host = fwd.connect_host = NULL;
767
770
768
	leave_raw_mode();
771
	leave_raw_mode(force_tty_flag);
769
	handler = signal(SIGINT, SIG_IGN);
772
	handler = signal(SIGINT, SIG_IGN);
770
	cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
773
	cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
771
	if (s == NULL)
774
	if (s == NULL)
Lines 868-874 process_cmdline(void) Link Here
868
871
869
out:
872
out:
870
	signal(SIGINT, handler);
873
	signal(SIGINT, handler);
871
	enter_raw_mode();
874
	enter_raw_mode(force_tty_flag);
872
	if (cmd)
875
	if (cmd)
873
		xfree(cmd);
876
		xfree(cmd);
874
	if (fwd.listen_host != NULL)
877
	if (fwd.listen_host != NULL)
Lines 987-993 process_escapes(Channel *c, Buffer *bin, Link Here
987
				 * more new connections).
990
				 * more new connections).
988
				 */
991
				 */
989
				/* Restore tty modes. */
992
				/* Restore tty modes. */
990
				leave_raw_mode();
993
				leave_raw_mode(force_tty_flag);
991
994
992
				/* Stop listening for new connections. */
995
				/* Stop listening for new connections. */
993
				channel_stop_listening();
996
				channel_stop_listening();
Lines 1279-1285 client_channel_closed(int id, void *arg) Link Here
1279
{
1282
{
1280
	channel_cancel_cleanup(id);
1283
	channel_cancel_cleanup(id);
1281
	session_closed = 1;
1284
	session_closed = 1;
1282
	leave_raw_mode();
1285
	leave_raw_mode(force_tty_flag);
1283
}
1286
}
1284
1287
1285
/*
1288
/*
Lines 1352-1358 client_loop(int have_pty, int escape_cha Link Here
1352
	signal(SIGWINCH, window_change_handler);
1355
	signal(SIGWINCH, window_change_handler);
1353
1356
1354
	if (have_pty)
1357
	if (have_pty)
1355
		enter_raw_mode();
1358
		enter_raw_mode(force_tty_flag);
1356
1359
1357
	if (compat20) {
1360
	if (compat20) {
1358
		session_ident = ssh2_chan_id;
1361
		session_ident = ssh2_chan_id;
Lines 1486-1492 client_loop(int have_pty, int escape_cha Link Here
1486
	channel_free_all();
1489
	channel_free_all();
1487
1490
1488
	if (have_pty)
1491
	if (have_pty)
1489
		leave_raw_mode();
1492
		leave_raw_mode(force_tty_flag);
1490
1493
1491
	/* restore blocking io */
1494
	/* restore blocking io */
1492
	if (!isatty(fileno(stdin)))
1495
	if (!isatty(fileno(stdin)))
Lines 2044-2050 client_init_dispatch(void) Link Here
2044
void
2047
void
2045
cleanup_exit(int i)
2048
cleanup_exit(int i)
2046
{
2049
{
2047
	leave_raw_mode();
2050
	leave_raw_mode(force_tty_flag);
2048
	leave_non_blocking();
2051
	leave_non_blocking();
2049
	if (options.control_path != NULL && muxserver_sock != -1)
2052
	if (options.control_path != NULL && muxserver_sock != -1)
2050
		unlink(options.control_path);
2053
		unlink(options.control_path);
(-)mux.c (-2 / +3 lines)
Lines 71-76 Link Here
71
71
72
/* from ssh.c */
72
/* from ssh.c */
73
extern int tty_flag;
73
extern int tty_flag;
74
extern int force_tty_flag;
74
extern Options options;
75
extern Options options;
75
extern int stdin_null_flag;
76
extern int stdin_null_flag;
76
extern char *host;
77
extern char *host;
Lines 671-677 muxclient(const char *path) Link Here
671
	signal(SIGWINCH, control_client_sigrelay);
672
	signal(SIGWINCH, control_client_sigrelay);
672
673
673
	if (tty_flag)
674
	if (tty_flag)
674
		enter_raw_mode();
675
		enter_raw_mode(force_tty_flag);
675
676
676
	/*
677
	/*
677
	 * Stick around until the controlee closes the client_fd.
678
	 * Stick around until the controlee closes the client_fd.
Lines 696-702 muxclient(const char *path) Link Here
696
	}
697
	}
697
698
698
	close(sock);
699
	close(sock);
699
	leave_raw_mode();
700
	leave_raw_mode(force_tty_flag);
700
	if (i > (int)sizeof(int))
701
	if (i > (int)sizeof(int))
701
		fatal("%s: master returned too much data (%d > %lu)",
702
		fatal("%s: master returned too much data (%d > %lu)",
702
		    __func__, i, (u_long)sizeof(int));
703
		    __func__, i, (u_long)sizeof(int));
(-)sshpty.h (-2 / +2 lines)
Lines 17-24 Link Here
17
#include <termios.h>
17
#include <termios.h>
18
18
19
struct termios *get_saved_tio(void);
19
struct termios *get_saved_tio(void);
20
void	 leave_raw_mode(void);
20
void	 leave_raw_mode(int);
21
void	 enter_raw_mode(void);
21
void	 enter_raw_mode(int);
22
22
23
int	 pty_allocate(int *, int *, char *, size_t);
23
int	 pty_allocate(int *, int *, char *, size_t);
24
void	 pty_release(const char *);
24
void	 pty_release(const char *);
(-)sshtty.c (-9 / +12 lines)
Lines 52-74 get_saved_tio(void) Link Here
52
}
52
}
53
53
54
void
54
void
55
leave_raw_mode(void)
55
leave_raw_mode(int quiet)
56
{
56
{
57
	if (!_in_raw_mode)
57
	if (!_in_raw_mode)
58
		return;
58
		return;
59
	if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1)
59
	if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) {
60
		perror("tcsetattr");
60
		if (!quiet)
61
	else
61
			perror("tcsetattr");
62
	} else
62
		_in_raw_mode = 0;
63
		_in_raw_mode = 0;
63
}
64
}
64
65
65
void
66
void
66
enter_raw_mode(void)
67
enter_raw_mode(int quiet)
67
{
68
{
68
	struct termios tio;
69
	struct termios tio;
69
70
70
	if (tcgetattr(fileno(stdin), &tio) == -1) {
71
	if (tcgetattr(fileno(stdin), &tio) == -1) {
71
		perror("tcgetattr");
72
		if (!quiet)
73
			perror("tcgetattr");
72
		return;
74
		return;
73
	}
75
	}
74
	_saved_tio = tio;
76
	_saved_tio = tio;
Lines 84-91 enter_raw_mode(void) Link Here
84
	tio.c_oflag &= ~OPOST;
86
	tio.c_oflag &= ~OPOST;
85
	tio.c_cc[VMIN] = 1;
87
	tio.c_cc[VMIN] = 1;
86
	tio.c_cc[VTIME] = 0;
88
	tio.c_cc[VTIME] = 0;
87
	if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1)
89
	if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) {
88
		perror("tcsetattr");
90
		if (!quiet)
89
	else
91
			perror("tcsetattr");
92
	} else
90
		_in_raw_mode = 1;
93
		_in_raw_mode = 1;
91
}
94
}

Return to bug 1689