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

Pass a handler for KEXINIT-messages to the connection.

Rev: src/server.c:1.7
Rev: src/server.h:1.4
parent 848f2d2d
......@@ -25,15 +25,15 @@
#include "server.h"
#include "version.h"
#include "connection.h"
#include "abstract_io.h"
#include "read_line.h"
#include "read_packet.h"
#include "connection.h"
#include "debug.h"
#include "format.h"
#include "keyexchange.h"
#include "read_line.h"
#include "read_packet.h"
#include "version.h"
#include "werror.h"
#include "void.h"
#include "xalloc.h"
struct read_handler *make_server_read_line();
......@@ -44,13 +44,15 @@ static int server_initiate(struct fd_callback **c,
{
struct server_callback *closure = (struct server_callback *) *c;
/* FIXME: Should pass a key exchange handler, not NULL! */
struct ssh_connection *connection = make_ssh_connection(NULL);
struct ssh_connection *connection
= make_ssh_connection(closure->kexinit_handler);
struct abstract_write *write =
io_read_write(closure->backend, fd,
make_server_read_line(),
closure->block_size,
make_server_close_handler());
verbose("server_initiate()\n");
connection->server_version
= ssh_format("SSH-%lz-%lz %lz",
......@@ -130,13 +132,11 @@ struct read_handler *make_server_read_line(struct ssh_connection *s)
return make_read_line(&closure->super);
}
struct fd_callback *make_server_callback(struct io_backend *b,
char *comment,
UINT32 block_size,
struct signer *secret,
struct lsh_string *host_key,
struct randomness *r)
struct fd_callback *
make_server_callback(struct io_backend *b,
char *comment,
UINT32 block_size,
struct packet_handler *kexinit_handler)
{
struct server_callback *connected = xalloc(sizeof(struct server_callback));
......@@ -144,9 +144,8 @@ struct fd_callback *make_server_callback(struct io_backend *b,
connected->backend = b;
connected->block_size = block_size;
connected->id_comment = comment;
connected->secret = secret;
connected->host_key = host_key;
connected->random = r;
connected->kexinit_handler = kexinit_handler;
return &connected->super;
}
......
......@@ -26,7 +26,10 @@
#ifndef LSH_SERVER_H_INCLUDED
#define LSH_SERVER_H_INCLUDED
#include "server.h"
#include "io.h"
#include "keyexchange.h"
struct server_callback
{
......@@ -35,13 +38,16 @@ struct server_callback
struct signer *secret; /* secret key */
struct lsh_string *host_key; /* public key */
struct randomness *random;
UINT32 block_size;
char *id_comment;
struct packet_handler *kexinit_handler;
};
struct fd_callback *make_server_callback(struct io_backend *b,
char *comment,
UINT32 block_size);
struct fd_callback *
make_server_callback(struct io_backend *b,
char *comment,
UINT32 block_size,
struct packet_handler *kexinit_handler);
#endif /* LSH_SERVER_H_INCLUDED */
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