From 301693904d07a063711bfc1ff4c5505c61eaf821 Mon Sep 17 00:00:00 2001 From: lurchi Date: Mon, 16 Jan 2017 07:50:00 +0100 Subject: [PATCH] bugfixes in the multicast service It's now possible to use the social service to enter a place on another peer as guest. --- src/multicast/gnunet-service-multicast.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index e84fdb20f..afe30e5c2 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c @@ -1019,6 +1019,7 @@ handle_client_member_join (void *cls, if (NULL == mem) { mem = GNUNET_new (struct Member); + mem->origin = msg->origin; mem->priv_key = msg->member_key; mem->pub_key = mem_pub_key; mem->pub_key_hash = mem_pub_key_hash; @@ -1083,9 +1084,10 @@ handle_client_member_join (void *cls, join_msg_size = ntohs (join_msg->size); } + uint16_t req_msg_size = sizeof (struct MulticastJoinRequestMessage) + join_msg_size; struct MulticastJoinRequestMessage * - req = GNUNET_malloc (sizeof (*req) + join_msg_size); - req->header.size = htons (sizeof (*req) + join_msg_size); + req = GNUNET_malloc (req_msg_size); + req->header.size = htons (req_msg_size); req->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST); req->group_pub_key = grp->pub_key; req->peer = this_peer; @@ -1094,7 +1096,7 @@ handle_client_member_join (void *cls, GNUNET_memcpy (&req[1], join_msg, join_msg_size); req->member_pub_key = mem->pub_key; - req->purpose.size = htonl (msg_size + req->purpose.size = htonl (req_msg_size - sizeof (req->header) - sizeof (req->reserved) - sizeof (req->signature)); @@ -1624,9 +1626,9 @@ cadet_recv_join_decision (void *cls, } struct MulticastJoinDecisionMessageHeader * - hdcsn = GNUNET_malloc (sizeof (*hdcsn) + size); + hdcsn = GNUNET_malloc (size); + GNUNET_memcpy (hdcsn, dcsn, size); hdcsn->peer = chn->peer; - GNUNET_memcpy (&hdcsn[1], dcsn, sizeof (*hdcsn) + size); struct Member *mem = (struct Member *) chn->group; client_send_join_decision (mem, hdcsn); @@ -1882,6 +1884,9 @@ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = { { cadet_recv_join_request, GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST, 0 }, + { cadet_recv_join_decision, + GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION, 0 }, + { cadet_recv_message, GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE, 0 }, -- 2.25.1