summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-07-07 22:11:51 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-07-07 22:11:51 +0000
commit8b2eecdf9f6769520e2601d5de58991d5810873d (patch)
tree04927aec099cdf40df3fe7d220ca6a199ddea7c6 /packet.c
parentc51b924a80a17d6cf47c25c2c118385d4ecc87c8 (diff)
- 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...
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 a5b2ab61a..bd347ef0f 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"
@@ -134,6 +134,7 @@ void
134packet_set_connection(int fd_in, int fd_out) 134packet_set_connection(int fd_in, int fd_out)
135{ 135{
136 Cipher *none = cipher_by_name("none"); 136 Cipher *none = cipher_by_name("none");
137
137 if (none == NULL) 138 if (none == NULL)
138 fatal("packet_set_connection: cannot load cipher 'none'"); 139 fatal("packet_set_connection: cannot load cipher 'none'");
139 connection_in = fd_in; 140 connection_in = fd_in;
@@ -402,6 +403,7 @@ packet_set_encryption_key(const u_char *key, u_int keylen,
402 int number) 403 int number)
403{ 404{
404 Cipher *cipher = cipher_by_number(number); 405 Cipher *cipher = cipher_by_number(number);
406
405 if (cipher == NULL) 407 if (cipher == NULL)
406 fatal("packet_set_encryption_key: unknown cipher number %d", number); 408 fatal("packet_set_encryption_key: unknown cipher number %d", number);
407 if (keylen < 20) 409 if (keylen < 20)
@@ -443,6 +445,7 @@ void
443packet_put_char(int value) 445packet_put_char(int value)
444{ 446{
445 char ch = value; 447 char ch = value;
448
446 buffer_append(&outgoing_packet, &ch, 1); 449 buffer_append(&outgoing_packet, &ch, 1);
447} 450}
448void 451void
@@ -994,7 +997,8 @@ packet_read_poll2(u_int32_t *seqnr_p)
994 buffer_clear(&incoming_packet); 997 buffer_clear(&incoming_packet);
995 buffer_append(&incoming_packet, buffer_ptr(&compression_buffer), 998 buffer_append(&incoming_packet, buffer_ptr(&compression_buffer),
996 buffer_len(&compression_buffer)); 999 buffer_len(&compression_buffer));
997 DBG(debug("input: len after de-compress %d", buffer_len(&incoming_packet))); 1000 DBG(debug("input: len after de-compress %d",
1001 buffer_len(&incoming_packet)));
998 } 1002 }
999 /* 1003 /*
1000 * get packet type, implies consume. 1004 * get packet type, implies consume.
@@ -1102,6 +1106,7 @@ u_int
1102packet_get_char(void) 1106packet_get_char(void)
1103{ 1107{
1104 char ch; 1108 char ch;
1109
1105 buffer_get(&incoming_packet, &ch, 1); 1110 buffer_get(&incoming_packet, &ch, 1);
1106 return (u_char) ch; 1111 return (u_char) ch;
1107} 1112}
@@ -1135,6 +1140,7 @@ void *
1135packet_get_raw(int *length_ptr) 1140packet_get_raw(int *length_ptr)
1136{ 1141{
1137 int bytes = buffer_len(&incoming_packet); 1142 int bytes = buffer_len(&incoming_packet);
1143
1138 if (length_ptr != NULL) 1144 if (length_ptr != NULL)
1139 *length_ptr = bytes; 1145 *length_ptr = bytes;
1140 return buffer_ptr(&incoming_packet); 1146 return buffer_ptr(&incoming_packet);
@@ -1207,6 +1213,7 @@ packet_disconnect(const char *fmt,...)
1207 char buf[1024]; 1213 char buf[1024];
1208 va_list args; 1214 va_list args;
1209 static int disconnecting = 0; 1215 static int disconnecting = 0;
1216
1210 if (disconnecting) /* Guard against recursive invocations. */ 1217 if (disconnecting) /* Guard against recursive invocations. */
1211 fatal("packet_disconnect called recursively."); 1218 fatal("packet_disconnect called recursively.");
1212 disconnecting = 1; 1219 disconnecting = 1;
@@ -1249,6 +1256,7 @@ void
1249packet_write_poll(void) 1256packet_write_poll(void)
1250{ 1257{
1251 int len = buffer_len(&output); 1258 int len = buffer_len(&output);
1259
1252 if (len > 0) { 1260 if (len > 0) {
1253 len = write(connection_out, buffer_ptr(&output), len); 1261 len = write(connection_out, buffer_ptr(&output), len);
1254 if (len <= 0) { 1262 if (len <= 0) {
@@ -1368,6 +1376,7 @@ int
1368packet_set_maxsize(int s) 1376packet_set_maxsize(int s)
1369{ 1377{
1370 static int called = 0; 1378 static int called = 0;
1379
1371 if (called) { 1380 if (called) {
1372 log("packet_set_maxsize: called twice: old %d new %d", 1381 log("packet_set_maxsize: called twice: old %d new %d",
1373 max_packet_size, s); 1382 max_packet_size, s);