Commit 42daf024 authored by Niels Möller's avatar Niels Möller

Bugfixes.

Rev: src/channel.c:1.5
Rev: src/channel.h:1.7
Rev: src/crypto.c:1.11
Rev: src/format.c:1.17
Rev: src/io.c:1.18
Rev: src/service.h:1.6
parent 4e2c0822
......@@ -108,7 +108,7 @@ struct lsh_string *prepare_window_adjust(struct ssh_channel *channel,
/* Arbitrary limit */
#define MAX_CHANNELS (1L<<17)
struct channel_table *make_table()
struct channel_table *make_channel_table(void)
{
struct channel_table *table;
......@@ -636,7 +636,7 @@ static int do_channel_success(struct packet_handler *c,
lsh_string_free(packet);
if (channel && channel->success)
if (channel && channel->channel_success)
return CHANNEL_SUCCESS(channel, connection->write);
}
......@@ -667,7 +667,7 @@ static int do_channel_failure(struct packet_handler *c,
lsh_string_free(packet);
if (channel && channel->failure)
if (channel && channel->channel_failure)
return CHANNEL_FAILURE(channel, connection->write);
}
......@@ -676,7 +676,7 @@ static int do_channel_failure(struct packet_handler *c,
}
static int init_connection_service(struct ssh_service *s,
struct ssh_connection *connection)
struct ssh_connection *connection)
{
struct connection_service *self = (struct connection_service *) s;
struct channel_table *table;
......@@ -698,7 +698,6 @@ static int init_connection_service(struct ssh_service *s,
struct channel_handler *channel_success;
struct channel_handler *channel_failure;
MDEBUG(self);
table = make_channel_table();
......@@ -765,15 +764,15 @@ static int init_connection_service(struct ssh_service *s,
channel_failure->table = table;
connection->dispatch[SSH_MSG_CHANNEL_FAILURE] = &channel_failure->super;
return closure->start
? CHANNEL_START(closure->start, table, connection->write)
return self->start
? CONNECTION_START(self->start, table, connection->write)
: LSH_OK | LSH_GOON;
}
struct lsh_string *channel_transmit_header(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *header,
struct lsh_string *data)
int channel_transmit_header(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *header,
struct lsh_string *data)
{
UINT32 i;
UINT32 left;
......@@ -805,32 +804,32 @@ struct lsh_string *channel_transmit_header(struct ssh_channel *channel,
return res;
}
struct lsh_string *channel_transmit(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *data)
int channel_transmit(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *data)
{
struct lsh_string *header = ssh_format("%c%i",
SSH_MSG_CHANNEL_DATA,
channel->channel_number);
int res = channel_transmit_header(channel, header, write, data);
int res = channel_transmit_header(channel, write, header, data);
lsh_string_free(header);
return res;
}
struct lsh_string *channel_transmit_extended(struct ssh_channel *channel,
struct abstract_write *write,
UINT32 type,
struct lsh_string *data)
int channel_transmit_extended(struct ssh_channel *channel,
struct abstract_write *write,
UINT32 type,
struct lsh_string *data)
{
struct lsh_string *header = ssh_format("%c%i%i",
SSH_MSG_CHANNEL_EXTENDED_DATA,
type,
channel->channel_number);
int res = channel_transmit_header(channel, header, write, data);
int res = channel_transmit_header(channel, write, header, data);
lsh_string_free(header);
......@@ -897,7 +896,7 @@ struct lsh_string *format_channel_request(int type, struct ssh_channel *channel,
struct lsh_string *packet;
#define REQUEST_FORMAT "%c%i%a%c"
#define REQUEST_ARGS SSH_MSG_CHANNEL_REQUEST, channel->remote_channel_number \
#define REQUEST_ARGS SSH_MSG_CHANNEL_REQUEST, channel->channel_number, \
type, want_reply
l1 = ssh_format_length(REQUEST_FORMAT, REQUEST_ARGS);
......
......@@ -171,6 +171,9 @@ struct lsh_string *format_open_failure(UINT32 channel, UINT32 reason,
char *msg, char *language);
struct lsh_string *format_channel_failure(UINT32 channel);
struct lsh_string *prepare_window_adjust(struct ssh_channel *channel,
UINT32 add);
struct lsh_string *prepare_channel_open(struct channel_table *table,
int type, struct ssh_channel *channel,
char *format, ...);
......@@ -178,19 +181,19 @@ struct lsh_string *prepare_channel_open(struct channel_table *table,
struct lsh_string *format_channel_request(int type, struct ssh_channel *channel,
int want_reply, char *format, ...);
struct lsh_string *channel_transmit_header(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *header,
struct lsh_string *data);
int channel_transmit_header(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *header,
struct lsh_string *data);
struct lsh_string *channel_transmit(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *data);
int channel_transmit(struct ssh_channel *channel,
struct abstract_write *write,
struct lsh_string *data);
struct lsh_string *channel_transmit_extended(struct ssh_channel *channel,
struct abstract_write *write,
UINT32 type,
struct lsh_string *data);
int channel_transmit_extended(struct ssh_channel *channel,
struct abstract_write *write,
UINT32 type,
struct lsh_string *data);
struct ssh_service *make_connection_service(struct alist *global_requests,
......
......@@ -45,7 +45,7 @@ static void do_crypt_none(struct crypto_instance *ignored,
struct crypto_instance crypto_none_instance =
{
STATIC_HEADER
STATIC_HEADER,
8,
do_crypt_none
};
......@@ -85,7 +85,7 @@ make_rc4_instance(struct crypto_algorithm *ignored, int mode, UINT8 *key)
}
struct crypto_algorithm crypto_rc4_algorithm =
{ STATIC_HEADER
{ STATIC_HEADER,
8, 16, make_rc4_instance };
/* SHA1 hash */
......
......@@ -66,7 +66,7 @@ void ssh_format_write(char *format, UINT32 length, UINT8 *buffer, ...)
va_list args;
va_start(args, buffer);
assert(length == ssh_vformat_write(format, buffer, args));
ssh_vformat_write(format, length, buffer, args);
va_end(args);
}
......
......@@ -151,7 +151,7 @@ static int io_iter(struct io_backend *b)
{
fds[i].fd = fd->fd;
fds[i].events = 0;
if (fd->read_callback && !fd->on_hold)
if (fd->handler && !fd->on_hold)
fds[i].events |= POLLIN;
/* pre_write returns 0 if the buffer is empty */
......@@ -252,7 +252,7 @@ static int io_iter(struct io_backend *b)
int res;
struct fd_read r =
{ { STACK_HEADER do_read }, fd->fd };
{ { STACK_HEADER, do_read }, fd->fd };
/* The handler function may install a new handler */
res = READ_HANDLER(fd->handler,
......@@ -676,6 +676,6 @@ struct io_fd *io_write(struct io_backend *b,
b->io = f;
b->nio++;
return &buffer->super;
return f;
}
......@@ -29,7 +29,7 @@
/* Used for both proper services (i.e. services that can be requested
* in a SSH_MSG_SERVICE_REQUEST or SSH_MSG_USERAUTH_REQUEST) and for
* any other stuff that needs initialization at some later time. */.
* any other stuff that needs initialization at some later time. */
struct ssh_service
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment