Bugzilla – Attachment 1502 Details for
Bug 1199
ssh sends invalid ttymodes when stdin is not a tty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
revised patch
ttymodesstdin.diff (text/plain), 3.19 KB, created by
Damien Miller
on 2008-05-19 11:35:08 AEST
(
hide
)
Description:
revised patch
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2008-05-19 11:35:08 AEST
Size:
3.19 KB
patch
obsolete
>Index: ttymodes.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ttymodes.c,v >retrieving revision 1.26 >diff -u -p -r1.26 ttymodes.c >--- ttymodes.c 3 Aug 2006 03:34:42 -0000 1.26 >+++ ttymodes.c 19 May 2008 01:25:38 -0000 >@@ -270,6 +270,10 @@ tty_make_modes(int fd, struct termios *t > } > > if (tiop == NULL) { >+ if (fd == -1) { >+ debug("tty_make_modes: no fd or tio"); >+ goto end; >+ } > if (tcgetattr(fd, &tio) == -1) { > logit("tcgetattr: %.100s", strerror(errno)); > goto end; >@@ -289,12 +293,10 @@ tty_make_modes(int fd, struct termios *t > > /* Store values of mode flags. */ > #define TTYCHAR(NAME, OP) \ >- debug3("tty_make_modes: %d %d", OP, tio.c_cc[NAME]); \ > buffer_put_char(&buf, OP); \ > put_arg(&buf, tio.c_cc[NAME]); > > #define TTYMODE(NAME, FIELD, OP) \ >- debug3("tty_make_modes: %d %d", OP, ((tio.FIELD & NAME) != 0)); \ > buffer_put_char(&buf, OP); \ > put_arg(&buf, ((tio.FIELD & NAME) != 0)); > >@@ -382,7 +384,6 @@ tty_parse_modes(int fd, int *n_bytes_ptr > case OP: \ > n_bytes += arg_size; \ > tio.c_cc[NAME] = get_arg(); \ >- debug3("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \ > break; > #define TTYMODE(NAME, FIELD, OP) \ > case OP: \ >@@ -391,7 +392,6 @@ tty_parse_modes(int fd, int *n_bytes_ptr > tio.FIELD |= NAME; \ > else \ > tio.FIELD &= ~NAME; \ >- debug3("tty_parse_modes: %d %d", OP, arg); \ > break; > > #include "ttymodes.h" >Index: sshtty.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sshtty.c,v >retrieving revision 1.12 >diff -u -p -r1.12 sshtty.c >--- sshtty.c 3 Aug 2006 03:34:42 -0000 1.12 >+++ sshtty.c 19 May 2008 01:25:38 -0000 >@@ -45,10 +45,10 @@ > static struct termios _saved_tio; > static int _in_raw_mode = 0; > >-struct termios >+struct termios * > get_saved_tio(void) > { >- return _saved_tio; >+ return _in_raw_mode ? &_saved_tio : NULL; > } > > void >Index: sshpty.h >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sshpty.h,v >retrieving revision 1.10 >diff -u -p -r1.10 sshpty.h >--- sshpty.h 3 Aug 2006 03:34:42 -0000 1.10 >+++ sshpty.h 19 May 2008 01:25:38 -0000 >@@ -16,7 +16,7 @@ > > #include <termios.h> > >-struct termios get_saved_tio(void); >+struct termios *get_saved_tio(void); > void leave_raw_mode(void); > void enter_raw_mode(void); > >Index: clientloop.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/clientloop.c,v >retrieving revision 1.193 >diff -u -p -r1.193 clientloop.c >--- clientloop.c 9 May 2008 16:21:13 -0000 1.193 >+++ clientloop.c 19 May 2008 01:25:38 -0000 >@@ -1711,7 +1711,6 @@ client_session2_setup(int id, int want_t > > if (want_tty) { > struct winsize ws; >- struct termios tio; > > /* Store window size in the packet. */ > if (ioctl(in_fd, TIOCGWINSZ, &ws) < 0) >@@ -1724,8 +1723,9 @@ client_session2_setup(int id, int want_t > packet_put_int((u_int)ws.ws_row); > packet_put_int((u_int)ws.ws_xpixel); > packet_put_int((u_int)ws.ws_ypixel); >- tio = get_saved_tio(); >- tty_make_modes(-1, tiop != NULL ? tiop : &tio); >+ if (tiop == NULL) >+ tiop = get_saved_tio(); >+ tty_make_modes(-1, tiop); > packet_send(); > /* XXX wait for reply */ > c->client_tty = 1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1199
:
1146
| 1502