- deraadt@cvs.openbsd.org 2002/07/04 08:12:15
[channels.c packet.c]
blah blah minor nothing as i read and re-read and re-read...
diff --git a/packet.c b/packet.c
index a5b2ab6..bd347ef 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: packet.c,v 1.96 2002/06/23 21:10:02 deraadt Exp $");
+RCSID("$OpenBSD: packet.c,v 1.97 2002/07/04 08:12:15 deraadt Exp $");
#include "xmalloc.h"
#include "buffer.h"
@@ -134,6 +134,7 @@
packet_set_connection(int fd_in, int fd_out)
{
Cipher *none = cipher_by_name("none");
+
if (none == NULL)
fatal("packet_set_connection: cannot load cipher 'none'");
connection_in = fd_in;
@@ -402,6 +403,7 @@
int number)
{
Cipher *cipher = cipher_by_number(number);
+
if (cipher == NULL)
fatal("packet_set_encryption_key: unknown cipher number %d", number);
if (keylen < 20)
@@ -443,6 +445,7 @@
packet_put_char(int value)
{
char ch = value;
+
buffer_append(&outgoing_packet, &ch, 1);
}
void
@@ -994,7 +997,8 @@
buffer_clear(&incoming_packet);
buffer_append(&incoming_packet, buffer_ptr(&compression_buffer),
buffer_len(&compression_buffer));
- DBG(debug("input: len after de-compress %d", buffer_len(&incoming_packet)));
+ DBG(debug("input: len after de-compress %d",
+ buffer_len(&incoming_packet)));
}
/*
* get packet type, implies consume.
@@ -1102,6 +1106,7 @@
packet_get_char(void)
{
char ch;
+
buffer_get(&incoming_packet, &ch, 1);
return (u_char) ch;
}
@@ -1135,6 +1140,7 @@
packet_get_raw(int *length_ptr)
{
int bytes = buffer_len(&incoming_packet);
+
if (length_ptr != NULL)
*length_ptr = bytes;
return buffer_ptr(&incoming_packet);
@@ -1207,6 +1213,7 @@
char buf[1024];
va_list args;
static int disconnecting = 0;
+
if (disconnecting) /* Guard against recursive invocations. */
fatal("packet_disconnect called recursively.");
disconnecting = 1;
@@ -1249,6 +1256,7 @@
packet_write_poll(void)
{
int len = buffer_len(&output);
+
if (len > 0) {
len = write(connection_out, buffer_ptr(&output), len);
if (len <= 0) {
@@ -1368,6 +1376,7 @@
packet_set_maxsize(int s)
{
static int called = 0;
+
if (called) {
log("packet_set_maxsize: called twice: old %d new %d",
max_packet_size, s);