From 16c719b441d65c9dd973297e5883ec2aea205f37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 27 Nov 2000 00:26:04 +0100
Subject: [PATCH] * src/abstract_crypto.h: Some cleanup. * src/abstract_io.h:
 Likewise. * src/channel.c: Likewise. * src/channel.h: Likewise. *
 src/channel_commands.h: Likewise. * src/connection.h: Likewise. *
 src/connection_commands.c: Likewise. * src/dh_exchange.c: Likewise. *
 src/exception.h: Likewise. * src/gateway.c: Likewise. *
 src/gateway_channel.c: Likewise. * src/gateway_commands.c: Likewise. *
 src/handshake.c: Likewise. * src/handshake.h: Likewise. * src/io.h: Likewise.
 * src/io_commands.c: Likewise. * src/io_commands.h: Likewise. *
 src/keyexchange.h: Likewise. * src/lsh.c: Likewise. * src/lsh_proxy.c:
 Likewise. * src/lshg.c: Likewise. * src/publickey_crypto.h: Likewise. *
 src/randomness.c: Likewise. * src/randomness.h: Likewise. *
 src/read_packet.c: Likewise. * src/rsa.c: Likewise. * src/server_pty.h:
 Likewise. * src/server_session.c: Likewise. * src/sexp.h: Likewise. *
 src/sexp_parser.c: Likewise. * src/sexp_streamed_parser.c: Likewise. *
 src/sexp_test.c: Likewise. * src/spki_commands.c: Likewise. *
 src/spki_commands.h: Likewise. * src/ssh1_fallback.c: Likewise. *
 src/tcpforward.c: Likewise. * src/unix_random.c: Likewise. * src/zlib.c:
 Likewise.

Rev: src/abstract_crypto.h:1.34
Rev: src/abstract_io.h:1.33
Rev: src/channel.c:1.89
Rev: src/channel.h:1.63
Rev: src/channel_commands.h:1.18
Rev: src/command.h:1.48
Rev: src/connection.h:1.58
Rev: src/connection_commands.c:1.34
Rev: src/dh_exchange.c:1.11
Rev: src/exception.h:1.24
Rev: src/gateway.c:1.4
Rev: src/gateway_channel.c:1.6
Rev: src/gateway_commands.c:1.7
Rev: src/handshake.c:1.2
Rev: src/handshake.h:1.2
Rev: src/io.h:1.70
Rev: src/io_commands.c:1.35
Rev: src/io_commands.h:1.15
Rev: src/keyexchange.h:1.49
Rev: src/lsh.c:1.128
Rev: src/lsh_proxy.c:1.20
Rev: src/lshg.c:1.5
Rev: src/publickey_crypto.h:1.43
Rev: src/randomness.c:1.22
Rev: src/randomness.h:1.13
Rev: src/read_packet.c:1.49
Rev: src/rsa.c:1.12
Rev: src/server_pty.h:1.12
Rev: src/server_session.c:1.56
Rev: src/sexp.h:1.32
Rev: src/sexp_parser.c:1.19
Rev: src/sexp_streamed_parser.c:1.28
Rev: src/sexp_test.c:1.15
Rev: src/spki_commands.c:1.15
Rev: src/spki_commands.h:1.9
Rev: src/ssh1_fallback.c:1.10
Rev: src/tcpforward.c:1.56
Rev: src/unix_random.c:1.4
Rev: src/zlib.c:1.29
---
 src/abstract_crypto.h      |   7 +-
 src/abstract_io.h          |  12 +-
 src/channel.c              |  26 +-
 src/channel.h              |  66 ++--
 src/channel_commands.h     |  12 +-
 src/command.h              |   9 +-
 src/connection.h           |   9 +-
 src/connection_commands.c  |   7 -
 src/dh_exchange.c          |  18 +-
 src/exception.h            |   4 +-
 src/gateway.c              |   2 +-
 src/gateway_channel.c      |   8 -
 src/gateway_commands.c     |  16 -
 src/handshake.c            |   2 +-
 src/handshake.h            |   2 +-
 src/io.h                   |   5 +-
 src/io_commands.c          |  68 -----
 src/io_commands.h          |   6 +-
 src/keyexchange.h          |   3 +-
 src/lsh.c                  | 605 +------------------------------------
 src/lsh_proxy.c            |   5 -
 src/lshg.c                 |  68 -----
 src/publickey_crypto.h     |   4 +-
 src/randomness.c           |   7 +-
 src/randomness.h           |   4 +-
 src/read_packet.c          |   4 -
 src/rsa.c                  |   6 -
 src/server_pty.h           |   6 +-
 src/server_session.c       |   5 +-
 src/sexp.h                 |   2 +-
 src/sexp_parser.c          |   2 +-
 src/sexp_streamed_parser.c |   6 -
 src/sexp_test.c            |   1 -
 src/spki_commands.c        |   9 -
 src/spki_commands.h        |   5 -
 src/ssh1_fallback.c        |   2 +-
 src/tcpforward.c           |  10 +-
 src/unix_random.c          |   4 +-
 src/zlib.c                 |   2 +-
 39 files changed, 92 insertions(+), 947 deletions(-)

diff --git a/src/abstract_crypto.h b/src/abstract_crypto.h
index bc58e3ff5..23d9ba58a 100644
--- a/src/abstract_crypto.h
+++ b/src/abstract_crypto.h
@@ -137,7 +137,6 @@
        	  "UINT32 length" "const UINT8 *data"
        	  "struct sexp *e")
 
-       ;; FIXME: Perhaps these methods belong to the algorithm object?
        (public_key method (string))
        
        ; Returns ( <pub-sig-alg-id> <s-expr>* ), i.e. the same
@@ -164,7 +163,6 @@
              "int algorithm" "UINT32 length" "const UINT8 *data")
        ; Returns a <sig-val> sexp
        (sign_spki method (object sexp)
-       	     ;; "struct sexp *hash" "struct sexp *principal"
        	     "UINT32 length" "const UINT8 *data")
 
        (get_verifier method (object verifier))))
@@ -185,10 +183,7 @@
                     "struct sexp_iterator *i")
 		    
        (make_verifier method (object verifier)
-                      "struct sexp_iterator *i")
-       ;; (private2public method (object sexp)
-       ;; 		  "struct sexp_iterator *i")
-       ))
+                      "struct sexp_iterator *i")))
 */
 
 #define MAKE_SIGNER(a, i) \
diff --git a/src/abstract_io.h b/src/abstract_io.h
index c06c4ce2d..ccaca0b94 100644
--- a/src/abstract_io.h
+++ b/src/abstract_io.h
@@ -59,13 +59,13 @@
      (vars
        (handler indirect-method
 
-		;; The method returns the amount of data processed. 
-		;; On errors, it can set self to NULL, but only for
-		;; debugging purposes; it's the responibility of the the
-		;; exception handler to close the corresponding fd and
-		;; make sure that handler is not called again. '
+		; The method returns the amount of data processed. 
+		; On errors, it can set self to NULL, but only for
+		; debugging purposes; it's the responibility of the the
+		; exception handler to close the corresponding fd and
+		; make sure that handler is not called again. '
 
-		;; Available is 0 iff we have got EOF.
+		; Available is 0 iff we have got EOF.
 		UINT32 "UINT32 available" "UINT8 *data")))
 		"struct exception_handler *e")))
 */
