updates.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 26 Jun 2001 19:38:20 +0000 (19:38 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 26 Jun 2001 19:38:20 +0000 (19:38 +0000)
CHANGES
apps/irssi/src/silc/core/client_ops.c
lib/silcclient/client_keyagr.c

diff --git a/CHANGES b/CHANGES
index 9f08f7652452c79c47b470f48f6cb5c3340c1b24..9c06a57778f88cc5016f19fd686cf375f3a0c827 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,11 @@ Tue Jun 26 19:23:07 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
          against the remote host's (usually a server) version
          string.  Affected file lib/silcclient/silcapi.h
 
+       * Added the KE protocol context to Key Agreement context
+         in client library so that we can abort the SKE if it
+         is in process when we get timeout.  Affected file is
+         lib/silcclient/client_keyagr.c.
+
 Mon Jun 25 21:42:51 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Do not add regex.h for WIN32.  The affected file
index bb95f116a7b3e7fb8860c5ac0b04865e71d31208..0b95e988bd309111cf570e1716e00fbc279113c9 100644 (file)
@@ -1052,7 +1052,7 @@ int silc_key_agreement(SilcClient client, SilcClientConnection conn,
                       SilcKeyAgreementCallback *completion,
                       void **context)
 {
-  char portstr[6];
+  char portstr[12];
 
   /* We will just display the info on the screen and return FALSE and user
      will have to start the key agreement with a command. */
index 6ceb851f8e16ea95132c97664fedef78ac176612..1540b9dc7162206fecbcebb257f5e748bee1142f 100644 (file)
@@ -36,12 +36,13 @@ SILC_TASK_CALLBACK(silc_client_perform_key_agreement_start);
 struct SilcClientKeyAgreementStruct {
   SilcClient client;
   SilcClientConnection conn;
-  int fd;                              /* Listening/connection socket */
-  SilcSocketConnection sock;           /* Remote socket connection */
-  SilcClientEntry client_entry;                /* Destination client */
-  SilcKeyAgreementCallback completion; /* Key agreement completion */
-  void *context;                       /* User context */
-  SilcTask timeout;                    /* Timeout task */
+  int fd;                                /* Listening/connection socket */
+  SilcSocketConnection sock;             /* Remote socket connection */
+  SilcClientEntry client_entry;                  /* Destination client */
+  SilcKeyAgreementCallback completion;   /* Key agreement completion */
+  void *context;                         /* User context */
+  SilcTask timeout;                      /* Timeout task */
+  SilcClientKEInternalContext *proto_ctx; /* Key Exchange protocol context */
 };
 
 /* Packet sending function used by the SKE in the key agreement process. */
@@ -201,12 +202,13 @@ SILC_TASK_CALLBACK(silc_client_process_key_agreement)
      sent as context for the protocol. */
   proto_ctx = silc_calloc(1, sizeof(*proto_ctx));
   proto_ctx->client = client;
-  proto_ctx->sock = newsocket;
+  proto_ctx->sock = silc_socket_dup(newsocket);
   proto_ctx->rng = client->rng;
   proto_ctx->responder = TRUE;
   proto_ctx->context = context;
   proto_ctx->send_packet = silc_client_key_agreement_send_packet;
   proto_ctx->verify = silc_client_protocol_ke_verify_key;
+  ke->proto_ctx = proto_ctx;
 
   /* Prepare the connection for key exchange protocol. We allocate the
      protocol but will not start it yet. The connector will be the
@@ -242,6 +244,8 @@ SILC_TASK_CALLBACK(silc_client_key_agreement_timeout)
     silc_client_del_socket(ke->client, ke->sock);
     silc_socket_free(ke->sock);
   }
+  if (ke->proto_ctx && ke->proto_ctx->ske)
+    silc_ske_free(ke->proto_ctx->ske);
   ke->client_entry->ke = NULL;
   if (ke->fd)
     silc_task_unregister_by_fd(ke->client->io_queue, ke->fd);
@@ -556,12 +560,13 @@ void silc_client_perform_key_agreement_fd(SilcClient client,
      sent as context for the protocol. */
   proto_ctx = silc_calloc(1, sizeof(*proto_ctx));
   proto_ctx->client = client;
-  proto_ctx->sock = ke->sock;
+  proto_ctx->sock = silc_socket_dup(ke->sock);
   proto_ctx->rng = client->rng;
   proto_ctx->responder = FALSE;
   proto_ctx->context = ke;
   proto_ctx->send_packet = silc_client_key_agreement_send_packet;
   proto_ctx->verify = silc_client_protocol_ke_verify_key;
+  ke->proto_ctx = proto_ctx;
 
   /* Perform key exchange protocol. */
   silc_protocol_alloc(SILC_PROTOCOL_CLIENT_KEY_EXCHANGE,