[channels.c packet.c]
     blah blah minor nothing as i read and re-read and re-read...
This commit is contained in:
Ben Lindstrom 2002-07-07 22:11:51 +00:00
parent c51b924a80
commit 8b2eecdf9f
3 changed files with 27 additions and 4 deletions

View File

@ -9,6 +9,9 @@
- deraadt@cvs.openbsd.org 2002/07/04 04:15:33 - deraadt@cvs.openbsd.org 2002/07/04 04:15:33
[key.c monitor_wrap.c sftp-glob.c ssh-dss.c ssh-rsa.c] [key.c monitor_wrap.c sftp-glob.c ssh-dss.c ssh-rsa.c]
patch memory leaks; grendel@zeitbombe.org patch memory leaks; grendel@zeitbombe.org
- 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...
20020705 20020705
- (tim) [configure.ac] AIX 4.2.1 has authenticate() in libs. - (tim) [configure.ac] AIX 4.2.1 has authenticate() in libs.
@ -1292,4 +1295,4 @@
- (stevesk) entropy.c: typo in debug message - (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@ - (djm) ssh-keygen -i needs seeded RNG; report from markus@
$Id: ChangeLog,v 1.2342 2002/07/07 22:10:15 mouring Exp $ $Id: ChangeLog,v 1.2343 2002/07/07 22:11:51 mouring Exp $

View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.179 2002/06/26 08:55:02 markus Exp $"); RCSID("$OpenBSD: channels.c,v 1.180 2002/07/04 08:12:15 deraadt Exp $");
#include "ssh.h" #include "ssh.h"
#include "ssh1.h" #include "ssh1.h"
@ -572,6 +572,7 @@ void
channel_send_open(int id) channel_send_open(int id)
{ {
Channel *c = channel_lookup(id); Channel *c = channel_lookup(id);
if (c == NULL) { if (c == NULL) {
log("channel_send_open: %d: bad id", id); log("channel_send_open: %d: bad id", id);
return; return;
@ -589,6 +590,7 @@ void
channel_request_start(int local_id, char *service, int wantconfirm) channel_request_start(int local_id, char *service, int wantconfirm)
{ {
Channel *c = channel_lookup(local_id); Channel *c = channel_lookup(local_id);
if (c == NULL) { if (c == NULL) {
log("channel_request_start: %d: unknown channel id", local_id); log("channel_request_start: %d: unknown channel id", local_id);
return; return;
@ -603,6 +605,7 @@ void
channel_register_confirm(int id, channel_callback_fn *fn) channel_register_confirm(int id, channel_callback_fn *fn)
{ {
Channel *c = channel_lookup(id); Channel *c = channel_lookup(id);
if (c == NULL) { if (c == NULL) {
log("channel_register_comfirm: %d: bad id", id); log("channel_register_comfirm: %d: bad id", id);
return; return;
@ -613,6 +616,7 @@ void
channel_register_cleanup(int id, channel_callback_fn *fn) channel_register_cleanup(int id, channel_callback_fn *fn)
{ {
Channel *c = channel_lookup(id); Channel *c = channel_lookup(id);
if (c == NULL) { if (c == NULL) {
log("channel_register_cleanup: %d: bad id", id); log("channel_register_cleanup: %d: bad id", id);
return; return;
@ -623,6 +627,7 @@ void
channel_cancel_cleanup(int id) channel_cancel_cleanup(int id)
{ {
Channel *c = channel_lookup(id); Channel *c = channel_lookup(id);
if (c == NULL) { if (c == NULL) {
log("channel_cancel_cleanup: %d: bad id", id); log("channel_cancel_cleanup: %d: bad id", id);
return; return;
@ -633,6 +638,7 @@ void
channel_register_filter(int id, channel_filter_fn *fn) channel_register_filter(int id, channel_filter_fn *fn)
{ {
Channel *c = channel_lookup(id); Channel *c = channel_lookup(id);
if (c == NULL) { if (c == NULL) {
log("channel_register_filter: %d: bad id", id); log("channel_register_filter: %d: bad id", id);
return; return;
@ -645,6 +651,7 @@ channel_set_fds(int id, int rfd, int wfd, int efd,
int extusage, int nonblock, u_int window_max) int extusage, int nonblock, u_int window_max)
{ {
Channel *c = channel_lookup(id); Channel *c = channel_lookup(id);
if (c == NULL || c->type != SSH_CHANNEL_LARVAL) if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
fatal("channel_activate for non-larval channel %d.", id); fatal("channel_activate for non-larval channel %d.", id);
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock); channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
@ -815,6 +822,7 @@ static void
channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset)
{ {
int ret = x11_open_helper(&c->output); int ret = x11_open_helper(&c->output);
if (ret == 1) { if (ret == 1) {
/* Start normal processing for the channel. */ /* Start normal processing for the channel. */
c->type = SSH_CHANNEL_OPEN; c->type = SSH_CHANNEL_OPEN;
@ -1400,6 +1408,7 @@ static void
channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset)
{ {
int len; int len;
/* Send buffered output data to the socket. */ /* Send buffered output data to the socket. */
if (FD_ISSET(c->sock, writeset) && buffer_len(&c->output) > 0) { if (FD_ISSET(c->sock, writeset) && buffer_len(&c->output) > 0) {
len = write(c->sock, buffer_ptr(&c->output), len = write(c->sock, buffer_ptr(&c->output),
@ -1477,6 +1486,7 @@ static void
channel_handler_init(void) channel_handler_init(void)
{ {
int i; int i;
for (i = 0; i < SSH_CHANNEL_MAX_TYPE; i++) { for (i = 0; i < SSH_CHANNEL_MAX_TYPE; i++) {
channel_pre[i] = NULL; channel_pre[i] = NULL;
channel_post[i] = NULL; channel_post[i] = NULL;
@ -2610,6 +2620,7 @@ void
deny_input_open(int type, u_int32_t seq, void *ctxt) deny_input_open(int type, u_int32_t seq, void *ctxt)
{ {
int rchan = packet_get_int(); int rchan = packet_get_int();
switch (type) { switch (type) {
case SSH_SMSG_AGENT_OPEN: case SSH_SMSG_AGENT_OPEN:
error("Warning: ssh server tried agent forwarding."); error("Warning: ssh server tried agent forwarding.");

View File

@ -37,7 +37,7 @@
*/ */
#include "includes.h" #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 "xmalloc.h"
#include "buffer.h" #include "buffer.h"
@ -134,6 +134,7 @@ void
packet_set_connection(int fd_in, int fd_out) packet_set_connection(int fd_in, int fd_out)
{ {
Cipher *none = cipher_by_name("none"); Cipher *none = cipher_by_name("none");
if (none == NULL) if (none == NULL)
fatal("packet_set_connection: cannot load cipher 'none'"); fatal("packet_set_connection: cannot load cipher 'none'");
connection_in = fd_in; connection_in = fd_in;
@ -402,6 +403,7 @@ packet_set_encryption_key(const u_char *key, u_int keylen,
int number) int number)
{ {
Cipher *cipher = cipher_by_number(number); Cipher *cipher = cipher_by_number(number);
if (cipher == NULL) if (cipher == NULL)
fatal("packet_set_encryption_key: unknown cipher number %d", number); fatal("packet_set_encryption_key: unknown cipher number %d", number);
if (keylen < 20) if (keylen < 20)
@ -443,6 +445,7 @@ void
packet_put_char(int value) packet_put_char(int value)
{ {
char ch = value; char ch = value;
buffer_append(&outgoing_packet, &ch, 1); buffer_append(&outgoing_packet, &ch, 1);
} }
void void
@ -994,7 +997,8 @@ packet_read_poll2(u_int32_t *seqnr_p)
buffer_clear(&incoming_packet); buffer_clear(&incoming_packet);
buffer_append(&incoming_packet, buffer_ptr(&compression_buffer), buffer_append(&incoming_packet, buffer_ptr(&compression_buffer),
buffer_len(&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. * get packet type, implies consume.
@ -1102,6 +1106,7 @@ u_int
packet_get_char(void) packet_get_char(void)
{ {
char ch; char ch;
buffer_get(&incoming_packet, &ch, 1); buffer_get(&incoming_packet, &ch, 1);
return (u_char) ch; return (u_char) ch;
} }
@ -1135,6 +1140,7 @@ void *
packet_get_raw(int *length_ptr) packet_get_raw(int *length_ptr)
{ {
int bytes = buffer_len(&incoming_packet); int bytes = buffer_len(&incoming_packet);
if (length_ptr != NULL) if (length_ptr != NULL)
*length_ptr = bytes; *length_ptr = bytes;
return buffer_ptr(&incoming_packet); return buffer_ptr(&incoming_packet);
@ -1207,6 +1213,7 @@ packet_disconnect(const char *fmt,...)
char buf[1024]; char buf[1024];
va_list args; va_list args;
static int disconnecting = 0; static int disconnecting = 0;
if (disconnecting) /* Guard against recursive invocations. */ if (disconnecting) /* Guard against recursive invocations. */
fatal("packet_disconnect called recursively."); fatal("packet_disconnect called recursively.");
disconnecting = 1; disconnecting = 1;
@ -1249,6 +1256,7 @@ void
packet_write_poll(void) packet_write_poll(void)
{ {
int len = buffer_len(&output); int len = buffer_len(&output);
if (len > 0) { if (len > 0) {
len = write(connection_out, buffer_ptr(&output), len); len = write(connection_out, buffer_ptr(&output), len);
if (len <= 0) { if (len <= 0) {
@ -1368,6 +1376,7 @@ int
packet_set_maxsize(int s) packet_set_maxsize(int s)
{ {
static int called = 0; static int called = 0;
if (called) { if (called) {
log("packet_set_maxsize: called twice: old %d new %d", log("packet_set_maxsize: called twice: old %d new %d",
max_packet_size, s); max_packet_size, s);