diff --git a/src/channel.c b/src/channel.c
index 6206bcf4e..7ab5e6551 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -168,7 +168,6 @@ prepare_window_adjust(struct ssh_channel *channel,
      (super exception_handler)
      (vars
        (connection object ssh_connection)
-       ;; (table object channel_table)
        ; Non-zero if the channel has already been deallocated.
        (dead . int)
        ; Local channel number 
@@ -1040,9 +1039,6 @@ parse_channel_open(struct simple_buffer *buffer,
   if (parse_uint8(buffer, &msg_number)
       && (msg_number == SSH_MSG_CHANNEL_OPEN)
       && parse_string(buffer, &info->type_length, &info->type_data)
-#if 0
-      && parse_atom(&buffer, &type)
-#endif
       && parse_uint32(buffer, &info->remote_channel_number)
       && parse_uint32(buffer, &info->send_window_size)
       && parse_uint32(buffer, &info->send_max_packet))
@@ -1075,14 +1071,8 @@ DEFINE_PACKET_HANDLER(static, channel_open_handler,
   struct simple_buffer buffer;
   struct channel_open_info info;
   
-#if 0
-  unsigned msg_number;
-  int type;
-  UINT32 remote_channel_number;
-  UINT32 window_size;
-  UINT32 max_packet;
-#endif
   simple_buffer_init(&buffer, packet->length, packet->data);
+
   if (parse_channel_open(&buffer, &info))
     {
       struct channel_open *open = NULL;
@@ -2063,20 +2053,6 @@ format_channel_open_s(struct lsh_string *type,
  		    args);
 }
 
-#if 0
-struct lsh_string *
-format_channel_open_a(int type,
-		      UINT32 local_channel_number,
-		      struct ssh_channel *channel,
-		      struct lsh_string *args)
-{
-  return ssh_format("%c%a%i%i%i%lS", SSH_MSG_CHANNEL_OPEN,
-		    type, local_channel_number, 
-		    channel->rec_window_size, channel->rec_max_packet,
- 		    args);
-}
-#endif
-
 struct lsh_string *
 format_channel_open(int type, UINT32 local_channel_number,
 		    struct ssh_channel *channel,
diff --git a/src/channel.h b/src/channel.h
index 67d555fc0..57a4ca4af 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -34,15 +34,30 @@
 #include "server_pty.h"
 #include "write_buffer.h"
 
-/* FIXME: Reorder definitions so that we don't need this forward
- * declaration. */
-struct channel_open_info;
+struct channel_open_info
+{
+  UINT32 type_length;
 
-#if 0
-struct channel_request;
-#endif
+  /* NOTE: This is a pointer into the packet, so if it is needed later
+   * it must be copied. */
+  const UINT8 *type_data;
+  
+  int type;
+
+  UINT32 remote_channel_number;
+  UINT32 send_window_size;
+  UINT32 send_max_packet;
+};
 
-struct channel_request_info;
+struct channel_request_info
+{
+  UINT32 type_length;
+  const UINT8 *type_data;
+  
+  int type;
+
+  int want_reply;
+};
 
 #define GABA_DECLARE
 #include "channel.h.x"
@@ -136,8 +151,6 @@ struct channel_request_info;
        (eof method void)
   
        ; Reply from SSH_MSG_CHANNEL_OPEN_REQUEST
-       ;; (open_confirm method int)
-       ;; (open_failure method int)
        (open_continuation object command_continuation)
 
        ; Queue of channel requests that we expect replies on
@@ -147,9 +160,7 @@ struct channel_request_info;
        ; in the right order
        (active_requests struct object_queue)))
        
-       ; Reply from SSH_MSG_CHANNEL_REQUEST 
-       ;; (channel_success method int)
-       ;; (channel_failure method int))) */
+*/
 
 #define CHANNEL_RECEIVE(s, t, d) \
 ((s)->receive((s), (t), (d)))
@@ -239,21 +250,6 @@ struct channel_request_info;
 #define GLOBAL_REQUEST(r, c, t, w, a, n, e) ((r)->handler((r), (c), (t), (w), (a), (n), (e)))
 
 /* SSH_MSG_CHANNEL_OPEN */
-
-struct channel_open_info
-{
-  UINT32 type_length;
-
-  /* NOTE: This is a pointer into the packet, so if it is needed later
-   * it must be copied. */
-  const UINT8 *type_data;
-  
-  int type;
-
-  UINT32 remote_channel_number;
-  UINT32 send_window_size;
-  UINT32 send_max_packet;
-};
   
 /* Raised if opening of a channel fails. Used both on the client and
  * the server side.*/
@@ -276,9 +272,6 @@ make_channel_open_exception(UINT32 error_code, const char *msg);
        (handler method void
                 "struct ssh_connection *connection"
 		"struct channel_open_info *info"
-		;; "UINT32 type"
-		;; "UINT32 send_window_size"
-		;; "UINT32 send_max_packet"
                 "struct simple_buffer *data"
                 "struct command_continuation *c"
 		"struct exception_handler *e")))
@@ -289,17 +282,6 @@ make_channel_open_exception(UINT32 error_code, const char *msg);
 
 /* SSH_MSG_CHANNEL_REQUEST */
 
-struct channel_request_info
-{
-  UINT32 type_length;
-  const UINT8 *type_data;
-  
-  int type;
-
-  int want_reply;
-};
-
-
 /* GABA:
    (class
      (name channel_request)
@@ -308,8 +290,6 @@ struct channel_request_info
 		"struct ssh_channel *channel"
 		"struct ssh_connection *connection"
 		"struct channel_request_info *info"
-		;; "UINT32 type"
-		;; "int want_reply"
 		"struct simple_buffer *args"
 		"struct command_continuation *c"
 		"struct exception_handler *e")))
diff --git a/src/channel_commands.h b/src/channel_commands.h
index b5b3d0d6f..8471922c1 100644
--- a/src/channel_commands.h
+++ b/src/channel_commands.h
@@ -40,9 +40,9 @@
      (name channel_open_command)
      (super command)
      (vars
-       ;; This method should return a partially filled in channel,
-       ;; and create a channel open request by calling
-       ;; prepare_channel_open.
+       ; This method should return a partially filled in channel,
+       ; and create a channel open request by calling
+       ; prepare_channel_open.
        (new_channel method "struct ssh_channel *"
                     "struct ssh_connection *connection"
                     "UINT32 local_channel_number"
@@ -63,9 +63,9 @@ void do_channel_open_command(struct command *s,
      (name channel_request_command)
      (super command)
      (vars
-       ;; This method should return a formatted request. The
-       ;; want_reply field in the request should be non_zero iff *c is
-       ;; non-NULL on return.  
+       ; This method should return a formatted request. The
+       ; want_reply field in the request should be non_zero iff *c is
+       ; non-NULL on return.  
        (format_request method "struct lsh_string *"
                        "struct ssh_channel *channel"
 		       "struct command_continuation **c")))
diff --git a/src/command.h b/src/command.h
index 216203eca..d292e33eb 100644
--- a/src/command.h
+++ b/src/command.h
@@ -60,8 +60,8 @@
      (name command_simple)
      (super command)
      (vars
-       ;; Like call, but returns the value immediately rather than
-       ;; using a continuation function
+       ; Like call, but returns the value immediately rather than
+       ; using a continuation function.
        (call_simple method "struct lsh_object *" "struct lsh_object *")))
 */
 
@@ -211,11 +211,10 @@ do_catch_report_collect(struct command_simple *s,
    (class
      (name collect_info_4)
      (vars
+       ; No next field
        (f method "struct lsh_object *"
                  "struct lsh_object *" "struct lsh_object *"
-		 "struct lsh_object *" "struct lsh_object *")
-       ;; No next field
-       ))
+		 "struct lsh_object *" "struct lsh_object *")))
 */
 
 /* GABA:
diff --git a/src/connection.h b/src/connection.h
index af4348d35..de93bc66e 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -179,15 +179,10 @@ do_##NAME(struct packet_handler *s UNUSED,		\
        ; Table of all opened channels
        (table object channel_table)
        
-       ;; ; Shared handlers 
-       ;; (ignore object packet_handler)
-       ;; (unimplemented object packet_handler)
-       ;; (fail object packet_handler)
-       ;; (forward object packet_handler)
-
        ; (provides_privacy . int)
        ; (provides_integrity . int)
-       )) */
+       ))
+*/
 
 #define C_WRITE(c, s) A_WRITE((c)->write, (s) )
 
