mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-26 23:34:55 +02:00
- 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@
This commit is contained in:
parent
838891fe85
commit
37c1b3d6fc
@ -16,6 +16,10 @@
|
|||||||
- jmc@cvs.openbsd.org 2010/01/09 03:36:00
|
- jmc@cvs.openbsd.org 2010/01/09 03:36:00
|
||||||
[sftp-server.8]
|
[sftp-server.8]
|
||||||
bad place to forget a comma...
|
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
|
20091208
|
||||||
- (dtucker) OpenBSD CVS Sync
|
- (dtucker) OpenBSD CVS Sync
|
||||||
|
23
clientloop.c
23
clientloop.c
@ -1,4 +1,4 @@
|
|||||||
/* $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>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -130,6 +130,9 @@ extern int muxserver_sock;
|
|||||||
*/
|
*/
|
||||||
extern char *host;
|
extern char *host;
|
||||||
|
|
||||||
|
/* Force TTY allocation */
|
||||||
|
extern int force_tty_flag;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flag to indicate that we have received a window change signal which has
|
* 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
|
* 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),
|
atomicio(vwrite, fileno(stderr), buffer_ptr(berr),
|
||||||
buffer_len(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
|
* 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(bout);
|
||||||
buffer_init(berr);
|
buffer_init(berr);
|
||||||
|
|
||||||
enter_raw_mode();
|
enter_raw_mode(force_tty_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -774,7 +777,7 @@ process_cmdline(void)
|
|||||||
bzero(&fwd, sizeof(fwd));
|
bzero(&fwd, sizeof(fwd));
|
||||||
fwd.listen_host = fwd.connect_host = NULL;
|
fwd.listen_host = fwd.connect_host = NULL;
|
||||||
|
|
||||||
leave_raw_mode();
|
leave_raw_mode(force_tty_flag);
|
||||||
handler = signal(SIGINT, SIG_IGN);
|
handler = signal(SIGINT, SIG_IGN);
|
||||||
cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
|
cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
@ -877,7 +880,7 @@ process_cmdline(void)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
signal(SIGINT, handler);
|
signal(SIGINT, handler);
|
||||||
enter_raw_mode();
|
enter_raw_mode(force_tty_flag);
|
||||||
if (cmd)
|
if (cmd)
|
||||||
xfree(cmd);
|
xfree(cmd);
|
||||||
if (fwd.listen_host != NULL)
|
if (fwd.listen_host != NULL)
|
||||||
@ -996,7 +999,7 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
|
|||||||
* more new connections).
|
* more new connections).
|
||||||
*/
|
*/
|
||||||
/* Restore tty modes. */
|
/* Restore tty modes. */
|
||||||
leave_raw_mode();
|
leave_raw_mode(force_tty_flag);
|
||||||
|
|
||||||
/* Stop listening for new connections. */
|
/* Stop listening for new connections. */
|
||||||
channel_stop_listening();
|
channel_stop_listening();
|
||||||
@ -1291,7 +1294,7 @@ client_channel_closed(int id, void *arg)
|
|||||||
{
|
{
|
||||||
channel_cancel_cleanup(id);
|
channel_cancel_cleanup(id);
|
||||||
session_closed = 1;
|
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);
|
signal(SIGWINCH, window_change_handler);
|
||||||
|
|
||||||
if (have_pty)
|
if (have_pty)
|
||||||
enter_raw_mode();
|
enter_raw_mode(force_tty_flag);
|
||||||
|
|
||||||
if (compat20) {
|
if (compat20) {
|
||||||
session_ident = ssh2_chan_id;
|
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();
|
channel_free_all();
|
||||||
|
|
||||||
if (have_pty)
|
if (have_pty)
|
||||||
leave_raw_mode();
|
leave_raw_mode(force_tty_flag);
|
||||||
|
|
||||||
/* restore blocking io */
|
/* restore blocking io */
|
||||||
if (!isatty(fileno(stdin)))
|
if (!isatty(fileno(stdin)))
|
||||||
@ -2062,7 +2065,7 @@ client_init_dispatch(void)
|
|||||||
void
|
void
|
||||||
cleanup_exit(int i)
|
cleanup_exit(int i)
|
||||||
{
|
{
|
||||||
leave_raw_mode();
|
leave_raw_mode(force_tty_flag);
|
||||||
leave_non_blocking();
|
leave_non_blocking();
|
||||||
if (options.control_path != NULL && muxserver_sock != -1)
|
if (options.control_path != NULL && muxserver_sock != -1)
|
||||||
unlink(options.control_path);
|
unlink(options.control_path);
|
||||||
|
7
mux.c
7
mux.c
@ -1,4 +1,4 @@
|
|||||||
/* $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>
|
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
|
||||||
*
|
*
|
||||||
@ -82,6 +82,7 @@
|
|||||||
|
|
||||||
/* from ssh.c */
|
/* from ssh.c */
|
||||||
extern int tty_flag;
|
extern int tty_flag;
|
||||||
|
extern int force_tty_flag;
|
||||||
extern Options options;
|
extern Options options;
|
||||||
extern int stdin_null_flag;
|
extern int stdin_null_flag;
|
||||||
extern char *host;
|
extern char *host;
|
||||||
@ -683,7 +684,7 @@ muxclient(const char *path)
|
|||||||
signal(SIGWINCH, control_client_sigrelay);
|
signal(SIGWINCH, control_client_sigrelay);
|
||||||
|
|
||||||
if (tty_flag)
|
if (tty_flag)
|
||||||
enter_raw_mode();
|
enter_raw_mode(force_tty_flag);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stick around until the controlee closes the client_fd.
|
* Stick around until the controlee closes the client_fd.
|
||||||
@ -708,7 +709,7 @@ muxclient(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(sock);
|
close(sock);
|
||||||
leave_raw_mode();
|
leave_raw_mode(force_tty_flag);
|
||||||
if (i > (int)sizeof(int))
|
if (i > (int)sizeof(int))
|
||||||
fatal("%s: master returned too much data (%d > %lu)",
|
fatal("%s: master returned too much data (%d > %lu)",
|
||||||
__func__, i, (u_long)sizeof(int));
|
__func__, i, (u_long)sizeof(int));
|
||||||
|
6
sshpty.h
6
sshpty.h
@ -1,4 +1,4 @@
|
|||||||
/* $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>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -17,8 +17,8 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
struct termios *get_saved_tio(void);
|
struct termios *get_saved_tio(void);
|
||||||
void leave_raw_mode(void);
|
void leave_raw_mode(int);
|
||||||
void enter_raw_mode(void);
|
void enter_raw_mode(int);
|
||||||
|
|
||||||
int pty_allocate(int *, int *, char *, size_t);
|
int pty_allocate(int *, int *, char *, size_t);
|
||||||
void pty_release(const char *);
|
void pty_release(const char *);
|
||||||
|
23
sshtty.c
23
sshtty.c
@ -1,4 +1,4 @@
|
|||||||
/* $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>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -54,23 +54,25 @@ get_saved_tio(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
leave_raw_mode(void)
|
leave_raw_mode(int quiet)
|
||||||
{
|
{
|
||||||
if (!_in_raw_mode)
|
if (!_in_raw_mode)
|
||||||
return;
|
return;
|
||||||
if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1)
|
if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) {
|
||||||
perror("tcsetattr");
|
if (!quiet)
|
||||||
else
|
perror("tcsetattr");
|
||||||
|
} else
|
||||||
_in_raw_mode = 0;
|
_in_raw_mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
enter_raw_mode(void)
|
enter_raw_mode(int quiet)
|
||||||
{
|
{
|
||||||
struct termios tio;
|
struct termios tio;
|
||||||
|
|
||||||
if (tcgetattr(fileno(stdin), &tio) == -1) {
|
if (tcgetattr(fileno(stdin), &tio) == -1) {
|
||||||
perror("tcgetattr");
|
if (!quiet)
|
||||||
|
perror("tcgetattr");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_saved_tio = tio;
|
_saved_tio = tio;
|
||||||
@ -86,8 +88,9 @@ enter_raw_mode(void)
|
|||||||
tio.c_oflag &= ~OPOST;
|
tio.c_oflag &= ~OPOST;
|
||||||
tio.c_cc[VMIN] = 1;
|
tio.c_cc[VMIN] = 1;
|
||||||
tio.c_cc[VTIME] = 0;
|
tio.c_cc[VTIME] = 0;
|
||||||
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1)
|
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) {
|
||||||
perror("tcsetattr");
|
if (!quiet)
|
||||||
else
|
perror("tcsetattr");
|
||||||
|
} else
|
||||||
_in_raw_mode = 1;
|
_in_raw_mode = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user