Commit 26e4f8ae authored by Niels Möller's avatar Niels Möller

Cleanup and removal of old #if 0'ed code.

Rev: src/abstract_crypto.h:1.15
Rev: src/abstract_io.h:1.20
Rev: src/alist.c:1.13
Rev: src/alist.h:1.9
Rev: src/channel.c:1.16
Rev: src/channel.h:1.18
Rev: src/client.c:1.37
Rev: src/client_keyexchange.c:1.18
Rev: src/client_keyexchange.h:1.10
Rev: src/client_userauth.c:1.6
Rev: src/connection.h:1.19
Rev: src/crypto.c:1.15
Rev: src/debug.c:1.17
Rev: src/encrypt.c:1.16
Rev: src/io.c:1.33
Rev: src/io.h:1.22
Rev: src/keyexchange.c:1.27
Rev: src/keyexchange.h:1.25
Rev: src/lsh.c:1.26
Rev: src/lsh_types.h:1.22
Rev: src/pad.c:1.19
Rev: src/password.h:1.8
Rev: src/publickey_crypto.c:1.20
Rev: src/publickey_crypto.h:1.13
Rev: src/randomness.c:1.9
Rev: src/randomness.h:1.6
Rev: src/read_data.c:1.14
Rev: src/read_line.c:1.15
Rev: src/read_line.h:1.10
Rev: src/read_packet.c:1.26
Rev: src/reaper.c:1.5
Rev: src/reaper.h:1.4
Rev: src/server.c:1.26
Rev: src/server_keyexchange.c:1.17
Rev: src/server_password.c:1.9
Rev: src/server_userauth.c:1.7
Rev: src/service.c:1.11
Rev: src/service.h:1.11
Rev: src/userauth.h:1.8
Rev: src/write_buffer.h:1.12
Rev: src/xalloc.c:1.16
Rev: src/xalloc.h:1.16
parent 2e9e6d01
......@@ -47,16 +47,6 @@
(crypt method void
"UINT32 length" "UINT8 *src" "UINT8 *dst")))
*/
#if 0
struct crypto_instance
{
struct lsh_object header;
UINT32 block_size;
/* Length must be a multiple of the block size */
void (*crypt)(struct crypto_instance *self,
UINT32 length, UINT8 *src, UINT8 *dst);
};
#endif
#define CRYPT(instance, length, src, dst) \
((instance)->crypt((instance), (length), (src), (dst)))
......@@ -73,19 +63,6 @@ struct crypto_instance
(make_crypt method (object crypto_instance)
"int mode" "UINT8 *key")))
*/
#if 0
struct crypto_algorithm
{
struct lsh_object header;
UINT32 block_size;
UINT32 key_size;
struct crypto_instance * (*make_crypt)(struct crypto_algorithm *self,
int mode,
UINT8 *key);
};
#endif
#define MAKE_ENCRYPT(crypto, key) \
((crypto)->make_crypt((crypto), CRYPTO_ENCRYPT, (key)))
......@@ -106,20 +83,6 @@ struct crypto_algorithm
(copy method (object hash_instance))))
*/
#if 0
struct hash_instance
{
struct lsh_object header;
UINT32 hash_size;
void (*update)(struct hash_instance *self,
UINT32 length, UINT8 *data);
void (*digest)(struct hash_instance *self,
UINT8 *result);
struct hash_instance * (*copy)(struct hash_instance *self);
};
#endif
#define HASH_UPDATE(instance, length, data) \
((instance)->update((instance), (length), (data)))
......@@ -137,16 +100,6 @@ struct hash_instance
(make_hash method (object hash_instance))))
*/
#if 0
struct hash_algorithm
{
struct lsh_object header;
UINT32 block_size;
UINT32 hash_size;
struct hash_instance * (*make_hash)(struct hash_algorithm *self);
};
#endif
#define MAKE_HASH(h) ((h)->make_hash((h)))
/* CLASS:
......@@ -158,16 +111,6 @@ struct hash_algorithm
(make_mac method (object mac_instance) "UINT8 *key")))
*/
#if 0
struct mac_algorithm
{
struct lsh_object header;
UINT32 hash_size;
UINT32 key_size;
struct mac_instance * (*make_mac)(struct mac_algorithm *self,
UINT8 *key);
};
#endif
#define MAKE_MAC(m, key) ((m)->make_mac((m), (key)))
/* CLASS:
......@@ -179,16 +122,6 @@ struct mac_algorithm
"UINT32 length" "UINT8 *data")))
*/
#if 0
struct signer
{
struct lsh_object header;
/* Returns a signature string, *without* the length field */
struct lsh_string * (*sign)(struct signer *closure,
UINT32 length,
UINT8 *data);
};
#endif
#define SIGN(signer, length, data) ((signer)->sign((signer), (length), (data)))
/* CLASS:
......@@ -200,18 +133,6 @@ struct signer
"UINT32 signature_length" "UINT8 * signature_data")))
*/
#if 0
struct verifier
{
struct lsh_object header;
int (*verify)(struct verifier *closure,
UINT32 length,
UINT8 *data,
UINT32 signature_length,
UINT8 * signature_data);
};
#endif
#define VERIFY(verifier, length, data, slength, sdata)\
((verifier)->verify((verifier), (length), (data), (slength), (sdata)))
......@@ -227,21 +148,6 @@ struct verifier
"UINT32 public_length" "UINT8 *public")))
*/
#if 0
struct signature_algorithm
{
struct lsh_object header;
struct signer * (*make_signer)(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public,
UINT32 secret_length,
UINT8 *secret);
struct verifier * (*make_verifier)(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public);
};
#endif
#define MAKE_SIGNER(a, pl, p, sl, s) \
((a)->make_signer((a), (pl), (p), (sl), (s)))
......
......@@ -49,14 +49,6 @@
(read indirect-method int
"UINT32 length" "UINT8 *buffer")))
*/
#if 0
struct abstract_read
{
struct lsh_object header;
int (*read)(struct abstract_read **r,
UINT32 length, UINT8 *buffer);
};
#endif
#define A_READ(f, length, buffer) (f)->read(&(f), (length), (buffer))
......@@ -70,15 +62,6 @@ struct abstract_read
(handler indirect-method int "struct abstract_read *read")))
*/
#if 0
struct read_handler
{
struct lsh_object header;
int (*handler)(struct read_handler **h,
struct abstract_read *read);
};
#endif
#define READ_HANDLER(h, read) ((h)->handler(&(h), (read)))
/* CLASS:
......@@ -88,18 +71,9 @@ struct read_handler
(write method int "struct lsh_string *packet")))
*/
#if 0
struct abstract_write
{
struct lsh_object header;
int (*write)(struct abstract_write *w,
struct lsh_string *packet);
};
#endif
#define A_WRITE(f, packet) ((f)->write((f), (packet)))
/* A handler that passes packets on to another processor */
/* A handler that passes packets on to another handler */
/* CLASS:
(class
(name abstract_write_pipe)
......@@ -108,12 +82,4 @@ struct abstract_write
(next object abstract_write)))
*/
#if 0
struct abstract_write_pipe
{
struct abstract_write super;
struct abstract_write *next;
};
#endif
#endif /*LSH_ABSTRACT_IO_H_INCLUDED */
......@@ -45,10 +45,6 @@ struct alist_node
};
/* Prototypes */
#if 0
static void do_mark_table(struct lsh_object **table,
void (*mark)(struct lsh_object *o));
#endif
static void *do_linear_get(struct alist *c, int atom);
static void do_linear_set(struct alist *c, int atom, void *value);
......@@ -75,26 +71,6 @@ static void do_linked_set(struct alist *c, int atom, void *value);
(methods do_linear_get do_linear_set))
*/
#if 0
struct alist_linear
{
struct alist super;
void *table[NUMBER_OF_ATOMS];
};
#endif
#if 0
void do_mark_table(struct lsh_object **table,
void (*mark)(struct lsh_object *o))
{
unsigned i;
for (i = 0; i<NUMBER_OF_ATOMS; i++)
mark(table[i]);
}
#endif
static void *do_linear_get(struct alist *c, int atom)
{
CAST(alist_linear, self, c);
......@@ -160,15 +136,6 @@ struct alist *make_linear_alist(int n, ...)
(methods do_linked_get do_linked_set))
*/
#if 0
struct alist_linked
{
struct alist super;
struct alist_node *head;
};
#endif
static void do_mark_list(struct alist_node *n,
void (*mark)(struct lsh_object *o))
{
......
......@@ -59,22 +59,6 @@ struct alist;
(methods NULL NULL))
*/
#if 0
struct alist
{
struct lsh_object header;
#if ALIST_USE_SIZE
int size; /* Number of associations with non-zero values */
int * (*keys)(struct alist *self);
#endif
void * (*get)(struct alist *self, int atom);
void (*set)(struct alist *self, int atom, void *value);
};
#endif
#define ALIST_CLASS(l) ((struct alist_meta *) ((l)->super.isa))
#define ALIST_GET(alist, atom) \
......
......@@ -56,21 +56,6 @@
(start object connection_startup)))
*/
#if 0
struct connection_service
{
struct ssh_service super;
/* Supported global requests */
struct alist *global_requests;
struct alist *channel_types;
/* Initialize connection (for instance, request channels to be opened
* or services to be forwarded. */
struct connection_startup *start;
};
#endif
/* CLASS:
(class
(name channel_handler)
......@@ -79,15 +64,6 @@ struct connection_service
(table object channel_table)))
*/
#if 0
struct channel_handler
{
struct packet_handler super;
struct channel_table *table;
};
#endif
/* CLASS:
(class
(name global_request_handler)
......@@ -96,15 +72,6 @@ struct channel_handler
(global_requests object alist)))
*/
#if 0
struct global_request_handler
{
struct channel_handler super;
struct alist *global_requests;
};
#endif
/* CLASS:
(class
(name channel_open_handler)
......@@ -113,15 +80,6 @@ struct global_request_handler
(channel_types object alist)))
*/
#if 0
struct channel_open_handler
{
struct channel_handler super;
struct alist *channel_types;
};
#endif
struct lsh_string *format_global_failure(void)
{
return ssh_format("%c", SSH_MSG_REQUEST_FAILURE);
......@@ -1127,14 +1085,6 @@ struct lsh_string *channel_transmit_extended(struct ssh_channel *channel,
(channel object ssh_channel)))
*/
#if 0
struct channel_write
{
struct abstract_write super;
struct ssh_channel *channel;
};
#endif
/* CLASS:
(class
(name channel_write_extended)
......@@ -1143,14 +1093,6 @@ struct channel_write
(type simple UINT32)))
*/
#if 0
struct channel_write_extended
{
struct channel_write super;
UINT32 type;
};
#endif
static int do_channel_write(struct abstract_write *w,
struct lsh_string *packet)
{
......@@ -1213,14 +1155,6 @@ struct read_handler *make_channel_read_stderr(struct ssh_channel *channel)
(channel object ssh_channel)))
*/
#if 0
struct channel_close_callback
{
struct close_callback super;
struct ssh_channel *channel;
};
#endif
static int channel_close_callback(struct close_callback *c, int reason)
{
CAST(channel_close_callback, closure, c);
......
......@@ -22,13 +22,6 @@
#define CHANNEL_DATA 0
#define CHANNEL_STDERR_DATA 1
#if 0
#define CHANNEL_ACTION_EOF 0
#define CHANNEL_ACTION_CLOSE 1
#define CHANNEL_ACTION_OPEN_SUCCESS 2
#define CHANNEL_ACTION_OPEN_FAILURE 3
#endif
#define CHANNEL_SENT_CLOSE 1
#define CHANNEL_RECIEVED_CLOSE 2
#define CHANNEL_SENT_EOF 4
......@@ -95,62 +88,6 @@
(channel_failure method int)))
*/
#if 0
struct ssh_channel
{
struct lsh_object header;
UINT32 channel_number; /* Remote channel number */
UINT32 max_window; /* We try to keep the rec_window_size
* between max_window / 2 and max_window. */
UINT32 rec_window_size;
UINT32 rec_max_packet;
UINT32 send_window_size;
UINT32 send_max_packet;
/* FIXME: Perhaps this should be moved to the channel_table,
* and a pointer to that table be stored here instead? */
struct abstract_write *write;
struct alist *request_types;
int flags;
/* Number of files connected to this channel. For instance, stdout
* and stderr can be multiplexed on the same channel. We should not
* close the channel until we have got an EOF on both sources. */
int sources;
/* FIXME: What about return values from these functions? A channel
* may fail to process it's data. Is there some way to propagate a
* channel broken message to the other end? */
/* Type is CHANNEL_DATA or CHANNEL_STDERR_DATA */
int (*recieve)(struct ssh_channel *self,
int type, struct lsh_string *data);
/* Called when we are allowed to send data on the channel. */
int (*send)(struct ssh_channel *self);
/* Called when the channel is closed */
void (*close)(struct ssh_channel *self);
/* Called when eof is recieved on the channel (or when it is closed,
* whatever happens first). */
int (*eof)(struct ssh_channel *self);
/* Reply from SSH_MSG_CHANNEL_OPEN_REQUEST */
int (*open_confirm)(struct ssh_channel *self);
int (*open_failure)(struct ssh_channel *self);
/* Reply from SSH_MSG_CHANNEL_REQUEST */
int (*channel_success)(struct ssh_channel *self);
int (*channel_failure)(struct ssh_channel *self);
};
#endif
#define CHANNEL_RECIEVE(s, t, d) \
((s)->recieve((s), (t), (d)))
......@@ -207,35 +144,6 @@ struct ssh_channel
; not new channels can be opened?
))
*/
#if 0
struct channel_table
{
struct lsh_object header;
#if 0
/* FIXME: This is relevant only for the server side. It's probably
* better to store this in the connection struct */
uid_t user; /* Authenticated user */
#endif
/* Channels are indexed by local number */
struct ssh_channel **channels;
/* Allocation of local channel numbers is managed using the same *
* method as is traditionally used for allocation of unix file
* descriptors. */
UINT32 allocated_channels;
UINT32 next_channel;
UINT32 used_channels;
UINT32 max_channels; /* Max number of channels allowed */
/* If non-zero, close connection after all active channels have died. */
int pending_close;
/* FIXME: Perhaps we should use an flag to indicate whether or not
* new channels can be opened? */
};
#endif
/* SSH_MSG_GLOBAL_REQUEST */
/* CLASS:
......@@ -245,17 +153,6 @@ struct channel_table
(handler method int "int want_reply" "struct simple_buffer *args")))
*/
#if 0
struct global_request
{
struct lsh_object header;
int (*handler)(struct global_request *closure,
int want_reply,
struct simple_buffer *args);
};
#endif
#define GLOBAL_REQUEST(c, w, a) ((c)->handler((c), (w), (a)))
/* SSH_MSG_CHANNEL_OPEN */
......@@ -269,19 +166,6 @@ struct global_request
"struct lsh_string **data")))
*/
#if 0
struct channel_open
{
struct lsh_object header;
struct ssh_channel * (*handler)(struct channel_open *closure,
struct simple_buffer *args,
UINT32 *error,
char **error_msg,
struct lsh_string **data);
};
#endif
#define CHANNEL_OPEN(c, a, e, m, d) \
((c)->handler((c), (a), (e), (m), (d)))
......@@ -296,18 +180,6 @@ struct channel_open
"struct simple_buffer *args")))
*/
#if 0
struct channel_request
{
struct lsh_object header;
int (*handler)(struct channel_request *closure,
struct ssh_channel *channel,
int want_reply,
struct simple_buffer *args);
};
#endif
#define CHANNEL_REQUEST(s, c, w, a) \
((s)->handler((s), (c), (w), (a)))
......@@ -320,18 +192,6 @@ struct channel_request
"struct abstract_write *write")))
*/
#if 0
struct connection_startup
{
struct lsh_object header;
int (*start)(struct connection_startup *closure,
struct channel_table *table,
struct abstract_write *write);
};
#endif
#define CONNECTION_START(c, s, w) ((c)->start((c), (s), (w)))
void init_channel(struct ssh_channel *channel);
......
......@@ -66,20 +66,6 @@
(kexinit_handler object packet_handler)))
*/
#if 0
struct client_callback
{
struct fd_callback super;
struct io_backend *backend;
UINT32 block_size;
char *id_comment;
struct randomness *random;
struct make_kexinit *init;
struct packet_handler *kexinit_handler;
};
#endif
static int client_initiate(struct fd_callback **c,
int fd)
{
......@@ -122,14 +108,6 @@ static int client_initiate(struct fd_callback **c,
(connection object ssh_connection)))
*/
#if 0
struct client_line_handler
{
struct line_handler super;
struct ssh_connection *connection;
};
#endif
static struct read_handler *do_line(struct line_handler **h,
UINT32 length,
UINT8 *line)
......@@ -250,16 +228,6 @@ struct close_callback *make_client_close_handler(void)
(service object ssh_service)))
*/
#if 0
struct accept_service_handler
{
struct packet_handler super;
int service_name;
struct ssh_service *service;
};
#endif
static int do_accept_service(struct packet_handler *c,
struct ssh_connection *connection,
struct lsh_string *packet)
......@@ -309,16 +277,6 @@ struct packet_handler *make_accept_service_handler(int service_name,
(service object ssh_service)))
*/
#if 0
struct service_request
{
struct ssh_service super;
int service_name;
struct ssh_service *service;
};
#endif
static int do_request_service(struct ssh_service *c,
struct ssh_connection *connection)
{
......@@ -362,25 +320,6 @@ struct ssh_service *request_service(int service_name,
(exit_status simple "int *")))
*/
#if 0
struct client_session
{
struct ssh_channel super;
/* Exec or shell request. */
int final_request;
struct lsh_string *args;
/* To access stdio */
struct io_fd *in;
struct io_fd *out;
struct io_fd *err;
/* Where to save the exit code. */
int *exit_status;
};
#endif
static int close_client_session(struct ssh_channel *c)
{
CAST(client_session, session, c);
......@@ -414,15 +353,6 @@ static int client_session_die(struct ssh_channel *c)
(exit_status simple "int *")))
*/
#if 0
struct exit_handler