diff --git a/src/connection_commands.c b/src/connection_commands.c
index 749560024..540303c76 100644
--- a/src/connection_commands.c
+++ b/src/connection_commands.c
@@ -37,13 +37,6 @@
 
 #include "connection_commands.c.x"
 
-/* ;;GABA:
-   (class
-     (name connection_remember_command)
-     (super command)
-     (vars
-       (connection object ssh_connection)))
-*/
 
 static void
 do_connection_remember(struct command *s,
diff --git a/src/dh_exchange.c b/src/dh_exchange.c
index e941bb8d0..a80edb180 100644
--- a/src/dh_exchange.c
+++ b/src/dh_exchange.c
@@ -43,9 +43,8 @@ init_dh_instance(struct dh_method *m,
   mpz_init(self->e);
   mpz_init(self->f);
   mpz_init(self->secret);
-#if 0
-  mpz_init(self->K);
-#endif
+
+  self->K = NULL;
   
   self->method = m;
   self->hash = MAKE_HASH(m->H);
@@ -229,16 +228,3 @@ dh_process_server_msg(struct dh_instance *self,
   return key;
 }
 
-#if 0
-int
-dh_verify_server_msg(struct dh_instance *self,
-		     struct verifier *v)
-{
-  dh_hash_digest(self);
-
-  return VERIFY(v,
-		self->hash->hash_size, self->exchange_hash->data,
-		self->signature->length, self->signature->data);
-}
-#endif
-
diff --git a/src/exception.h b/src/exception.h
index f10dc961c..2b34bc16d 100644
--- a/src/exception.h
+++ b/src/exception.h
@@ -199,8 +199,8 @@ make_exception_handler(void (*raise)(struct exception_handler *s,
      (name protocol_exception)
      (super exception)
      (vars
-       ;; A reason code that can be passed in a SSH_MSG_DISCONNECT message.
-       ;; Zero means terminate the connection without sending such a message.
+       ; A reason code that can be passed in a SSH_MSG_DISCONNECT message.
+       ; Zero means terminate the connection without sending such a message.
        (reason . UINT32)))
 */
 
diff --git a/src/gateway.c b/src/gateway.c
index 7f33502bd..fb0321b7d 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -99,7 +99,7 @@ make_gateway_address(char *local_user, char *remote_user,
    (class
      (name gateway)
      (vars
-       ;; Where to send packets
+       ; Where to send packets
        (local object abstract_write)))
 */
 
diff --git a/src/gateway_channel.c b/src/gateway_channel.c
index b3f1a50fb..9514380cf 100644
--- a/src/gateway_channel.c
+++ b/src/gateway_channel.c
@@ -165,14 +165,6 @@ do_gateway_channel_open(struct channel_open_command *c,
 				   &target->super,
 				   closure->args);
   
-#if 0
-  if (closure->args)
-    *request = format_channel_open(closure->type, local_channel_number,
-				   &target->super, "%lS", closure->args);
-  else
-    *request = format_channel_open(closure->type, local_channel_number,
-				   &target->super, "");
-#endif
   return &target->super;
 }
 
diff --git a/src/gateway_commands.c b/src/gateway_commands.c
index 6c72d5023..adace5a21 100644
--- a/src/gateway_commands.c
+++ b/src/gateway_commands.c
@@ -150,14 +150,6 @@ DEFINE_COMMAND(gateway_init, a, c, e)
 
 /* (gateway_accept main-connection gateway-connection) */
 
-/* ;; GABA:
-   (class
-     (name gateway_accept_command)
-     (super command)
-     (vars
-       (connection object ssh_connection)))
-*/
-
 static void
 do_gateway_accept(struct command *s,
 		 struct lsh_object *x,
@@ -220,11 +212,3 @@ DEFINE_COMMAND_SIMPLE(gateway_setup_command, a)
 
   return &res->super;
 }
-
-#if 0
-DEFINE_PACKET_HANDLER(static, forward_channel_open_handler,
-		      connection, packet)
-{
-  
-}
-#endif
diff --git a/src/handshake.c b/src/handshake.c
index 0b04a8378..04ce1c1f3 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -53,7 +53,7 @@
      (super line_handler)
      (vars
        (connection object ssh_connection)
-       ;; Needed for fallback.
+       ; Needed for fallback.
        (fd . int)
        (fallback object ssh1_fallback)))
 */
diff --git a/src/handshake.h b/src/handshake.h
index 20a97de43..af252f71a 100644
--- a/src/handshake.h
+++ b/src/handshake.h
@@ -48,7 +48,7 @@
        (random object randomness)
        (algorithms object alist)
        
-       ;; Used only on the server
+       ; Used only on the server
        (fallback object ssh1_fallback)))
 */
 
diff --git a/src/io.h b/src/io.h
index b9b9aea2c..ad1ccb5cd 100644
--- a/src/io.h
+++ b/src/io.h
@@ -86,7 +86,6 @@ extern struct lsh_class io_backend_class;
        ; which seems kind of bogus.
        (e object exception_handler)
        
-       ;;(close_reason . int)
        ; User's close callback
        (close_callback object lsh_callback)
 
@@ -199,9 +198,9 @@ make_listen_value(struct lsh_fd *fd,
      (name io_exception)
      (super exception)
      (vars
-       ;; NULL if no fd was involved
+       ; NULL if no fd was involved
        (fd object lsh_fd)
-       ;; errno code, or zero if not available
+       ; errno code, or zero if not available
        (error . int))))
 */
 
diff --git a/src/io_commands.c b/src/io_commands.c
index acd10c560..87997af0e 100644
--- a/src/io_commands.c
+++ b/src/io_commands.c
@@ -265,74 +265,6 @@ STATIC_COLLECT_2_FINAL(collect_listen_callback);
 struct collect_info_1 listen_with_callback =
 STATIC_COLLECT_1(&collect_info_listen_callback_2);
 
-#if 0
-/* A listen function taking three arguments:
- * (listen backend connection port).
- *
- * Suitable for handling forwarding requests. Adds all fd:s to the
- * connection's resource list automatically.
- *
- * NOTE: On second thought, this is not terribly useful, because
- * accepted fd:s should usually be registered on a channels's resource
- * list, not on the connection's. */
-
-/* ;; GABA:
-   (class
-     (name listen_with_connection)
-     (super command)
-     (vars
-       (connection object ssh_connection)
-       (backend object io_backend)))
-*/
-
-static void
-do_listen_with_connection(struct command *s,
-			  struct lsh_object *x,
-			  struct command_continuation *c,
-			  struct exception_handler *e)
-{
-  CAST(listen_with_connection, self, s);
-  CAST(address_info, address, x);
-
-  /* No dns lookups */
-  do_listen(self->backend, address, 0,
-	    self->connection->resources,
-	    NULL,
-	    c, e);
-}
-
-struct command *
-make_listen_with_connection(struct io_backend *backend,
-			    struct ssh_connection *connection)
-{
-  NEW(listen_with_connection, self);
-  self->connection = connection;
-  self->backend = backend;
-
-  self->super.call = do_listen_with_connection;
-
-  return &self->super;
-}
-
-static struct lsh_object *
-collect_listen_connection(struct collect_info_2 *info,
-			  struct lsh_object *a,
-			  struct lsh_object *b)
-{
-  CAST(io_backend, backend, a);
-  CAST(ssh_connection, connection, b);
-  assert(!info->next);
-
-  return &make_listen_with_connection(backend, connection)->super;
-}
-
-static struct collect_info_2 collect_info_listen_connection_2 =
-STATIC_COLLECT_2_FINAL(collect_listen_connection);
-
-struct collect_info_1 listen_with_connection =
-STATIC_COLLECT_1(&collect_info_listen_connection_2);
-#endif
-
 /* GABA:
    (class
      (name connect_continuation)
diff --git a/src/io_commands.h b/src/io_commands.h
index b7f95e3ab..c3f796808 100644
--- a/src/io_commands.h
+++ b/src/io_commands.h
@@ -85,12 +85,8 @@ extern struct collect_info_1 listen_with_callback;
 #define LISTEN_CALLBACK (&listen_with_callback.super.super.super)
 
 #if 0
-struct command *
-make_listen_with_connection(struct io_backend *backend,
-			    struct ssh_connection *connection);
-#endif
-
 #define LISTEN_CONNECTION (&listen_with_connection.super.super.super)
+#endif
 
 extern struct collect_info_1 connect_with_port;
 #define CONNECT_PORT (&connect_with_port.super.super.super)
diff --git a/src/keyexchange.h b/src/keyexchange.h
index 24af79f94..60ea56ddf 100644
--- a/src/keyexchange.h
+++ b/src/keyexchange.h
@@ -71,6 +71,7 @@
      (vars
        ;; FIXME: Add some method or attribute describing
        ;; the requirements on the hostkey algorithm.
+
        ; Algorithms is an array indexed by the KEX_* values above
        (init method void
 	     "struct ssh_connection *connection"
@@ -94,7 +95,7 @@
        (languages_client_to_server object int_list)
        (languages_server_to_client object int_list)
        (first_kex_packet_follows . int)
-       ;; Used may be NULL. Used only for sending.
+       ; May be NULL. Used only for sending.
        (first_kex_packet string)))
 */
      
