*/
#include "includes.h"
-RCSID("$OpenBSD: ttymodes.c,v 1.12 2001/04/14 16:33:20 stevesk Exp $");
+RCSID("$OpenBSD: ttymodes.c,v 1.17 2002/03/19 10:49:35 markus Exp $");
#include "packet.h"
#include "log.h"
/* Store input and output baud rates. */
baud = speed_to_baud(cfgetospeed(&tio));
- debug2("tty_make_modes: ospeed %d", baud);
+ debug3("tty_make_modes: ospeed %d", baud);
buffer_put_char(&buf, tty_op_ospeed);
buffer_put_int(&buf, baud);
baud = speed_to_baud(cfgetispeed(&tio));
- debug2("tty_make_modes: ispeed %d", baud);
+ debug3("tty_make_modes: ispeed %d", baud);
buffer_put_char(&buf, tty_op_ispeed);
buffer_put_int(&buf, baud);
/* Store values of mode flags. */
#define TTYCHAR(NAME, OP) \
- debug2("tty_make_modes: %d %d", OP, tio.c_cc[NAME]); \
+ 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) \
- debug2("tty_make_modes: %d %d", OP, ((tio.FIELD & NAME) != 0)); \
+ debug3("tty_make_modes: %d %d", OP, ((tio.FIELD & NAME) != 0)); \
buffer_put_char(&buf, OP); \
put_arg(&buf, ((tio.FIELD & NAME) != 0));
if (compat20) {
*n_bytes_ptr = packet_get_int();
- debug2("tty_parse_modes: SSH2 n_bytes %d", *n_bytes_ptr);
+ debug3("tty_parse_modes: SSH2 n_bytes %d", *n_bytes_ptr);
if (*n_bytes_ptr == 0)
return;
get_arg = packet_get_int;
case TTY_OP_ISPEED_PROTO2:
n_bytes += 4;
baud = packet_get_int();
- debug2("tty_parse_modes: ispeed %d", baud);
+ debug3("tty_parse_modes: ispeed %d", baud);
if (failure != -1 && cfsetispeed(&tio, baud_to_speed(baud)) == -1)
error("cfsetispeed failed for %d", baud);
break;
case TTY_OP_OSPEED_PROTO2:
n_bytes += 4;
baud = packet_get_int();
- debug2("tty_parse_modes: ospeed %d", baud);
+ debug3("tty_parse_modes: ospeed %d", baud);
if (failure != -1 && cfsetospeed(&tio, baud_to_speed(baud)) == -1)
error("cfsetospeed failed for %d", baud);
break;
case OP: \
n_bytes += arg_size; \
tio.c_cc[NAME] = get_arg(); \
- debug2("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \
+ debug3("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \
break;
#define TTYMODE(NAME, FIELD, OP) \
case OP: \
tio.FIELD |= NAME; \
else \
tio.FIELD &= ~NAME; \
- debug2("tty_parse_modes: %d %d", OP, arg); \
+ debug3("tty_parse_modes: %d %d", OP, arg); \
break;
#include "ttymodes.h"
default:
debug("Ignoring unsupported tty mode opcode %d (0x%x)",
- opcode, opcode);
+ opcode, opcode);
if (!compat20) {
/*
* SSH1:
* Opcodes 1 to 127 are defined to have
* a one-byte argument.
- * Opcodes 128 to 159 are defined to have
- * an integer argument.
- */
+ * Opcodes 128 to 159 are defined to have
+ * an integer argument.
+ */
if (opcode > 0 && opcode < 128) {
n_bytes += 1;
(void) packet_get_char();
break;
} else if (opcode >= 128 && opcode < 160) {
- n_bytes += 4;
- (void) packet_get_int();
- break;
+ n_bytes += 4;
+ (void) packet_get_int();
+ break;
} else {
/*
* It is a truly undefined opcode (160 to 255).
* more coming after the mode data.
*/
log("parse_tty_modes: unknown opcode %d", opcode);
- packet_integrity_check(0, 1, SSH_CMSG_REQUEST_PTY);
goto set;
- }
+ }
} else {
/*
* SSH2:
- * Opcodes 0 to 159 are defined to have
+ * Opcodes 1 to 159 are defined to have
* a uint32 argument.
* Opcodes 160 to 255 are undefined and
* cause parsing to stop.
log("parse_tty_modes: unknown opcode %d", opcode);
goto set;
}
- }
+ }
}
}
return; /* Don't process bytes passed */
}
if (failure == -1)
- return; /* Packet parsed ok but tty stuff failed */
+ return; /* Packet parsed ok but tcgetattr() failed */
/* Set the new modes for the terminal. */
if (tcsetattr(fd, TCSANOW, &tio) == -1)