diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-06 12:49:02 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-06 12:49:02 +0000 |
commit | 46bab5b9f9afefaac097767ea356defea5efbbaa (patch) | |
tree | 04c8c00d8b5f2f91efe6ea3b9a6303dea28b4cbd /src/namestore/gnunet-service-namestore.c | |
parent | 10b2ef580e79924e9117e1654dd9d58b23d618e2 (diff) | |
download | gnunet-46bab5b9f9afefaac097767ea356defea5efbbaa.tar.gz gnunet-46bab5b9f9afefaac097767ea356defea5efbbaa.zip |
- fixes for put and lookup
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 7408f7ad7..8153cf20b 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -231,8 +231,6 @@ handle_lookup_name_it (void *cls, | |||
231 | /* send response */ | 231 | /* send response */ |
232 | struct LookupNameContext *lnc = cls; | 232 | struct LookupNameContext *lnc = cls; |
233 | struct LookupNameResponseMessage *lnr_msg; | 233 | struct LookupNameResponseMessage *lnr_msg; |
234 | |||
235 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key_tmp; | ||
236 | struct GNUNET_NAMESTORE_RecordData *rd_selected = NULL; | 234 | struct GNUNET_NAMESTORE_RecordData *rd_selected = NULL; |
237 | char *rd_tmp; | 235 | char *rd_tmp; |
238 | char *name_tmp; | 236 | char *name_tmp; |
@@ -313,17 +311,16 @@ handle_lookup_name_it (void *cls, | |||
313 | lnr_msg->rd_len = htons (rd_ser_len); | 311 | lnr_msg->rd_len = htons (rd_ser_len); |
314 | lnr_msg->name_len = htons (name_len); | 312 | lnr_msg->name_len = htons (name_len); |
315 | lnr_msg->expire = GNUNET_TIME_absolute_hton(expire); | 313 | lnr_msg->expire = GNUNET_TIME_absolute_hton(expire); |
314 | lnr_msg->public_key = (*zone_key); | ||
316 | lnr_msg->contains_sig = htons (contains_signature); | 315 | lnr_msg->contains_sig = htons (contains_signature); |
317 | if (GNUNET_YES == contains_signature) | 316 | if (GNUNET_YES == contains_signature) |
318 | lnr_msg->signature = *signature; | 317 | lnr_msg->signature = *signature; |
319 | else | 318 | else |
320 | memset (&lnr_msg->signature, '\0', sizeof (lnr_msg->signature)); | 319 | memset (&lnr_msg->signature, '\0', sizeof (lnr_msg->signature)); |
321 | 320 | ||
322 | zone_key_tmp = (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) &lnr_msg[1]; | 321 | name_tmp = (char *) &lnr_msg[1]; |
323 | name_tmp = (char *) &zone_key_tmp[1]; | ||
324 | rd_tmp = &name_tmp[name_len]; | 322 | rd_tmp = &name_tmp[name_len]; |
325 | 323 | ||
326 | memcpy (zone_key_tmp, zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | ||
327 | memcpy (name_tmp, name, name_len); | 324 | memcpy (name_tmp, name, name_len); |
328 | memcpy (rd_tmp, rd_ser, rd_ser_len); | 325 | memcpy (rd_tmp, rd_ser, rd_ser_len); |
329 | 326 | ||
@@ -488,7 +485,6 @@ static void handle_record_put (void *cls, | |||
488 | goto send; | 485 | goto send; |
489 | } | 486 | } |
490 | 487 | ||
491 | |||
492 | GNUNET_HashCode zone_hash; | 488 | GNUNET_HashCode zone_hash; |
493 | GNUNET_CRYPTO_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash); | 489 | GNUNET_CRYPTO_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash); |
494 | 490 | ||
@@ -511,11 +507,7 @@ send: | |||
511 | rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE); | 507 | rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE); |
512 | rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage)); | 508 | rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage)); |
513 | rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; | 509 | rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; |
514 | 510 | rpr_msg.op_result = htons (res); | |
515 | if (GNUNET_OK == res) | ||
516 | rpr_msg.op_result = htons (GNUNET_OK); | ||
517 | else | ||
518 | rpr_msg.op_result = htons (GNUNET_NO); | ||
519 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rpr_msg, GNUNET_NO); | 511 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rpr_msg, GNUNET_NO); |
520 | 512 | ||
521 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 513 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |