Commit 37c1b3d6 authored by Darren Tucker's avatar Darren Tucker

- djm@cvs.openbsd.org 2010/01/09 05:04:24

     [mux.c sshpty.h clientloop.c sshtty.c]
     quell tc[gs]etattr warnings when forcing a tty (ssh -tt), since we
     usually don't actually have a tty to read/set; bz#1686 ok dtucker@
parent 838891fe
......@@ -16,6 +16,10 @@
- jmc@cvs.openbsd.org 2010/01/09 03:36:00
[sftp-server.8]
bad place to forget a comma...
- djm@cvs.openbsd.org 2010/01/09 05:04:24
[mux.c sshpty.h clientloop.c sshtty.c]
quell tc[gs]etattr warnings when forcing a tty (ssh -tt), since we
usually don't actually have a tty to read/set; bz#1686 ok dtucker@
20091208
- (dtucker) OpenBSD CVS Sync
......
/* $OpenBSD: clientloop.c,v 1.215 2009/11/17 05:31:44 djm Exp $ */
/* $OpenBSD: clientloop.c,v 1.216 2010/01/09 05:04:24 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
......@@ -130,6 +130,9 @@ extern int muxserver_sock;
*/
extern char *host;
/* Force TTY allocation */
extern int force_tty_flag;
/*
* Flag to indicate that we have received a window change signal which has
* not yet been processed. This will cause a message indicating the new
......@@ -610,7 +613,7 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
atomicio(vwrite, fileno(stderr), buffer_ptr(berr),
buffer_len(berr));
leave_raw_mode();
leave_raw_mode(force_tty_flag);
/*
* Free (and clear) the buffer to reduce the amount of data that gets
......@@ -631,7 +634,7 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
buffer_init(bout);
buffer_init(berr);
enter_raw_mode();
enter_raw_mode(force_tty_flag);
}
static void
......@@ -774,7 +777,7 @@ process_cmdline(void)
bzero(&fwd, sizeof(fwd));
fwd.listen_host = fwd.connect_host = NULL;
leave_raw_mode();
leave_raw_mode(force_tty_flag);
handler = signal(SIGINT, SIG_IGN);
cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
if (s == NULL)
......@@ -877,7 +880,7 @@ process_cmdline(void)
out:
signal(SIGINT, handler);
enter_raw_mode();
enter_raw_mode(force_tty_flag);
if (cmd)
xfree(cmd);
if (fwd.listen_host != NULL)
......@@ -996,7 +999,7 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
* more new connections).
*/
/* Restore tty modes. */
leave_raw_mode();
leave_raw_mode(force_tty_flag);
/* Stop listening for new connections. */
channel_stop_listening();
......@@ -1291,7 +1294,7 @@ client_channel_closed(int id, void *arg)
{
channel_cancel_cleanup(id);
session_closed = 1;
leave_raw_mode();
leave_raw_mode(force_tty_flag);
}
/*
......@@ -1364,7 +1367,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
signal(SIGWINCH, window_change_handler);
if (have_pty)
enter_raw_mode();
enter_raw_mode(force_tty_flag);
if (compat20) {
session_ident = ssh2_chan_id;
......@@ -1498,7 +1501,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
channel_free_all();
if (have_pty)
leave_raw_mode();
leave_raw_mode(force_tty_flag);
/* restore blocking io */
if (!isatty(fileno(stdin)))
......@@ -2062,7 +2065,7 @@ client_init_dispatch(void)
void
cleanup_exit(int i)
{
leave_raw_mode();
leave_raw_mode(force_tty_flag);
leave_non_blocking();
if (options.control_path != NULL && muxserver_sock != -1)
unlink(options.control_path);
......
/* $OpenBSD: mux.c,v 1.8 2009/08/20 23:54:28 dtucker Exp $ */
/* $OpenBSD: mux.c,v 1.9 2010/01/09 05:04:24 djm Exp $ */
/*
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
*
......@@ -82,6 +82,7 @@
/* from ssh.c */
extern int tty_flag;
extern int force_tty_flag;
extern Options options;
extern int stdin_null_flag;
extern char *host;
......@@ -683,7 +684,7 @@ muxclient(const char *path)
signal(SIGWINCH, control_client_sigrelay);
if (tty_flag)
enter_raw_mode();
enter_raw_mode(force_tty_flag);
/*
* Stick around until the controlee closes the client_fd.
......@@ -708,7 +709,7 @@ muxclient(const char *path)
}
close(sock);
leave_raw_mode();
leave_raw_mode(force_tty_flag);
if (i > (int)sizeof(int))
fatal("%s: master returned too much data (%d > %lu)",
__func__, i, (u_long)sizeof(int));
......
/* $OpenBSD: sshpty.h,v 1.11 2008/05/19 15:45:07 djm Exp $ */
/* $OpenBSD: sshpty.h,v 1.12 2010/01/09 05:04:24 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
......@@ -17,8 +17,8 @@
#include <termios.h>
struct termios *get_saved_tio(void);
void leave_raw_mode(void);
void enter_raw_mode(void);
void leave_raw_mode(int);
void enter_raw_mode(int);
int pty_allocate(int *, int *, char *, size_t);
void pty_release(const char *);
......
/* $OpenBSD: sshtty.c,v 1.13 2008/05/19 15:45:07 djm Exp $ */
/* $OpenBSD: sshtty.c,v 1.14 2010/01/09 05:04:24 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
......@@ -54,22 +54,24 @@ get_saved_tio(void)
}
void
leave_raw_mode(void)
leave_raw_mode(int quiet)
{
if (!_in_raw_mode)
return;
if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1)
if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) {
if (!quiet)
perror("tcsetattr");
else
} else
_in_raw_mode = 0;
}
void
enter_raw_mode(void)
enter_raw_mode(int quiet)
{
struct termios tio;
if (tcgetattr(fileno(stdin), &tio) == -1) {
if (!quiet)
perror("tcgetattr");
return;
}
......@@ -86,8 +88,9 @@ enter_raw_mode(void)
tio.c_oflag &= ~OPOST;
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1)
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) {
if (!quiet)
perror("tcsetattr");
else
} else
_in_raw_mode = 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment