summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2003-09-01 02:05:26 +0000
committerColin Watson <cjwatson@debian.org>2003-09-01 02:05:26 +0000
commit6d5a72bc1d98a42ba42f082e50a22e911c1d82d3 (patch)
tree1bf23174bdb6fc71e2846dda0eca195a418484e7 /packet.c
parent2ee26b431f98cf1dc0e4fb9809ad1e0c879b8c08 (diff)
parent58657d96514cd6f16d82add8d6f4adbb36765758 (diff)
Debian release 3.5p1-1.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/packet.c b/packet.c
index 273ffea58..dbd3791d2 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.96 2002/06/23 21:10:02 deraadt Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.97 2002/07/04 08:12:15 deraadt Exp $");
41 41
42#include "xmalloc.h" 42#include "xmalloc.h"
43#include "buffer.h" 43#include "buffer.h"
@@ -136,6 +136,7 @@ void
136packet_set_connection(int fd_in, int fd_out, int new_setup_timeout) 136packet_set_connection(int fd_in, int fd_out, int new_setup_timeout)
137{ 137{
138 Cipher *none = cipher_by_name("none"); 138 Cipher *none = cipher_by_name("none");
139
139 if (none == NULL) 140 if (none == NULL)
140 fatal("packet_set_connection: cannot load cipher 'none'"); 141 fatal("packet_set_connection: cannot load cipher 'none'");
141 connection_in = fd_in; 142 connection_in = fd_in;
@@ -405,6 +406,7 @@ packet_set_encryption_key(const u_char *key, u_int keylen,
405 int number) 406 int number)
406{ 407{
407 Cipher *cipher = cipher_by_number(number); 408 Cipher *cipher = cipher_by_number(number);
409
408 if (cipher == NULL) 410 if (cipher == NULL)
409 fatal("packet_set_encryption_key: unknown cipher number %d", number); 411 fatal("packet_set_encryption_key: unknown cipher number %d", number);
410 if (keylen < 20) 412 if (keylen < 20)
@@ -446,6 +448,7 @@ void
446packet_put_char(int value) 448packet_put_char(int value)
447{ 449{
448 char ch = value; 450 char ch = value;
451
449 buffer_append(&outgoing_packet, &ch, 1); 452 buffer_append(&outgoing_packet, &ch, 1);
450} 453}
451void 454void
@@ -1008,7 +1011,8 @@ packet_read_poll2(u_int32_t *seqnr_p)
1008 buffer_clear(&incoming_packet); 1011 buffer_clear(&incoming_packet);
1009 buffer_append(&incoming_packet, buffer_ptr(&compression_buffer), 1012 buffer_append(&incoming_packet, buffer_ptr(&compression_buffer),
1010 buffer_len(&compression_buffer)); 1013 buffer_len(&compression_buffer));
1011 DBG(debug("input: len after de-compress %d", buffer_len(&incoming_packet))); 1014 DBG(debug("input: len after de-compress %d",
1015 buffer_len(&incoming_packet)));
1012 } 1016 }
1013 /* 1017 /*
1014 * get packet type, implies consume. 1018 * get packet type, implies consume.
@@ -1116,6 +1120,7 @@ u_int
1116packet_get_char(void) 1120packet_get_char(void)
1117{ 1121{
1118 char ch; 1122 char ch;
1123
1119 buffer_get(&incoming_packet, &ch, 1); 1124 buffer_get(&incoming_packet, &ch, 1);
1120 return (u_char) ch; 1125 return (u_char) ch;
1121} 1126}
@@ -1149,6 +1154,7 @@ void *
1149packet_get_raw(int *length_ptr) 1154packet_get_raw(int *length_ptr)
1150{ 1155{
1151 int bytes = buffer_len(&incoming_packet); 1156 int bytes = buffer_len(&incoming_packet);
1157
1152 if (length_ptr != NULL) 1158 if (length_ptr != NULL)
1153 *length_ptr = bytes; 1159 *length_ptr = bytes;
1154 return buffer_ptr(&incoming_packet); 1160 return buffer_ptr(&incoming_packet);
@@ -1221,6 +1227,7 @@ packet_disconnect(const char *fmt,...)
1221 char buf[1024]; 1227 char buf[1024];
1222 va_list args; 1228 va_list args;
1223 static int disconnecting = 0; 1229 static int disconnecting = 0;
1230
1224 if (disconnecting) /* Guard against recursive invocations. */ 1231 if (disconnecting) /* Guard against recursive invocations. */
1225 fatal("packet_disconnect called recursively."); 1232 fatal("packet_disconnect called recursively.");
1226 disconnecting = 1; 1233 disconnecting = 1;
@@ -1263,6 +1270,7 @@ void
1263packet_write_poll(void) 1270packet_write_poll(void)
1264{ 1271{
1265 int len = buffer_len(&output); 1272 int len = buffer_len(&output);
1273
1266 if (len > 0) { 1274 if (len > 0) {
1267 len = write(connection_out, buffer_ptr(&output), len); 1275 len = write(connection_out, buffer_ptr(&output), len);
1268 if (len <= 0) { 1276 if (len <= 0) {
@@ -1382,6 +1390,7 @@ int
1382packet_set_maxsize(int s) 1390packet_set_maxsize(int s)
1383{ 1391{
1384 static int called = 0; 1392 static int called = 0;
1393
1385 if (called) { 1394 if (called) {
1386 log("packet_set_maxsize: called twice: old %d new %d", 1395 log("packet_set_maxsize: called twice: old %d new %d",
1387 max_packet_size, s); 1396 max_packet_size, s);