From: Pekka Riikonen Date: Sat, 30 Jun 2007 18:54:41 +0000 (+0000) Subject: Set destination ID to packet stream as responder too. X-Git-Tag: silc.trunk.merged.silc.1.1.branch.0~10 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=b280ae52db9aedad40a04691d0a854febfe7b692 Set destination ID to packet stream as responder too. --- diff --git a/CHANGES b/CHANGES index 54ed7c06..e34ca8a8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Sat Jun 30 21:48:08 EEST 2007 Pekka Riikonen + + * 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 * SILC Client 1.1.1. diff --git a/lib/silcske/silcske.c b/lib/silcske/silcske.c index b5686595..efb86c12 100644 --- a/lib/silcske/silcske.c +++ b/lib/silcske/silcske.c @@ -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); diff --git a/lib/silcske/silcske.h b/lib/silcske/silcske.h index 45837b36..27bc5dc1 100644 --- a/lib/silcske/silcske.h +++ b/lib/silcske/silcske.h @@ -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