diff --git a/src/lsh.c b/src/lsh.c
index 1f4b09aa8..b83cfabf3 100644
--- a/src/lsh.c
+++ b/src/lsh.c
@@ -72,11 +72,6 @@
 #include "lsh_argp.h"
 
 /* Forward declarations */
-#if 0
-struct command_simple options2remote;
-#define OPTIONS2REMOTE (&options2remote.super.super)
-#endif
-
 struct command_simple lsh_verifier_command;
 #define OPTIONS2VERIFIER (&lsh_verifier_command.super.super)
 
@@ -116,26 +111,12 @@ STATIC_REQUEST_SERVICE(ATOM_SSH_CONNECTION);
      (super client_options)
      (vars
        (algorithms object algorithms_options)
-       ;; (backend object io_backend)
 
        (random object randomness_with_poll)
 
-       ;; (tty object interact)
-       
        (signature_algorithms object alist)
        (home . "const char *")
        
-       ; For i/o exceptions 
-       ;; (handler object exception_handler)
-
-       ;; (exit_code . "int *")
-       
-       ;; (not . int)
-       ;; (port . "char *")
-       ;; (remote object address_info)
-
-       ;; (local_user . "char *")
-       ;; (user . "char *")
        (identity . "char *")
        (with_publickey . int)
 
@@ -157,30 +138,7 @@ STATIC_REQUEST_SERVICE(ATOM_SSH_CONNECTION);
 
        (known_hosts . "const char *")
        
-       ; -1 means default behaviour
-       ;; (with_pty . int)
-
-       ;; (with_remote_peers . int)
-
-       ; Session modifiers
-       ;; (stdin_file . "const char *")
-       ;; (stdout_file . "const char *")
-       ;; (stderr_file . "const char *")
-
-       ; fork() extra processes for handling stdio file-descriptors,
-       ; to avoid setting them in non-blocking mode.
-       ;; (stdin_fork . int)
-       ;; (stdout_fork . int)
-       ;; (stderr_fork . int)
-       
-       ; True if the process's stdin or pty (respectively) has been used. 
-       ;; (used_stdin . int)
-       ;; (used_pty . int)
-       
-       ;; (start_shell . int)
-       (start_gateway . int)
-       (remote_forward . int)))
-       ;; (actions struct object_queue)))
+       (start_gateway . int)))
 */
 
 
@@ -194,13 +152,6 @@ make_options(struct io_backend *backend,
 
   self->algorithms
     = make_algorithms_options(all_symmetric_algorithms());
-#if 0
-  init_algorithms_options(&self->super, all_symmetric_algorithms());
-  
-  self->backend = backend;
-
-  self->tty = make_unix_interact(backend);
-#endif
 
   self->random = make_default_random(NULL, handler);
   
@@ -208,45 +159,14 @@ make_options(struct io_backend *backend,
   
   self->signature_algorithms = all_signature_algorithms(&self->random->super);
 
-#if 0
-  self->handler = handler;
-  self->exit_code = exit_code;
-  
-  self->not = 0;
-  self->remote = NULL;
-  self->local_user = self->user = getenv("LOGNAME");
-  
-  /* Default behaviour is to lookup the "ssh" service, and fall back
-   * to port 22 if that fails. */
-  self->port = NULL; 
-#endif
-
   self->sloppy = 0;
   self->capture = NULL;
   self->capture_file = NULL;
 
   self->known_hosts = NULL;
-  /* self->known_hosts_file = NULL; */
-
-#if 0
-  self->stdin_file = NULL;
-  self->stdout_file = NULL;
-  self->stderr_file = NULL;
-  self->used_stdin = 0;
-
-  self->stdin_fork = 0;
-  self->stdout_fork = 0;
-  self->stderr_fork = 0;
-  
-  self->with_pty = -1;
-  self->start_shell = 1;
-  self->with_remote_peers = 0;
-#endif
   
   self->start_gateway = 0;
-#if 0  
-  object_queue_init(&self->actions);
-#endif
+
   self->with_publickey = 1;
 
   self->with_srp_keyexchange = 0;
@@ -261,14 +181,6 @@ make_options(struct io_backend *backend,
   return self;
 }
 
-#if 0
-/* Host to connect to */
-DEFINE_COMMAND_SIMPLE(options2remote, a)
-{
-  CAST(lsh_options, options, a);
-  return &options->remote->super;
-}
-#endif
 
 /* Request ssh-userauth or ssh-connection service, as appropriate,
  * and pass the options as a first argument. */
@@ -404,9 +316,8 @@ make_options_command(struct lsh_options *options,
        (sloppy . int)
        ; If non-null, append an ACL for the received key to this file.
        (file object abstract_write)
-       (hash object hash_algorithm) ; For fingerprinting
-       ;; (algorithm object signature_algorithm)
-       ))
+       ; For fingerprinting
+       (hash object hash_algorithm)))
 */
 
 static struct verifier *
@@ -664,76 +575,6 @@ DEFINE_COMMAND_SIMPLE(lsh_login_command, a)
 		       (connect (options2remote options)))))))))
 */
 
-#if 0
-/* ;;GABA:
-   (expr
-     (name make_start_session)
-     (params
-       (open_session object command)
-       (requests object object_list))
-     (expr (lambda (connection)
-       ((progn requests)
-         ; Create a "session" channel
-         (open_session connection)))))
-*/
-
-/* Requests a shell or command, and connects the channel to our stdio. */
-/* ;;GABA:
-   (expr
-     (name lsh_start_session)
-     (params
-       (request object command))
-     (expr
-       (lambda (session)
-          (client_start_io (request session)))))
-*/
-
-static struct command *
-make_lsh_start_session(struct command *request)
-{
-  CAST_SUBTYPE(command, r, lsh_start_session(request));
-  return r;
-}
-
-/* Parse the argument for -R and -L */
-static int
-parse_forward_arg(char *arg,
-		  UINT32 *listen_port,
-		  struct address_info **target)
-{
-  char *first;
-  char *second;
-  char *end;
-  long port;
-  
-  first = strchr(arg, ':');
-  if (!first)
-    return 0;
-
-  second = strchr(first + 1, ':');
-  if (!second || (second == first + 1))
-    return 0;
-
-  if (strchr(second + 1, ':'))
-    return 0;
-
-  port = strtol(arg, &end, 0);
-  if ( (end == arg)  || (end != first)
-       || (port < 0) || (port > 0xffff) )
-    return 0;
-
-  *listen_port = port;
-
-  port = strtol(second + 1, &end, 0);
-  if ( (end == second + 1) || (*end != '\0')
-       || (port < 0) || (port > 0xffff) )
-    return 0;
-
-  *target = make_address_info(ssh_format("%ls", second - first - 1, first + 1), port);
-  
-  return 1;
-}
-#endif
 
 /* Option parsing */
 
