Commit 1a61a8c7 authored by Niels Möller's avatar Niels Möller
Browse files

(C_WRITE): Deleted macro. Updated all callers

to use connection_send directly.

Rev: src/channel.c:1.122
Rev: src/channel_commands.c:1.30
Rev: src/client.c:1.155
Rev: src/client_pty.c:1.27
Rev: src/client_userauth.c:1.56
Rev: src/connection.c:1.76
Rev: src/connection.h:1.69
Rev: src/gateway_channel.c:1.18
Rev: src/proxy.c:1.18
Rev: src/proxy_userauth.c:1.15
Rev: src/server.c:1.75
Rev: src/server_session.c:1.101
Rev: src/server_userauth.c:1.42
parent 1343ca64
......@@ -460,8 +460,8 @@ adjust_rec_window(struct flow_controlled *f, uint32_t written)
* may live longer than the actual channel. */
if (! (channel->flags & (CHANNEL_RECEIVED_EOF | CHANNEL_RECEIVED_CLOSE
| CHANNEL_SENT_CLOSE)))
C_WRITE(channel->connection,
prepare_window_adjust(channel, written));
connection_send(channel->connection,
prepare_window_adjust(channel, written));
}
void
......@@ -469,9 +469,9 @@ channel_start_receive(struct ssh_channel *channel,
uint32_t initial_window_size)
{
if (channel->rec_window_size < initial_window_size)
C_WRITE(channel->connection,
prepare_window_adjust
(channel, initial_window_size - channel->rec_window_size));
connection_send(channel->connection,
prepare_window_adjust
(channel, initial_window_size - channel->rec_window_size));
}
/* Channel related messages */
......@@ -516,10 +516,10 @@ send_global_request_responses(struct ssh_connection *connection,
object_queue_remove_head(q);
C_WRITE(connection,
(n->status
? format_global_success()
: format_global_failure()));
connection_send(connection,
(n->status
? format_global_success()
: format_global_failure()));
}
}
......@@ -625,7 +625,7 @@ DEFINE_PACKET_HANDLER(static, global_request_handler, connection, packet)
}
if (!req)
{
C_WRITE(connection, format_global_failure());
connection_send(connection, format_global_failure());
return;
}
else
......@@ -735,10 +735,10 @@ send_channel_request_responses(struct ssh_channel *channel,
object_queue_remove_head(q);
C_WRITE(channel->connection,
(n->status
? format_channel_success(channel->channel_number)
: format_channel_failure(channel->channel_number)));
connection_send(channel->connection,
(n->status
? format_channel_success(channel->channel_number)
: format_channel_failure(channel->channel_number)));
}
}
......@@ -901,8 +901,8 @@ DEFINE_PACKET_HANDLER(static, channel_request_handler,
else
{
if (info.want_reply)
C_WRITE(connection,
format_channel_failure(channel->channel_number));
connection_send(connection,
format_channel_failure(channel->channel_number));
}
}
else
......@@ -953,8 +953,9 @@ do_channel_open_continue(struct command_continuation *c,
/* FIXME: Doesn't support sending extra arguments with the
* confirmation message. */
C_WRITE(self->connection,
format_open_confirmation(channel, self->local_channel_number, ""));
connection_send(self->connection,
format_open_confirmation(channel,
self->local_channel_number, ""));
}
static struct command_continuation *
......@@ -1004,9 +1005,9 @@ do_exc_channel_open_handler(struct exception_handler *s,
dealloc_channel(table, self->local_channel_number);
C_WRITE(self->connection,
format_open_failure(self->remote_channel_number,
exc->error_code, e->msg, ""));
connection_send(self->connection,
format_open_failure(self->remote_channel_number,
exc->error_code, e->msg, ""));
break;
}
default:
......@@ -1082,10 +1083,11 @@ DEFINE_PACKET_HANDLER(static, channel_open_handler,
{
/* We are waiting for channels to close. Don't open any new ones. */
C_WRITE(connection,
format_open_failure(info.remote_channel_number,
SSH_OPEN_ADMINISTRATIVELY_PROHIBITED,
"Waiting for channels to close.", ""));
connection_send(connection,
format_open_failure
(info.remote_channel_number,
SSH_OPEN_ADMINISTRATIVELY_PROHIBITED,
"Waiting for channels to close.", ""));
}
else
{
......@@ -1102,10 +1104,11 @@ DEFINE_PACKET_HANDLER(static, channel_open_handler,
if (!open)
{
C_WRITE(connection,
format_open_failure(info.remote_channel_number,
SSH_OPEN_UNKNOWN_CHANNEL_TYPE,
"Unknown channel type", ""));
connection_send(connection,
format_open_failure
(info.remote_channel_number,
SSH_OPEN_UNKNOWN_CHANNEL_TYPE,
"Unknown channel type", ""));
}
else
{
......@@ -1113,10 +1116,11 @@ DEFINE_PACKET_HANDLER(static, channel_open_handler,
if (local_number < 0)
{
C_WRITE(connection,
format_open_failure(info.remote_channel_number,
SSH_OPEN_RESOURCE_SHORTAGE,
"Channel limit exceeded.", ""));
connection_send(connection,
format_open_failure
(info.remote_channel_number,
SSH_OPEN_RESOURCE_SHORTAGE,
"Channel limit exceeded.", ""));
return;
}
......@@ -1736,7 +1740,7 @@ channel_close(struct ssh_channel *channel)
channel->flags |= CHANNEL_SENT_CLOSE;
C_WRITE(channel->connection, format_channel_close(channel) );
connection_send(channel->connection, format_channel_close(channel));
if (channel->flags & CHANNEL_RECEIVED_CLOSE)
EXCEPTION_RAISE(channel->e, &finish_exception);
......@@ -1760,7 +1764,7 @@ channel_eof(struct ssh_channel *channel)
verbose("Sending EOF on channel %i\n", channel->channel_number);
channel->flags |= CHANNEL_SENT_EOF;
C_WRITE(channel->connection, format_channel_eof(channel) );
connection_send(channel->connection, format_channel_eof(channel) );
if ( (channel->flags & CHANNEL_CLOSE_AT_EOF)
&& (channel->flags & (CHANNEL_RECEIVED_EOF | CHANNEL_NO_WAIT_FOR_EOF)) )
......@@ -1877,8 +1881,8 @@ do_channel_write(struct abstract_write *w,
channel_eof(closure->channel);
}
else
C_WRITE(closure->channel->connection,
channel_transmit_data(closure->channel, packet) );
connection_send(closure->channel->connection,
channel_transmit_data(closure->channel, packet));
}
static void
......@@ -1895,10 +1899,10 @@ do_channel_write_extended(struct abstract_write *w,
channel_eof(closure->super.channel);
}
else
C_WRITE(closure->super.channel->connection,
channel_transmit_extended(closure->super.channel,
closure->type,
packet));
connection_send(closure->super.channel->connection,
channel_transmit_extended(closure->super.channel,
closure->type,
packet));
}
struct abstract_write *
......
......@@ -79,7 +79,7 @@ do_channel_open_command(struct command *s,
channel->e = e;
register_channel(index, channel, 0);
C_WRITE(connection, request);
connection_send(connection, request);
}
}
......@@ -99,7 +99,7 @@ do_channel_request_command(struct command *s,
object_queue_add_tail(&channel->pending_requests,
&make_command_context(c, e)->super);
C_WRITE(channel->connection, request);
connection_send(channel->connection, request);
}
void
......@@ -118,7 +118,7 @@ do_channel_global_command(struct command *s,
object_queue_add_tail(&connection->table->pending_global_requests,
&make_command_context(c, e)->super);
C_WRITE(connection, request);
connection_send(connection, request);
}
void
......
......@@ -145,8 +145,8 @@ do_request_service(struct command *s,
connection->dispatch[SSH_MSG_SERVICE_ACCEPT]
= make_accept_service_handler(self->service, c);
C_WRITE(connection,
format_service_request(self->service));
connection_send(connection,
format_service_request(self->service));
}
struct command *
......
......@@ -111,8 +111,8 @@ do_client_winch_handler(struct window_change_callback *s,
if (!INTERACT_WINDOW_SIZE(tty, &dims))
return;
C_WRITE(self->channel->connection,
format_window_change(self->channel, &dims));
connection_send(self->channel->connection,
format_window_change(self->channel, &dims));
}
static struct window_change_callback *
......
......@@ -565,9 +565,9 @@ do_none_login(struct client_userauth_method *s UNUSED,
{
verbose("Requesting authentication using the `none' method.\n");
C_WRITE(connection,
format_userauth_none(userauth->username,
userauth->service_name));
connection_send(connection,
format_userauth_none(userauth->username,
userauth->service_name));
return make_client_none_state(e);
}
......@@ -624,11 +624,11 @@ send_password(struct client_password_state *state)
verbose("Requesting authentication using the `password' method.\n");
C_WRITE(state->connection,
format_userauth_password(state->userauth->username,
state->userauth->service_name,
local_to_utf8(passwd, 1),
1));
connection_send(state->connection,
format_userauth_password(state->userauth->username,
state->userauth->service_name,
local_to_utf8(passwd, 1),
1));
}
else
{
......@@ -893,7 +893,7 @@ do_userauth_pk_ok(struct packet_handler *s,
request,
SIGN(key->private, key->type, signed_data->length, signed_data->data));
lsh_string_free(signed_data);
C_WRITE(connection, request);
connection_send(connection, request);
self->state->pending++;
}
else
......@@ -943,10 +943,11 @@ do_publickey_login(struct client_userauth_method *s,
/* NOTE: The PEER_USERAUTH_REQUEST_KLUDGE only applies to the
* signed data. */
C_WRITE(connection,
format_userauth_publickey_query(userauth->username,
userauth->service_name,
key->type, key->public));
connection_send(connection,
format_userauth_publickey_query
(userauth->username,
userauth->service_name,
key->type, key->public));
}
connection->dispatch[SSH_MSG_USERAUTH_PK_OK] = make_pk_ok_handler(state);
return &state->super;
......
......@@ -198,7 +198,7 @@ DEFINE_PACKET_HANDLER(, connection_unimplemented_handler, connection, packet)
werror("Received packet of unimplemented type %i.\n",
packet->data[0]);
C_WRITE(connection,
connection_send(connection,
ssh_format("%c%i",
SSH_MSG_UNIMPLEMENTED,
packet->sequence_number));
......@@ -209,7 +209,7 @@ DEFINE_PACKET_HANDLER(, connection_forward_handler, connection, packet)
assert(connection->chain);
/* FIXME: Packets of certain types (IGNORE, DEBUG, DISCONNECT)
* could be sent with C_WRITE_NOW. */
C_WRITE(connection->chain, packet);
connection_send(connection->chain, packet);
}
DEFINE_PACKET_HANDLER(, connection_disconnect_handler, connection, packet)
......@@ -475,8 +475,7 @@ make_connection_close_handler(struct ssh_connection *c)
return &closure->super;
}
/* Sending ordinary (non keyexchange) packets */
/* Sends one ordinary (non keyexchange) packet */
void
connection_send(struct ssh_connection *self,
struct lsh_string *message)
......
......@@ -231,10 +231,6 @@ do_##NAME(struct packet_handler *s UNUSED, \
* compress, encrypt, mac. */
#define C_WRITE_NOW(c, s) A_WRITE((c)->write_packet, (s) )
/* Same as C_WRITE_NOW, except that it queues packets while key
* exchange is in progress. */
#define C_WRITE(c, s) connection_send((c), (s))
struct ssh_connection *
make_ssh_connection(enum connection_flag flags,
struct address_info *peer,
......
......@@ -68,13 +68,13 @@ do_receive(struct ssh_channel *c,
switch(type)
{
case CHANNEL_DATA:
C_WRITE(channel->chain->super.connection,
channel_transmit_data(&channel->chain->super, data));
connection_send(channel->chain->super.connection,
channel_transmit_data(&channel->chain->super, data));
break;
case CHANNEL_STDERR_DATA:
C_WRITE(channel->chain->super.connection,
channel_transmit_extended(&channel->chain->super,
CHANNEL_STDERR_DATA, data));
connection_send(channel->chain->super.connection,
channel_transmit_extended(&channel->chain->super,
CHANNEL_STDERR_DATA, data));
break;
default:
fatal("Internal error!\n");
......
......@@ -309,7 +309,7 @@ do_proxy_accept_service(struct packet_handler *c,
new_packet = packet;
#endif
C_WRITE(connection->chain, new_packet);
connection_send(connection->chain, new_packet);
COMMAND_CALL(closure->service,
connection->chain,
closure->c, closure->e);
......@@ -373,7 +373,7 @@ do_proxy_service_request(struct packet_handler *c,
connection->chain->dispatch[SSH_MSG_SERVICE_ACCEPT]
= make_proxy_accept_service_handler(name, service, self->c, self->e);
C_WRITE(connection->chain, packet);
connection_send(connection->chain, packet);
return;
}
......
......@@ -79,7 +79,7 @@ do_forward_password_userauth(struct proxy_userauth *ignored UNUSED,
parse_eod(args))
{
/* FIXME: Should we really pass the last argument free=1 ? */
C_WRITE(connection->chain, format_userauth_password(username, service, password, 1));
connection_send(connection->chain, format_userauth_password(username, service, password, 1));
}
}
......@@ -113,7 +113,7 @@ do_forward_success(struct packet_handler *c,
{
struct lsh_string *name = self->name;
self->name = NULL;
C_WRITE(connection->chain, lsh_string_dup(packet));
connection_send(connection->chain, lsh_string_dup(packet));
COMMAND_RETURN(self->c, make_proxy_user(name));
}
else
......
......@@ -108,10 +108,10 @@ do_service_request(struct packet_handler *c,
/* Start service */
#if DATAFELLOWS_WORKAROUNDS
if (connection->peer_flags & PEER_SERVICE_ACCEPT_KLUDGE)
C_WRITE(connection, format_service_accept_kludge());
connection_send(connection, format_service_accept_kludge());
else
#endif /* DATAFELLOWS_WORKAROUNDS */
C_WRITE(connection, format_service_accept(name));
connection_send(connection, format_service_accept(name));
COMMAND_CALL(service, connection,
closure->c, closure->e);
......
......@@ -278,10 +278,10 @@ do_exit_shell(struct exit_callback *c, int signaled,
signaled ? ATOM_EXIT_SIGNAL : ATOM_EXIT_STATUS,
channel->channel_number);
C_WRITE(channel->connection,
(signaled
? format_exit_signal(channel, core, value)
: format_exit(channel, value)) );
connection_send(channel->connection,
(signaled
? format_exit_signal(channel, core, value)
: format_exit(channel, value)) );
/* We want to close the channel as soon as all stdout and stderr
* data has been sent. In particular, we don't wait for EOF from
......
......@@ -121,7 +121,7 @@ do_userauth_continuation(struct command_continuation *s,
/* Unlock connection */
connection_unlock(self->connection);
C_WRITE(self->connection, format_userauth_success());
connection_send(self->connection, format_userauth_success());
/* Ignore any further userauth messages. */
for (i = SSH_FIRST_USERAUTH_GENERIC; i < SSH_FIRST_CONNECTION_GENERIC; i++)
......@@ -270,8 +270,8 @@ do_exc_userauth_handler(struct exception_handler *s,
if (self->attempts)
{
self->attempts--;
C_WRITE(self->connection,
format_userauth_failure(self->advertised_methods, 0));
connection_send(self->connection,
format_userauth_failure(self->advertised_methods, 0));
}
else
{
......@@ -292,7 +292,7 @@ do_exc_userauth_handler(struct exception_handler *s,
/* NOTE: We can't NULL e->reply, since the exception is supposed to be constant.
* So we have to dup it, to make the gc happy. */
C_WRITE(self->connection, lsh_string_dup(e->reply));
connection_send(self->connection, lsh_string_dup(e->reply));
/* FIXME: Possibly call connection_handle_pending. */
break;
......
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