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

* src/command, src/connection.c, src/exception.c, src/io.c,

src/keyexchange.c, src/keyexchange.h, src/lsh_keygen.c,
src/lshd.c, src/publickey_crypto.h, src/server_session.c,
src/server_userauth.c, src/server_userauth.h, src/sexp.c,
src/sexp_parser.c, src/spki.c, src/spki_commands.c,
src/srp_exchange.c, src/tcpforward.c, src/werror.c: Removed old
dead code.

Rev: src/command.h:1.45
Rev: src/connection.c:1.55
Rev: src/exception.c:1.15
Rev: src/io.c:1.108
Rev: src/keyexchange.c:1.68
Rev: src/keyexchange.h:1.46
Rev: src/lsh_keygen.c:1.21
Rev: src/lshd.c:1.93
Rev: src/publickey_crypto.h:1.37
Rev: src/server_session.c:1.43
Rev: src/server_userauth.c:1.28
Rev: src/server_userauth.h:1.13
Rev: src/sexp.c:1.30
Rev: src/sexp_parser.c:1.16
Rev: src/spki.c:1.20
Rev: src/spki_commands.c:1.8
Rev: src/srp_exchange.c:1.6
Rev: src/tcpforward.c:1.49
Rev: src/werror.c:1.46
parent aa4f85f3
......@@ -306,8 +306,6 @@ struct command_continuation *
make_once_continuation(const char *msg,
struct command_continuation *up);
/* extern struct command once_command; */
/* Delayed application. This is just a convenient way to record how to
* apply a function, at some later time. Currently used only by
......
......@@ -354,11 +354,3 @@ void connection_unlock(struct ssh_connection *self)
self->busy = 0;
}
/* ;; GABA:
(class
(name handshake_command)
(super command)
(vars
; CONNECTION_SERVER or CONNECTION_CLIENT
(mode . int)))
*/
......@@ -120,15 +120,6 @@ make_report_exception_handler(struct report_exception_info *info,
return &self->super;
}
#if 0
/* Command to report and ignore an exception given as argument. */
COMMAND_SIMPLE(report_exception_command)
{
CAST_SUBTYPE(exception, x, a);
werror("%z\n", x->msg);
}
#endif
struct exception *make_simple_exception(UINT32 type, const char *msg)
{
NEW(exception, e);
......
......@@ -733,57 +733,6 @@ init_file(struct io_backend *b, struct lsh_fd *f, int fd,
b->files = f;
}
#if 0
/* Blocking read from a file descriptor (i.e. don't use the backend).
* The fd should *not* be in non-blocking mode. */
/* FIXME: How to do this when moving from return codes to exceptions? */
/* FIXME: The entire blocking_read mechanism should be replaced by
* ordinary commands and non-blocking i/o command. Right now, it is
* used to read key-files, so that change probably has to wait until
* the parser is rewritten. */
#define BLOCKING_READ_SIZE 4096
int blocking_read(int fd, struct read_handler *handler)
{
UINT8 *buffer = alloca(BLOCKING_READ_SIZE);
for (;;)
{
int res = read(fd, buffer, BLOCKING_READ_SIZE);
if (res < 0)
switch(errno)
{
case EINTR:
break;
case EWOULDBLOCK:
fatal("blocking_read: Unexpected EWOULDBLOCK! fd in non-blocking mode?\n");
default:
werror("blocking_read: read() failed (errno = %i): %z\n",
errno, strerror(errno));
return 0;
}
else if (!res)
return 1;
else
{
UINT32 got = res;
UINT32 done = 0;
while (handler
&& (done < got))
done += READ_HANDLER(handler, got - done, buffer + done);
}
}
/* FIXME: Not reached. Hmm. */
close(fd);
return !handler;
}
#endif
/* These functions are used by werror() and friends */
/* For fd:s in blocking mode. */
......
......@@ -667,16 +667,6 @@ make_simple_kexinit(struct randomness *r,
}
/* ;; GABA:
(class
(name install_new_keys)
(super install_keys)
(vars
(is_server simple int)
(algorithms object object_list)))
*/
static int
install_keys(struct object_list *algorithms,
struct ssh_connection *connection,
......@@ -730,20 +720,6 @@ install_keys(struct object_list *algorithms,
return 1;
}
#if 0
struct install_keys *
make_install_new_keys(int is_server,
struct object_list *algorithms)
{
NEW(install_new_keys, self);
self->super.install = do_install;
self->is_server = is_server;
self->algorithms = algorithms;
return &self->super;
}
#endif
/* Returns a hash instance for generating various session keys. NOTE:
* This mechanism changed in the transport-05 draft. Before this, the
......
......@@ -111,34 +111,6 @@
*/
#define MAKE_KEXINIT(s) ((s)->make((s)))
/* FIXME: We don't need this class. */
/* Installs keys for use. */
/* ;; GABA:
(class
(name install_keys)
(vars
(install method int
"struct ssh_connection *connection"
"struct hash_instance *secret")))
*/
#if 0
#define INSTALL_KEYS(i, c, s) ((i)->install((i), (c), (s)))
#endif
/* ;; GABA:
(class
(name newkeys_info)
(vars
(encryption_client_to_server object crypto_algorithm)
(encryption_server_to_client object crypto_algorithm)
(mac_client_to_server object mac_algorithm)
(mac_server_to_client object mac_algorithm)
;; (compression_client_to_server object compression_algorithm)
;; (compression_server_to_client object compression_algorithm)
))
*/
struct lsh_string *format_kex(struct kexinit *kex);
void disconnect_kex_failed(struct ssh_connection *connection, const char *msg);
......@@ -184,13 +156,6 @@ struct install_keys *
make_install_new_keys(int is_server,
struct object_list *algorithms);
#if 0
struct hash_instance *
kex_build_secret(struct hash_algorithm *H,
struct lsh_string *exchange_hash,
mpz_t K);
#endif
void
keyexchange_finish(struct ssh_connection *connection,
struct object_list *algorithms,
......
......@@ -106,11 +106,6 @@ main_argp_parser(int key, char *arg UNUSED, struct argp_state *state)
state->child_inputs[0] = &self->style;
state->child_inputs[1] = NULL;
break;
#if 0
case ARGP_KEY_ARG:
argp_error(state, "Spurious arguments.");
break;
#endif
case 'l':
{
char *end;
......
......@@ -334,11 +334,6 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
state->child_inputs[1] = &self->super;
state->child_inputs[2] = NULL;
break;
#if 0
case ARGP_KEY_ARG:
argp_error(state, "Spurious arguments.");
break;
#endif
case ARGP_KEY_END:
{
struct user_db *db = NULL;
......@@ -554,16 +549,6 @@ main_argp =
(log_peer (listen (options2local options))))))))
*/
/* Invoked when the client requests the userauth service. */
/* ;; GABA:
(expr
(name lshd_services)
(params
(userauth object command))
(expr
(lambda (connection)
((userauth connection) connection))))
*/
/* Invoked when starting the ssh-connection service */
/* GABA:
......
......@@ -176,20 +176,10 @@ make_ring_zn(mpz_t p, mpz_t g);
* and we don't have multiple inheritance.
*/
/* ;; GABA:
(class
(name abstract_ring)
; The group refers to the multiplicative group.
; For SRP, the generator should generate the entire group.
(super abstract_group)
(vars
(add method void "mpz_t res" "mpz_t a" "mpz_t b")))
*/
struct abstract_group *
make_ssh_group1(void);
struct abstract_group *
make_ssh_ring_srp_1(void);
......
......@@ -188,18 +188,6 @@ do_eof(struct ssh_channel *channel)
channel_close(channel);
}
#if 0
/* Not needed; the channels resource list is taken care of automatically. */
static void
do_close(struct ssh_channel *c)
{
CAST(server_session, session, c);
if (session->process)
KILL_RESOURCE(session->process);
}
#endif
struct ssh_channel *
make_server_session(UINT32 initial_window,
struct alist *request_types)
......@@ -218,9 +206,8 @@ make_server_session(UINT32 initial_window,
self->super.rec_max_packet = SSH_MAX_PACKET - SSH_CHANNEL_MAX_PACKET_FUZZ;
self->super.request_types = request_types;
#if 0
self->super.close = do_close;
#endif
/* Note: We don't need a close handler; the channels resource list
* is taken care of automatically. */
self->process = NULL;
......@@ -278,72 +265,6 @@ make_open_session(struct alist *session_requests)
return &closure->super;
}
#if 0
/* A command taking two arguments: unix_user, connection,
* returns the connection. */
/* ;; GABA:
(class
(name server_connection_service)
(super command)
(vars
;; (global_requests object alist)
; Requests specific to session channels
(session_requests object alist)))
*/
/* Start an authenticated ssh-connection service */
static void
do_login(struct command *s,
struct lsh_object *x,
struct command_continuation *c,
struct exception_handler *e UNUSED)
{
CAST(server_connection_service, closure, s);
CAST(ssh_connection, connection, x);
if (!connection->user)
{
EXCEPTION_RAISE(connection->e,
make_protocol_exception(SSH_DISCONNECT_SERVICE_NOT_AVAILABLE,
"User authentication required."));
return;
}
werror("Starting ssh-connection service for user %pS.\n",
connection->user->name);
/* FIXME: It would be better to take one more alists as arguments,
* and cons the ATOM_SESSION service at the head of it. But that
* won't work as long as an alist doesn't consist of independent
* cons-objects. */
ALIST_SET(connection->table->channel_types,
ATOM_SESSION,
self->handler);
COMMAND_RETURN
(c, make_install_fix_channel_open_handler
(ATOM_SESSION, make_open_session(user,
closure->session_requests)));
}
/* FIXME: To make this more flexible, we need to have some argument
* that lists (i) the channel types we want to support in
* CHANNEL_OPEN, and (ii) for each channel type, the types of
* channel_requests we want to support. */
struct command *
make_server_connection_service(struct alist *session_requests)
{
NEW(server_connection_service, closure);
closure->super.call = do_login;
closure->session_requests = session_requests;
return &closure->super;
}
#endif
struct lsh_string *
format_exit_signal(struct ssh_channel *channel,
......
......@@ -233,57 +233,6 @@ make_userauth_handler(struct alist *methods,
}
#if 0
/* ;; GABA:
(class
(name userauth_continuation)
(super command_frame)
(vars
(connection object ssh_connection)))
*/
static void
do_userauth_continuation(struct command_continuation *s,
struct lsh_object *value)
{
CAST(userauth_continuation, self, s);
CAST(delayed_apply, action, value);
unsigned i;
/* Access granted. */
assert(action);
/* Unlock connection */
connection_unlock(self->connection);
C_WRITE(self->connection, format_userauth_success());
/* Ignore any further userauth messages. */
for (i = SSH_FIRST_USERAUTH_GENERIC; i < SSH_FIRST_CONNECTION_GENERIC; i++)
self->connection->dispatch[i] = self->connection->ignore;
FORCE_APPLY(action, self->super.up, self->super.e);
}
static struct command_continuation *
make_userauth_continuation(struct ssh_connection *connection,
struct command_continuation *c,
struct exception_handler *e)
{
NEW(userauth_continuation, self);
self->super.super.c = do_userauth_continuation;
self->super.up = c;
self->super.e = e;
self->connection = connection;
return &self->super.super;
}
#endif
/* GABA:
(class
(name exc_userauth_handler)
......
......@@ -90,15 +90,6 @@ format_userauth_failure(struct int_list *methods,
struct lsh_string *
format_userauth_success(void);
#if 0
static struct packet_handler *
make_userauth_handler(struct alist *methods,
struct alist *services,
struct command_continuation *c,
struct exception_handler *service_e,
struct exception_handler *auth_e);
#endif
/* authentication methods */
struct userauth *
......
......@@ -832,72 +832,6 @@ sexp_atoms_eq(struct sexp *a, struct sexp *b)
: !bd);
}
#if 0
int
sexp_eqz(const struct sexp *e, const char *s)
{
struct lsh_string *c;
if (!sexp_atomp(e) || sexp_display(e))
return 0;
c = sexp_contents(e);
return !strncmp(s, c->data, c->length);
}
int
sexp_check_type_z(struct sexp *e, const char *type,
struct sexp_iterator **res)
{
struct sexp_iterator *i;
if (sexp_atomp(e) || sexp_nullp(e))
return 0;
i = SEXP_ITER(e);
if (sexp_eqz(SEXP_GET(i), type))
{
if (res)
{
SEXP_NEXT(i);
*res = i;
}
return 1;
}
KILL(i);
return 0;
}
/* Check that the next element is a pair (name value), and return value */
struct sexp *
sexp_assz(struct sexp_iterator *i, const char *name)
{
struct sexp *l = SEXP_GET(i);
struct sexp_iterator *inner;
struct sexp *e;
if (!l || !(sexp_check_type_z(l, name, &inner)))
return 0;
e = SEXP_GET(inner);
if (e)
{
SEXP_NEXT(inner);
if (SEXP_GET(inner))
/* Too many elements */
e = NULL;
else
SEXP_NEXT(i);
}
KILL(inner);
return e;
}
#endif
struct sexp *
sexp_assq(struct sexp_iterator *i, int atom)
{
......@@ -938,18 +872,6 @@ sexp_formats[] =
{ NULL, 0 }
};
#if 0
static void
list_formats(void)
{
int i;
werror("Available formats are:\n");
for (i = 0; sexp_formats[i].name; i++)
werror(" %z\n", sexp_formats[i].name);
}
#endif
static int
lookup_sexp_format(const char *name)
{
......
......@@ -241,727 +241,3 @@ string_to_sexp(struct lsh_string *src, int free)
return NULL;
}
/* Old obsoleted code follows */
#if 0
static void sexp_skip_space(struct simple_buffer *buffer)
{
ADVANCE(sexp_scan_class(buffer, CHAR_space));
}
#endif
#if 0
/* Parse one or more characters into a simple string as a token. */
static struct lsh_string *sexp_parse_token(struct simple_buffer *buffer)
{
UINT32 length;
struct lsh_string *token;
assert(LEFT);
assert(sexp_char_classes[*HERE] & CHAR_token_start);
length = sexp_scan_class(buffer, CHAR_token);
if (!length)
{
werror("sexp: Invalid token.\n");
return NULL;
}
token = ssh_format("%ls", length, HERE);
ADVANCE(length);
return token;
}
#endif
#if 0
#define QUOTE_END -1
#define QUOTE_INVALID -2
static int sexp_dequote(struct simple_buffer *buffer)
{
int c;
if (!LEFT)
return QUOTE_INVALID;
c = GET();
loop:
switch (c)
{
default:
return c;
case '"':
return QUOTE_END;
case '\\':
if (!LEFT)
return QUOTE_INVALID;
switch( (c = GET()) )
{
case '\\':
case '"':
case '\'':
return c;
case 'b':
return 0x8;
case 't':
return 0x9;
case 'n':
return 0xa;
case 'v':
return 0xb;
case 'f':
return 0xc;
case 'r':
return 0xd;
case '\r':
/* Ignore */
if (!LEFT)
return QUOTE_INVALID;
c = GET();
if (c == '\n')
{ /* Ignore this too */
if (!LEFT)
return QUOTE_INVALID;
c = GET();
}
goto loop;
case '\n':
/* Ignore */
if (!LEFT)
return QUOTE_INVALID;
c = GET();
if (c == '\r')
{ /* Ignore this too */
if (!LEFT)
return QUOTE_INVALID;
c = GET();
}
goto loop;
default:
/* Octal escape sequence */
{
int value;
unsigned i;
if (!(sexp_char_classes[c] & CHAR_octal))
{
werror("sexp: Invalid escape character in"
" quoted string: %xi.\n", c);
return QUOTE_INVALID;
}
if (LEFT < 2)
{
werror("sexp: Unexpected eof in octal escape sequence.\n");
return QUOTE_INVALID;
}
value = c - '0';
for (i = 1; i<3; i++)
{
c = GET();
if (!(sexp_char_classes[c] & CHAR_octal))
{