@@ -766,10 +607,6 @@ static const struct argp_option
 main_options[] =
 {
   /* Name, key, arg-name, flags, doc, group */
-#if 0
-  { "port", 'p', "Port", 0, "Connect to this port.", 0 },
-  { "user", 'l', "User name", 0, "Login as this user.", 0 },
-#endif
   { "identity", 'i',  "Identity key", 0, "Use this key to authenticate.", 0 },
   { "publickey", OPT_PUBLICKEY, NULL, 0,
     "Try publickey user authentication (default).", 0 },
@@ -797,44 +634,11 @@ main_options[] =
     "Request the ssh-userauth service (default, unless SRP is being used).", 0 },
   { "no-userauth", OPT_USERAUTH | ARG_NOT, NULL, 0,
     "Request the ssh-userauth service (default if SRP is used).", 0 },
-  
-#if 0
-  { NULL, 0, NULL, 0, "Actions:", 0 },
-#endif
-  { "forward-local-port", 'L', "local-port:target-host:target-port",
+
+  /* ACtions */
+  { "forward-remote-port", 'R', "remote-port:target-host:target-port",
     0, "", CLIENT_ARGP_ACTION_GROUP },
-  { "forward-remote-port", 'R', "remote-port:target-host:target-port", 0, "", 0 },
-#if 0
-  { "nop", 'N', NULL, 0, "No operation (suppresses the default action, "
-    "which is to spawn a remote shell)", 0 },
-  { "execute", 'E', "command", 0, "Execute a command on the remote machine", 0 },
-  { "shell", 'S', "command", 0, "Spawn a remote shell", 0 },
-#endif
   { "gateway", 'G', NULL, 0, "Setup a local gateway", 0 },
-#if 0
-  { NULL, 0, NULL, 0, "Modifiers that apply to port forwarding:", 0 },
-  { "remote-peers", 'g', NULL, 0, "Allow remote access to forwarded ports", 0 },
-  { "no-remote-peers", 'g' | ARG_NOT, NULL, 0, 
-    "Disallow remote access to forwarded ports (default).", 0 },
-
-  { NULL, 0, NULL, 0, "Modifiers that apply to remote execution:", 0 },
-  { "stdin", OPT_STDIN, "Filename", 0, "Redirect stdin", 0},
-  { "no-stdin", OPT_STDIN | ARG_NOT, NULL, 0, "Redirect stdin from /dev/null", 0}, 
-  { "stdout", OPT_STDOUT, "Filename", 0, "Redirect stdout", 0},
-  { "no-stdout", OPT_STDOUT | ARG_NOT, NULL, 0, "Redirect stdout to /dev/null", 0}, 
-  { "stderr", OPT_STDERR, "Filename", 0, "Redirect stderr", 0},
-  { "no-stderr", OPT_STDERR | ARG_NOT, NULL, 0, "Redirect stderr to /dev/null", 0}, 
-  { "cvs-workaround", OPT_FORK_STDIO, "i?o?e?", OPTION_ARG_OPTIONAL,
-    "fork extra processes to read one or more of the stdio file "
-    "descriptors, to avoid setting them in non-blocking mode.", 0 },
-  
-#if WITH_PTY_SUPPORT
-  { "pty", 't', NULL, 0, "Request a remote pty (default).", 0 },
-  { "no-pty", 't' | ARG_NOT, NULL, 0, "Don't request a remote pty.", 0 },
-#endif /* WITH_PTY_SUPPORT */
-  { NULL, 0, NULL, 0, "Universal not:", 0 },
-  { "no", 'n', NULL, 0, "Inverts the effect of the next modifier", 0 },
-#endif
   { NULL, 0, NULL, 0, NULL, 0 }
 };
 
@@ -848,269 +652,6 @@ main_argp_children[] =
   { NULL, 0, NULL, 0}
 };
 
-#if 0
-/* FIXME: Moves to client.c */
-static int
-fork_input(int in)
-{
-  /* pipe[0] for reading, pipe[1] for writing. */
-  int pipe[2];
-
-  if (!lsh_make_pipe(pipe))
-    return -1;
-
-  switch (fork())
-    {
-    case -1:
-      /* Error */
-      return -1;
-    case 0:
-      close(pipe[0]);
-      if (lsh_copy_file(in, pipe[1]))
-	_exit(EXIT_SUCCESS);
-      else
-	_exit(EXIT_FAILURE);
-    default:
-      /* Parent */
-      close(pipe[1]);
-      return pipe[0];
-    }
-}
-
-static int
-fork_output(int out)
-{
-  /* pipe[0] for reading, pipe[1] for writing. */
-  int pipe[2];
-
-  if (!lsh_make_pipe(pipe))
-    return -1;
-
-  switch (fork())
-    {
-    case -1:
-      /* Error */
-      return -1;
-    case 0:
-      close(pipe[1]);
-      if (lsh_copy_file(pipe[0], out))
-	_exit(EXIT_SUCCESS);
-      else
-	_exit(EXIT_FAILURE);
-    default:
-      /* Parent */
-      close(pipe[0]);
-      return pipe[1];
-    }
-}
-
-/* Create a session object. stdout and stderr are shared (although
- * with independent lsh_fd objects). stdin can be used by only one
- * session (until something "session-control"/"job-control" is added).
- * */
-static struct ssh_channel *
-make_lsh_session(struct lsh_options *self)
-{
-  int in;
-  int out;
-  int err;
-
-  debug("lsh.c: Setting up stdin\n");
-
-  if (self->stdin_file)
-    in = open(self->stdin_file, O_RDONLY);
-  else
-    {
-      if (self->used_stdin)
-	in = open("/dev/null", O_RDONLY);
-      else 
-	{
-	  in = (self->stdin_fork ? fork_input : dup)(STDIN_FILENO);
-	  self->used_stdin = 1;
-	}
-    }
-    
-  if (in < 0)
-    {
-      werror("lsh: Can't dup/open stdin (errno = %i): %z!\n",
-	     errno, strerror(errno));
-      return NULL;
-    }
-
-  debug("lsh.c: Setting up stdout\n");
-
-  if (self->stdout_file)
-    out = open(self->stdout_file, O_WRONLY | O_CREAT, 0666);
-  else if (self->stdout_fork)
-    out = fork_output(STDOUT_FILENO);
-  else
-    out = dup(STDOUT_FILENO);
-
-  if (out < 0)
-    {
-      werror("lsh: Can't dup/open stdout (errno = %i): %z!\n",
-	     errno, strerror(errno));
-      close(in);
-      return NULL;
-    }
-
-  debug("lsh.c: Setting up stderr\n");
-  
-  if (self->stderr_file)
-    err = open(self->stderr_file, O_WRONLY | O_CREAT, 0666);
-  else if (self->stderr_fork)
-    err = fork_output(STDERR_FILENO);
-  else
-    {
-      err = dup(STDERR_FILENO);
-      set_error_stream(STDERR_FILENO, 1);
-    }
-
-  if (err < 0) 
-    {
-      werror("lsh: Can't dup/open stderr!\n");
-      close(in);
-      close(out);
-      return NULL;
-    }
-
-  /* Clear options */
-  self->stdin_file = self->stdout_file = self->stderr_file = NULL;
-  
-  return make_client_session_channel
-    (io_read(make_lsh_fd(self->backend, in, self->handler),
-	     NULL, NULL),
-     io_write(make_lsh_fd(self->backend, out, self->handler),
-	      BLOCK_SIZE, NULL),
-     io_write(make_lsh_fd(self->backend, err, self->handler),
-	      BLOCK_SIZE, NULL),
-     WINDOW_SIZE,
-     self->exit_code);
-}
-
-/* FIXME: Moves to client.c */
-/* Create an interactive session */
-static struct command *
-lsh_shell_session(struct lsh_options *self)
-{
-  struct command *get_pty = NULL;
-  struct command *get_shell;
-  
-  struct object_list *session_requests;
-  struct ssh_channel *session = make_lsh_session(self);
-
-  if (!session)
-    return NULL;
-  
-#if WITH_PTY_SUPPORT
-  if (self->with_pty && !self->used_pty)
-    {
-      self->used_pty = 1;
-      
-      if (self->tty && INTERACT_IS_TTY(self->tty))
-	{
-	  get_pty = make_pty_request(self->tty);
-	  if (!get_pty)
-	    {
-	      werror("lsh: Can't use tty (probably getattr or atexit() failed.\n");
-	    }
-	}
-      else
-	{
-	  werror("lsh: No tty available.\n");
-	}
-    }
-
-  get_shell = make_lsh_start_session(&request_shell.super);
-  
-  /* FIXME: We need a non-varargs constructor for lists. */
-  if (get_pty)
-    session_requests
-      = make_object_list(2,
-			 /* Ignore EXC_CHANNEL_REQUEST for the pty allocation call. */
-			 make_catch_apply
-			 (make_catch_handler_info(EXC_ALL, EXC_CHANNEL_REQUEST,
-						  0, NULL),
-			  get_pty),
-			 get_shell, -1);
-  else
-#endif /* WITH_PTY_SUPPORT */
-    session_requests = make_object_list(1, get_shell, -1);
-
-  {
-    CAST_SUBTYPE(command, r,
-		 make_start_session
-		 (make_open_session_command(session), session_requests));
-    return r;
-  }
-}
-
-/* Create a session executing a command line */
-static struct command *
-lsh_command_session(struct lsh_options *self,
-		    struct lsh_string *command)
-{
-  struct ssh_channel *session = make_lsh_session(self);
-
-  if (session)
-    {
-      CAST_SUBTYPE(command, r,
-		   make_start_session
-		   (make_open_session_command(session),
-		    make_object_list
-		    (1, make_lsh_start_session(make_exec_request(command)),
-		     -1)));
-      return r;
-    }
-  
-  return NULL;
-}
-
-static struct command *
-lsh_add_action(struct lsh_options *self,
-	       struct command *action)
-{
-  if (action)
-    object_queue_add_tail(&self->actions, &action->super);
-
-  return action;
-}
-
-/* NOTE: Some of the original quoting is lost here. */
-static struct lsh_string *
-rebuild_command_line(unsigned argc, char **argv)
-{
-  unsigned length;
-  unsigned i;
-  unsigned pos;
-  struct lsh_string *r;
-  unsigned *alengths = alloca(sizeof(unsigned) * argc);
-  
-  assert (argc);
-  length = argc - 1; /* Number of separating spaces. */
-
-  for (i = 0; i<argc; i++)
-    {
-      alengths[i] = strlen(argv[i]);
-      length += alengths[i];
-    }
-
-  r = lsh_string_alloc(length);
-  memcpy(r->data, argv[0], alengths[0]);
-  pos = alengths[0];
-  for (i = 1; i<argc; i++)
-    {
-      r->data[pos++] = ' ';
-      memcpy(r->data + pos, argv[i], alengths[i]);
-      pos += alengths[i];
-    }
-
-  assert(pos == r->length);
-
-  return r;
-}
-#endif
-
 #define CASE_ARG(opt, attr, none)		\
   case opt:					\
     if (self->super.not)			\
