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

(options2keys): New command, that uses read_host_key,

and replaces options2keyfile.

Rev: src/lshd.c:1.130
parent 3733632f
...@@ -65,12 +65,14 @@ ...@@ -65,12 +65,14 @@
struct command options2local; struct command options2local;
#define OPTIONS2LOCAL (&options2local.super) #define OPTIONS2LOCAL (&options2local.super)
struct command options2keyfile; struct command options2keys;
#define OPTIONS2KEYFILE (&options2keyfile.super) #define OPTIONS2KEYS (&options2keys.super)
#if 0
struct command options2signature_algorithms; struct command options2signature_algorithms;
(&options2signature_algorithms.super) (&options2signature_algorithms.super)
#include "lshd.c.x" #include "lshd.c.x"
...@@ -286,28 +288,20 @@ DEFINE_COMMAND(options2signature_algorithms) ...@@ -286,28 +288,20 @@ DEFINE_COMMAND(options2signature_algorithms)
COMMAND_RETURN(c, options->signature_algorithms); COMMAND_RETURN(c, options->signature_algorithms);
} }
/* Read server's private key */
DEFINE_COMMAND(options2keyfile) /* FIXME: Call read_host_key directly from main instead. */
(struct command *ignored UNUSED, (struct command *ignored UNUSED,
struct lsh_object *a, struct lsh_object *a,
struct command_continuation *c, struct command_continuation *c,
struct exception_handler *e) struct exception_handler *e UNUSED)
{ {
CAST(lshd_options, options, a); CAST(lshd_options, options, a);
struct lsh_fd *f; struct alist *keys = make_alist(0, -1);
read_host_key(options->hostkey, options->signature_algorithms, keys);
f = io_read_file(options->hostkey, e);
if (f) COMMAND_RETURN(c, keys);
werror("Failed to open '%z' (errno = %i): %z.\n",
options->hostkey, errno, STRERROR(errno));
EXCEPTION_RAISE(e, make_io_exception(EXC_IO_OPEN_READ, NULL, errno, NULL));
} }
...@@ -700,9 +694,7 @@ main_argp = ...@@ -700,9 +694,7 @@ main_argp =
(init object make_kexinit) (init object make_kexinit)
(services object command) ) (services object command) )
(expr (lambda (options) (expr (lambda (options)
(let ((keys (let ((keys (options2keys options)))
(spki_read_hostkeys (options2signature_algorithms options)
(options2keyfile options))))
(listen_callback (listen_callback
(lambda (lv) (lambda (lv)
(services (connection_handshake (services (connection_handshake
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