=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/packet.c,v retrieving revision 1.70.2.5 retrieving revision 1.70.2.6 diff -u -r1.70.2.5 -r1.70.2.6 --- src/usr.bin/ssh/packet.c 2002/06/26 18:22:35 1.70.2.5 +++ src/usr.bin/ssh/packet.c 2002/10/11 14:53:06 1.70.2.6 @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.70.2.5 2002/06/26 18:22:35 miod Exp $"); +RCSID("$OpenBSD: packet.c,v 1.70.2.6 2002/10/11 14:53:06 miod 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; @@ -397,6 +398,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) @@ -438,6 +440,7 @@ packet_put_char(int value) { char ch = value; + buffer_append(&outgoing_packet, &ch, 1); } void @@ -989,7 +992,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. @@ -1097,6 +1101,7 @@ packet_get_char(void) { char ch; + buffer_get(&incoming_packet, &ch, 1); return (u_char) ch; } @@ -1130,6 +1135,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); @@ -1202,6 +1208,7 @@ char buf[1024]; va_list args; static int disconnecting = 0; + if (disconnecting) /* Guard against recursive invocations. */ fatal("packet_disconnect called recursively."); disconnecting = 1; @@ -1244,6 +1251,7 @@ packet_write_poll(void) { int len = buffer_len(&output); + if (len > 0) { len = write(connection_out, buffer_ptr(&output), len); if (len <= 0) { @@ -1357,6 +1365,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);