]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2010/01/09 05:04:24
authordtucker <dtucker>
Sat, 9 Jan 2010 11:26:23 +0000 (11:26 +0000)
committerdtucker <dtucker>
Sat, 9 Jan 2010 11:26:23 +0000 (11:26 +0000)
     [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@

ChangeLog
clientloop.c
mux.c
sshpty.h
sshtty.c

index 3b7fb6456ae19e0006af960200aa9e3cbd109c4b..b3ae6bdb48d996e47508cd0f20c6b9949278345b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - 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
index eca87777f95102cbe471d2731eb557077a48270c..5793a6e91e2fca9d9a7dc10b84a68f6ab17b5313 100644 (file)
@@ -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>
  * 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);
diff --git a/mux.c b/mux.c
index fac43a71f7fef1e53acd1d63a5b30422d8e14f44..239edd5f5e36737cb1aa5c7ba3c984c208b632c6 100644 (file)
--- a/mux.c
+++ b/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>
  *
@@ -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));
index ac90035846245685f4ecf482a2f95d29fccdb7ab..cfa322480f55aa21397e7efc284ad7522317f4bc 100644 (file)
--- a/sshpty.h
+++ b/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>
@@ -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 *);
index 21ade4e5153dc6ec9ab790ab728700f3049ec813..d214ce3bb1a2e0a1f6cc36891b8a0518177dbf87 100644 (file)
--- a/sshtty.c
+++ b/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>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -54,23 +54,25 @@ 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)
-               perror("tcsetattr");
-       else
+       if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) {
+               if (!quiet)
+                       perror("tcsetattr");
+       } else
                _in_raw_mode = 0;
 }
 
 void
-enter_raw_mode(void)
+enter_raw_mode(int quiet)
 {
        struct termios tio;
 
        if (tcgetattr(fileno(stdin), &tio) == -1) {
-               perror("tcgetattr");
+               if (!quiet)
+                       perror("tcgetattr");
                return;
        }
        _saved_tio = tio;
@@ -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)
-               perror("tcsetattr");
-       else
+       if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) {
+               if (!quiet)
+                       perror("tcsetattr");
+       } else
                _in_raw_mode = 1;
 }
This page took 0.103488 seconds and 5 git commands to generate.