summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-08-16 21:32:09 +1000
committerDamien Miller <djm@mindrot.org>2005-08-16 21:32:09 +1000
commit1d10976c161cfb2e7ec114b7c72885e6f195a3d5 (patch)
tree74c1002a6cd8c8c011de4b2cba6fbbeafd606f91
parentc1819c831f044905298ca91cf5848aba3177be00 (diff)
- (djm) [ttymodes.c] bugzilla #1054: Fix encoding of _POSIX_VDISABLE,
from Jacob Nevins; ok dtucker@
-rw-r--r--ChangeLog6
-rw-r--r--ttymodes.c30
2 files changed, 33 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1eba83b1c..e77dd1f4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120050816
2 - (djm) [ttymodes.c] bugzilla #1054: Fix encoding of _POSIX_VDISABLE,
3 from Jacob Nevins; ok dtucker@
4
120050815 520050815
2 - (tim) [sftp.c] wrap el_end() in #ifdef USE_LIBEDIT 6 - (tim) [sftp.c] wrap el_end() in #ifdef USE_LIBEDIT
3 - (tim) [configure.ac] corrections to libedit tests. Report and patches 7 - (tim) [configure.ac] corrections to libedit tests. Report and patches
@@ -2937,4 +2941,4 @@
2937 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 2941 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
2938 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 2942 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
2939 2943
2940$Id: ChangeLog,v 1.3873 2005/08/16 00:48:40 tim Exp $ 2944$Id: ChangeLog,v 1.3874 2005/08/16 11:32:09 djm Exp $
diff --git a/ttymodes.c b/ttymodes.c
index c32e213a4..cf4c7d5c6 100644
--- a/ttymodes.c
+++ b/ttymodes.c
@@ -241,6 +241,32 @@ baud_to_speed(int baud)
241} 241}
242 242
243/* 243/*
244 * Encode a special character into SSH line format.
245 */
246static u_int
247special_char_encode(cc_t c)
248{
249#ifdef _POSIX_VDISABLE
250 if (c == _POSIX_VDISABLE)
251 return 255;
252#endif /* _POSIX_VDISABLE */
253 return c;
254}
255
256/*
257 * Decode a special character from SSH line format.
258 */
259static cc_t
260special_char_decode(u_int c)
261{
262#ifdef _POSIX_VDISABLE
263 if (c == 255)
264 return _POSIX_VDISABLE;
265#endif /* _POSIX_VDISABLE */
266 return c;
267}
268
269/*
244 * Encodes terminal modes for the terminal referenced by fd 270 * Encodes terminal modes for the terminal referenced by fd
245 * or tiop in a portable manner, and appends the modes to a packet 271 * or tiop in a portable manner, and appends the modes to a packet
246 * being constructed. 272 * being constructed.
@@ -287,7 +313,7 @@ tty_make_modes(int fd, struct termios *tiop)
287#define TTYCHAR(NAME, OP) \ 313#define TTYCHAR(NAME, OP) \
288 debug3("tty_make_modes: %d %d", OP, tio.c_cc[NAME]); \ 314 debug3("tty_make_modes: %d %d", OP, tio.c_cc[NAME]); \
289 buffer_put_char(&buf, OP); \ 315 buffer_put_char(&buf, OP); \
290 put_arg(&buf, tio.c_cc[NAME]); 316 put_arg(&buf, special_char_encode(tio.c_cc[NAME]));
291 317
292#define TTYMODE(NAME, FIELD, OP) \ 318#define TTYMODE(NAME, FIELD, OP) \
293 debug3("tty_make_modes: %d %d", OP, ((tio.FIELD & NAME) != 0)); \ 319 debug3("tty_make_modes: %d %d", OP, ((tio.FIELD & NAME) != 0)); \
@@ -375,7 +401,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
375#define TTYCHAR(NAME, OP) \ 401#define TTYCHAR(NAME, OP) \
376 case OP: \ 402 case OP: \
377 n_bytes += arg_size; \ 403 n_bytes += arg_size; \
378 tio.c_cc[NAME] = get_arg(); \ 404 tio.c_cc[NAME] = special_char_decode(get_arg()); \
379 debug3("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \ 405 debug3("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \
380 break; 406 break;
381#define TTYMODE(NAME, FIELD, OP) \ 407#define TTYMODE(NAME, FIELD, OP) \