@@ -1153,37 +694,6 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
       state->child_inputs[1] = self->algorithms;
       state->child_inputs[2] = NULL;
       break;
-#if 0
-    case ARGP_KEY_NO_ARGS:
-      argp_usage(state);
-      break;
-
-    case ARGP_KEY_ARG:
-      if (!state->arg_num)
-	{
-	  if (self->port)
-	    self->remote = make_address_info_c(arg, self->port, 0);
-	  else
-	    self->remote = make_address_info_c(arg, "ssh", 22);
-	  
-	  if (!self->remote)
-	    argp_error(state, "Invalid port or service '%s'.", self->port);
-
-	  break;
-	}
-      else
-	/* Let the next case parse it.  */
-	return ARGP_ERR_UNKNOWN;
-
-      break;
-    case ARGP_KEY_ARGS:
-      lsh_add_action(self,
-		     lsh_command_session(self,
-					 rebuild_command_line(state->argc - state->next,
-							      state->argv + state->next)));
-      self->start_shell = 0;
-      break;
-#endif
       
     case ARGP_KEY_END:
       if (!self->home)
@@ -1191,13 +701,7 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
 	  argp_error(state, "No home directory. Please set HOME in the environment.");
 	  break;
 	}
-#if 0	  
-      if (!self->user)
-	{
-	  argp_error(state, "No user name given. Use the -l option, or set LOGNAME in the environment.");
-	  break;
-	}
-#endif    
+
       if (self->with_dh_keyexchange < 0)
 	self->with_dh_keyexchange = !self->with_srp_keyexchange;
       
@@ -1309,18 +813,7 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
 	  }
 	lsh_string_free(tmp);
       }
-#if 0
-#if WITH_TCP_FORWARD
-      if (self->remote_forward)
-	lsh_add_action(self,
-		       make_install_fix_channel_open_handler
-		       (ATOM_FORWARDED_TCPIP, &channel_open_forwarded_tcpip));
-#endif /* WITH_TCP_FORWARD */
-
-      /* Add shell action */
-      if (self->start_shell)
-	lsh_add_action(self, lsh_shell_session(self));
-#endif
+
       if (self->start_gateway)
 	{
 	  struct local_info *gateway;
@@ -1345,26 +838,11 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
 			    make_gateway_setup
 			    (make_listen_local(self->super.backend, gateway)));
 	}
-#if 0
-      if (object_queue_is_empty(&self->actions))
-	{
-	  argp_error(state, "No actions given.");
-	  break;
-	}
-#endif
+
       /* Start background poll */
       RANDOM_POLL_BACKGROUND(self->random->poller);
       
       break;
-#if 0
-    case 'p':
-      self->port = arg;
-      break;
-
-    case 'l':
-      self->user = arg;
-      break;
-#endif
       
     case 'i':
       self->identity = optarg;
@@ -1392,15 +870,8 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
     CASE_FLAG(OPT_SRP, with_srp_keyexchange);
 
     CASE_FLAG(OPT_USERAUTH, with_userauth);
-#if 0
-    case 'E':
-      lsh_add_action(self, lsh_command_session(self, ssh_format("%lz", arg)));
-      break;
 
-    case 'S':
-      lsh_add_action(self, lsh_shell_session(self));
-      break;
-#endif 
+#if 0
     case 'L':
       {
 	UINT32 listen_port;
@@ -1418,7 +889,8 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
 			   target));
 	break;
       }      
-
+#endif
+      
     case 'R':
       {
 	UINT32 listen_port;
@@ -1434,59 +906,12 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
 					      : ssh_format("%lz", "127.0.0.1")),
 					     listen_port),
 			   target));
-	self->remote_forward = 1;
+
+	self->super.remote_forward = 1;
 	break;
       }      
-#if 0
-    case 'N':
-      self->start_shell = 0;
-      break;
-#endif
       
     CASE_FLAG('G', start_gateway);
-#if 0
-    CASE_FLAG('g', with_remote_peers);
-
-#if WITH_PTY_SUPPORT
-    CASE_FLAG('t', with_pty);
-#endif /* WITH_PTY_SUPPORT */
-
-    CASE_ARG(OPT_STDIN, stdin_file, "/dev/null");
-    CASE_ARG(OPT_STDOUT, stdout_file, "/dev/null"); 
-    CASE_ARG(OPT_STDERR, stderr_file, "/dev/null");
-
-    case OPT_FORK_STDIO:
-      if (!arg)
-	self->stdin_fork = self->stdout_fork = self->stderr_fork = 1;
-      else
-	{
-	  int i;
-	  for (i = 0; arg[i]; i++)
-	    switch(arg[i])
-	      {
-	      case 'i': case 'I':
-		self->stdin_fork = 1;
-		break;
-	      case 'o': case 'O':
-		self->stdout_fork = 1;
-		break;
-	      case 'e': case 'E':
-		self->stderr_fork = 1;
-		break;
-	      default:
-		argp_error(state, "The argument to --cvs-workaround should "
-			   "be one or more of the characters 'i' (stdin), "
-			   "'o' (stdout) and 'e' (stderr).");
-		goto loop_done;
-	      }
-	loop_done:
-	}
-      break;
-		
-    case 'n':
-      self->not = !self->not;
-      break;
-#endif
     }
 
   return 0;
