Set destination ID to packet stream as responder too.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 30 Jun 2007 18:54:41 +0000 (18:54 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 30 Jun 2007 18:54:41 +0000 (18:54 +0000)
CHANGES
lib/silcske/silcske.c
lib/silcske/silcske.h

diff --git a/CHANGES b/CHANGES
index 54ed7c062b0b98c1b748dc43fb6b360b6affb945..e34ca8a893d86ab85b4dfce48edfd91b2dce6aac 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Sat Jun 30 21:48:08 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Set the destination ID to packet stream as SKE responder
+         if ID was present in key exchange packet.  Affected file
+         is lib/silcske/silcske.[ch].
+
 Thu Jun 28 19:19:13 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
 
        * SILC Client 1.1.1.
index b5686595213f6494d278f45012d40a5e99aef2d3..efb86c12b63b79ffbedd9eeeb54d2094e53375a8 100644 (file)
@@ -1884,6 +1884,7 @@ SILC_FSM_STATE(silc_ske_st_responder_phase1)
   SilcSKEStatus status;
   SilcSKEStartPayload remote_payload = NULL;
   SilcBuffer packet_buf = &ske->packet->buffer;
+  SilcID id;
 
   SILC_LOG_DEBUG(("Start"));
 
@@ -1898,6 +1899,19 @@ SILC_FSM_STATE(silc_ske_st_responder_phase1)
     return SILC_FSM_CONTINUE;
   }
 
+  /* Get remote ID and set it to stream */
+  if (ske->packet->src_id_len) {
+    silc_id_str2id(ske->packet->src_id, ske->packet->src_id_len,
+                  ske->packet->src_id_type,
+                  (ske->packet->src_id_type == SILC_ID_SERVER ?
+                   (void *)&id.u.server_id : (void *)&id.u.client_id),
+                  (ske->packet->src_id_type == SILC_ID_SERVER ?
+                   sizeof(id.u.server_id) : sizeof(id.u.client_id)));
+    silc_packet_set_ids(ske->stream, 0, NULL, ske->packet->src_id_type,
+                       (ske->packet->src_id_type == SILC_ID_SERVER ?
+                        (void *)&id.u.server_id : (void *)&id.u.client_id));
+  }
+
   /* Take a copy of the payload buffer for future use. It is used to
      compute the HASH value. */
   ske->start_payload_copy = silc_buffer_copy(packet_buf);
index 45837b367d504cfbbda33628a5812d9eea232596..27bc5dc1b0db8257ebdd6081cc87e02c3d9f4976 100644 (file)
@@ -443,8 +443,9 @@ void silc_ske_set_callbacks(SilcSKE ske,
  *    the protocol has completed.  The `stream' is the network connection
  *    to the remote host.  The SKE library will handle all key exchange
  *    packets sent and received in the `stream' connection.  The library will
- *    also set the remote host's ID automatically to the `stream'.  The
- *    `params' include SKE parameters, and it must be provided.
+ *    also set the remote host's ID automatically to the `stream' if it is
+ *    present in the exchanged packets.  The `params' include SKE parameters,
+ *    and it must be provided.
  *
  *    If the `start_payload' is NULL the library will generate it
  *    automatically.  Caller may provide it if it wants to send its own
@@ -478,8 +479,10 @@ SilcAsyncOperation silc_ske_initiator(SilcSKE ske,
  *    callback that was set in silc_ske_set_callbacks will be called once
  *    the protocol has completed.  The `stream' is the network connection
  *    to the remote host.  The SKE library will handle all key exchange
- *    packets sent and received in the `stream' connection.  The `params'
- *    include SKE parameters, and must be provided.
+ *    packets sent and received in the `stream' connection.  The library will
+ *    also set the remote hosts's ID automatically to the `stream' if it is
+ *    present in the exchanged packets.  The `params' include SKE parameters,
+ *    and must be provided.
  *
  *    This function returns SilcAsyncOperation operation context which can
  *    be used to control the protocol from the application.  Application may