From a0830a7fbd2ef6119658f046943c93409c7625e0 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 5 Jun 2007 19:02:59 +0000 Subject: [PATCH] Fixed silc_packet_get_ids to parse the IDs correctly. --- lib/silccore/silcpacket.c | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index 021041b0..17f0a9e4 100644 --- a/lib/silccore/silcpacket.c +++ b/lib/silccore/silcpacket.c @@ -1352,37 +1352,19 @@ SilcBool silc_packet_get_ids(SilcPacketStream stream, SilcBool *src_id_set, SilcID *src_id, SilcBool *dst_id_set, SilcID *dst_id) { - if (src_id && stream->src_id) { - (*src_id).type = stream->src_id_type; - switch (stream->src_id_type) { - case SILC_ID_CLIENT: - (*src_id).u.client_id = *(SilcClientID *)stream->src_id; - break; - case SILC_ID_SERVER: - (*src_id).u.server_id = *(SilcServerID *)stream->src_id; - break; - case SILC_ID_CHANNEL: - (*src_id).u.channel_id = *(SilcChannelID *)stream->src_id; - break; - } - } + if (src_id && stream->src_id) + if (!silc_id_str2id2(stream->src_id, stream->src_id_len, + stream->src_id_type, src_id)) + return FALSE; + if (stream->src_id && src_id_set) *src_id_set = TRUE; - if (dst_id && stream->dst_id) { - (*dst_id).type = stream->dst_id_type; - switch (stream->dst_id_type) { - case SILC_ID_CLIENT: - (*dst_id).u.client_id = *(SilcClientID *)stream->dst_id; - break; - case SILC_ID_SERVER: - (*dst_id).u.server_id = *(SilcServerID *)stream->dst_id; - break; - case SILC_ID_CHANNEL: - (*dst_id).u.channel_id = *(SilcChannelID *)stream->dst_id; - break; - } - } + if (dst_id && stream->dst_id) + if (!silc_id_str2id2(stream->dst_id, stream->dst_id_len, + stream->dst_id_type, dst_id)) + return FALSE; + if (stream->dst_id && dst_id_set) *dst_id_set = TRUE; -- 2.24.0