diff --git a/src/lsh_proxy.c b/src/lsh_proxy.c
index d513a5e7b..f42f6e95e 100644
--- a/src/lsh_proxy.c
+++ b/src/lsh_proxy.c
@@ -96,11 +96,6 @@ struct command_simple proxy_destination;
 #include <unistd.h>
 #endif
 
-#if 0
-/* Block size for stdout and stderr buffers */
-#define BLOCK_SIZE 32768
-#endif
-
 /* Option parsing */
 
 const char *argp_program_version
diff --git a/src/lshg.c b/src/lshg.c
index 4f516b588..a92b99a92 100644
--- a/src/lshg.c
+++ b/src/lshg.c
@@ -46,10 +46,6 @@
 struct command_simple options2info;
 #define OPTIONS2INFO (&options2info.super.super)
 
-#if 0
-struct command_simple options2actions;
-#define OPTIONS2ACTIONS (&options2actions.super.super)
-#endif
 
 #include "lshg.c.x"
 
@@ -82,13 +78,6 @@ DEFINE_COMMAND_SIMPLE(options2info, a)
 			       self->super.remote)->super;
 }
 
-#if 0
-DEFINE_COMMAND_SIMPLE(options2actions, a)
-{
-  CAST(lshg_options, self, a);
-  return &queue_to_list(&self->actions)->super.super;
-}
-#endif
 
 /* GABA:
    (expr
@@ -168,13 +157,6 @@ static const struct argp_option
 main_options[] =
 {
   /* Name, key, arg-name, flags, doc, group */
-#if 0
-  { "port", 'p', "Port", 0, "Connect to this port.", 0 },
-  { "user", 'l', "User name", 0, "Login as this user.", 0 },
-  { NULL, 0, NULL, 0, "Actions:", 0 },
-  { "execute", 'E', "command", 0, "Execute a command on the remote machine", 0 },  
-  { "shell", 'S', "command", 0, "Spawn a remote shell", 0 },
-#endif
   { "send-debug", 'D', "Message", 0, "Send a debug message "
     "to the remote machine.", CLIENT_ARGP_ACTION_GROUP },
   { "send-ignore", 'I', "Message", 0, "Send an ignore message "
@@ -190,17 +172,6 @@ main_argp_children[] =
   { NULL, 0, NULL, 0}
 };
 
-#if 0
-static struct command *
-lshg_add_action(struct lshg_options *self,
-		struct command *action)
-{
-  if (action)
-    object_queue_add_tail(&self->actions, &action->super);
-
-  return action;
-}
-#endif
 
 static error_t
 main_argp_parser(int key, char *arg, struct argp_state *state)
@@ -215,26 +186,7 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
       state->child_inputs[0] = &self->super;
       state->child_inputs[1] = NULL;
       break;
-#if 0
-    case ARGP_KEY_NO_ARGS:
-      argp_usage(state);
-      break;
-
-    case ARGP_KEY_ARG:
-      if (!state->arg_num)
-	{
-	  self->remote = make_address_info_c(arg, "ssh", 22);
-	  assert(self->remote);
-	  break;
-	}
-      else
-	/* Let the next case parse it.  */
-	return ARGP_ERR_UNKNOWN;
 
-    case ARGP_KEY_ARGS:
-      /* Handle command line. */
-      break;
-#endif
     case ARGP_KEY_END:
       if (!self->super.local_user)
 	{
@@ -248,23 +200,8 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
 					   self->super.user,
 					   self->super.remote);
 
-#if 0
-      if (object_queue_is_empty(&self->super.actions))
-	{
-	  argp_error(state, "No actions given.");
-	    break;
-	}
-#endif 
-      break;
-#if 0
-    case 'E':
-      lshg_add_action(self, lsh_command_session(self, ssh_format("%lz", arg)));
       break;
 
-    case 'S':
-      lshg_add_action(self, lsh_shell_session(self));
-      break;
-#endif
     case 'D':
       client_add_action(&self->super, make_lshg_send_debug(arg));
       break;
@@ -272,11 +209,6 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
     case 'I':
       client_add_action(&self->super, make_lshg_send_ignore(arg));
       break;
-#if 0
-    case 'n':
-      self->not = !self->not;
-      break;
-#endif      
     }
   return 0;
 }
diff --git a/src/publickey_crypto.h b/src/publickey_crypto.h
index 312840e04..74753bc6b 100644
--- a/src/publickey_crypto.h
+++ b/src/publickey_crypto.h
@@ -59,10 +59,10 @@ make_keypair(UINT32 type,
        (order bignum)
        (generator bignum)
        
-       ;; Checks if a bignum is in the correct range for being a group element. 
+       ; Checks if a bignum is in the correct range for being a group element. 
        (range method int "mpz_t x")
 
-       ; (member method int "mpz_t x")
+       ;; (member method int "mpz_t x")
        
        (invert method void "mpz_t res" "mpz_t x")
        (combine method void "mpz_t res" "mpz_t a" "mpz_t b")
diff --git a/src/randomness.c b/src/randomness.c
index c54d22fb1..2c09f1b5a 100644
--- a/src/randomness.c
+++ b/src/randomness.c
@@ -305,13 +305,10 @@ make_reasonably_random(void)
   if (r)
     r->quality = 1;
   else
-    fatal("No /dev/urandom.\n");
-#if 0
   {
-      werror("Warning: Falling back to an insecure pseudorandom generator.\n");
-      r = make_poor_random(&sha1_algorithm, NULL);
+    werror("Warning: Falling back to an insecure pseudorandom generator.\n");
+    r = make_poor_random(&sha1_algorithm, NULL);
   }
-#endif
   return r;
 }
 #endif
diff --git a/src/randomness.h b/src/randomness.h
index 70f0f7330..43f7a5484 100644
--- a/src/randomness.h
+++ b/src/randomness.h
@@ -53,8 +53,8 @@
    (class
      (name random_poll)
      (vars
-       ;; Both functions return an entropy estimate, and adds the
-       ;; randomness to the given hash instance.
+       ; Both functions return an entropy estimate, and adds the
+       ; randomness to the given hash instance.
        (slow method unsigned "struct hash_instance *")
        (fast method unsigned "struct hash_instance *")
        (background method void)))
diff --git a/src/read_packet.c b/src/read_packet.c
index 83df0ecac..98e391a91 100644
--- a/src/read_packet.c
+++ b/src/read_packet.c
@@ -51,10 +51,6 @@
      (vars
        (state . int)
   
-       ; This is usually initialized from the command
-       ; that created the fd.
-       ;; (e object exception_handler)
-
        ; Attached to read packets
        (sequence_number . UINT32)
   
diff --git a/src/rsa.c b/src/rsa.c
index 72df6ea8c..bdb2c6100 100644
--- a/src/rsa.c
+++ b/src/rsa.c
@@ -475,12 +475,6 @@ do_rsa_sign_spki(struct signer *s,
   rsa_compute_root(self, m, m);
 
   signature = encode_rsa_sig_val(m);
-
-#if 0
-  /* Build signature */
-  signature = sexp_l(4, SA(SIGNATURE), hash, principal,
-		     sexp_un(m), -1);
-#endif
   
   mpz_clear(m);
   return signature;
diff --git a/src/server_pty.h b/src/server_pty.h
index d84aa6c75..a7348149a 100644
--- a/src/server_pty.h
+++ b/src/server_pty.h
@@ -45,15 +45,13 @@
        (vars
          (master . int)
 	 (slave . int)
+
 	 ; Name of slave tty.
 	 ; Needed for SysV pty-handling (where opening the tty
 	 ; makes it the controlling terminal). Perhaps handy also for
 	 ; writing accurate utmp-entries.
 	 ; This string should be NUL-terminated
-	 (tty_name string)
-	 ; (tty_name array (simple char) MAX_TTY_NAME)
-	 ;; (saved_ios . "struct termios")
-	 ));
+	 (tty_name string)))
 */
 
 struct pty_info *make_pty_info(void);
diff --git a/src/server_session.c b/src/server_session.c
index 7efb150a7..ad75e808f 100644
--- a/src/server_session.c
+++ b/src/server_session.c
@@ -75,8 +75,9 @@
        ; Child process's stdio 
        (in object lsh_fd)
        (out object lsh_fd)
-       ;; err may be NULL, if there's no separate stderr channel.
-       ;; This happens if we use a pty, and the bash workaround
+
+       ; err may be NULL, if there's no separate stderr channel.
+       ; This happens if we use a pty, and the bash workaround is used.
        (err object lsh_fd)))
 */
 
diff --git a/src/sexp.h b/src/sexp.h
index 91a8e528f..cff3384bd 100644
--- a/src/sexp.h
+++ b/src/sexp.h
@@ -46,7 +46,7 @@
    (class
      (name sexp)
      (vars
-       ;; NULL for non-lists
+       ; NULL for non-lists
        (iter method "struct sexp_iterator *")
        (format method "struct lsh_string *" "int style" "unsigned indent")))
 */
diff --git a/src/sexp_parser.c b/src/sexp_parser.c
index b44c036ef..11972d5bf 100644
--- a/src/sexp_parser.c
+++ b/src/sexp_parser.c
@@ -270,7 +270,7 @@ struct sexp *
 string_to_sexp(int style, struct lsh_string *src, int free)
 {
   struct simple_buffer buffer;
-  struct sexp *e = NULL;;
+  struct sexp *e = NULL;
   
   simple_buffer_init(&buffer, src->length, src->data);
 
diff --git a/src/sexp_streamed_parser.c b/src/sexp_streamed_parser.c
index 4724c1d79..9cc2134d2 100644
--- a/src/sexp_streamed_parser.c
+++ b/src/sexp_streamed_parser.c
@@ -49,8 +49,6 @@ EXCEPTION_RAISE(e, make_simple_exception(EXC_SEXP_EOF, msg))
      (name parser)
      (super read_handler)
      (vars
-       ;;; Where to return values
-       ;; (c object command_continuation)
        ; How to handle errors
        (e object exception_handler)
        ; What to do with the rest of the input stream
@@ -388,7 +386,6 @@ make_return_string(struct command_continuation *c)
      (super parser)
      (vars
        (expect . UINT8)))
-       ;; (value object sexp)))
 */
 
 static UINT32
@@ -513,9 +510,6 @@ make_parse_display(struct read_handler * (*make)(struct abstract_write *h,
      (name handle_element)
      (super command_continuation)
      (vars
-	 ; Scanner to restore at the end of each element
-	 ;; (location . "struct scanner **")
-	 ;; (restore object scanner)
 	 ; Number of elements collected so far
 	 (count . unsigned)
 	 (l struct object_queue)))
diff --git a/src/sexp_test.c b/src/sexp_test.c
index a4232dc75..c810b8a13 100644
--- a/src/sexp_test.c
+++ b/src/sexp_test.c
@@ -73,7 +73,6 @@ do_output_sexp(struct sexp_handler *h, struct sexp *e)
      (name input_closed)
      (super lsh_callback)
      (vars
-       ;; (status . "int *")
        (output object write_buffer)))
 */
 
diff --git a/src/spki_commands.c b/src/spki_commands.c
index fc75597e8..153def526 100644
--- a/src/spki_commands.c
+++ b/src/spki_commands.c
@@ -522,15 +522,6 @@ make_spki_read_userkeys(struct alist *algorithms,
   }
 }
 
-#if 0
-DEFINE_COMMAND_SIMPLE(spki_read_userkeys_command, a)
-{
-  CAST_SUBTYPE(alist, algorithms, a);
-  
-  return &make_spki_read_userkeys(algorithms)->super;
-}
-#endif
-
 /* Encryption of private data.
  * For PKCS#5 (version 2) key derivation, we use
  *
diff --git a/src/spki_commands.h b/src/spki_commands.h
index bacf05280..d6c624398 100644
--- a/src/spki_commands.h
+++ b/src/spki_commands.h
@@ -49,11 +49,6 @@ extern struct command_simple spki_read_acls_command;
 extern struct command_simple spki_read_hostkeys_command;
 #define SPKI_READ_HOSTKEYS (&spki_read_hostkeys_command.super.super)
 
-#if 0
-extern struct command_simple spki_read_userkeys_command;
-#define SPKI_READ_USERKEYS (&spki_read_userkeys_command.super.super)
-#endif
-
 struct command *
 make_spki_hash(int name, struct hash_algorithm *algorithm);
 
diff --git a/src/ssh1_fallback.c b/src/ssh1_fallback.c
index 6b1eac6bf..f6579efff 100644
--- a/src/ssh1_fallback.c
+++ b/src/ssh1_fallback.c
@@ -42,7 +42,7 @@
      (name sshd1)
      (super ssh1_fallback)
      (vars
-       ;; Full path to sshd1
+       ; Full path to sshd1
        (sshd1 . "char *")))
 */
 
diff --git a/src/tcpforward.c b/src/tcpforward.c
index 84e3a4fa7..b72fe5cac 100644
--- a/src/tcpforward.c
+++ b/src/tcpforward.c
@@ -437,11 +437,11 @@ make_tcpip_forward_request_exc(struct ssh_connection *connection,
      (name tcpip_forward_request)
      (super global_request)
      (vars
-       ;; The callback is invoked for each request, with the port as
-       ;; argument. If successful, it should return the fd object
-       ;; associated with the listening port. It need not remember the port;
-       ;; the continuation installed by do_tcpip_forward_request()
-       ;; takes care of that.
+       ; The callback is invoked for each request, with the port as
+       ; argument. If successful, it should return the fd object
+       ; associated with the listening port. It need not remember the port;
+       ; the continuation installed by do_tcpip_forward_request()
+       ; takes care of that.
        (callback object command)))
 */
 
diff --git a/src/unix_random.c b/src/unix_random.c
index 7360181b7..4bbfbf3af 100644
--- a/src/unix_random.c
+++ b/src/unix_random.c
@@ -73,7 +73,7 @@ enum poll_status { POLL_NO_POLL, POLL_RUNNING, POLL_FINISHED, POLL_FAILED };
      (name unix_random)
      (super random_poll)
      (vars
-       ;; For the slow poll
+       ; For the slow poll
        (reaper object reap)
        (poll_uid . uid_t)
        (pid . pid_t)
@@ -81,7 +81,7 @@ enum poll_status { POLL_NO_POLL, POLL_RUNNING, POLL_FINISHED, POLL_FAILED };
        ; NOTE: This fd is not known to the gc. 
        (fd . int)
      
-       ;; For the fast poll, count number of slow polls per second.
+       ; For the fast poll, count number of slow polls per second.
        (previous_time . time_t)
        (time_count . unsigned)))
 */
diff --git a/src/zlib.c b/src/zlib.c
index fe36de4ab..c1f7df66a 100644
--- a/src/zlib.c
+++ b/src/zlib.c
@@ -49,7 +49,7 @@ static void do_free_zstream(z_stream *z);
      (name zlib_instance)
      (super compress_instance)
      (vars
-       ;; Fail before producing larger packets than this
+       ; Fail before producing larger packets than this
        (max . UINT32)
        (rate . UINT32)
        (f pointer (function int "z_stream *" int))
-- 
GitLab