From 8a2654dc49fa54ab447313935a7af72f0be367e7 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 6 Mar 2012 13:01:31 +0000 Subject: [PATCH] - fixes --- src/namestore/gnunet-service-namestore.c | 6 +++++- src/namestore/namestore_api.c | 14 ++++++++------ src/namestore/test_namestore_api.conf | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 8153cf20b..b72dcd073 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -311,7 +311,11 @@ handle_lookup_name_it (void *cls, lnr_msg->rd_len = htons (rd_ser_len); lnr_msg->name_len = htons (name_len); lnr_msg->expire = GNUNET_TIME_absolute_hton(expire); - lnr_msg->public_key = (*zone_key); + if (zone_key != NULL) + lnr_msg->public_key = (*zone_key); + else + memset(&lnr_msg->public_key, '\0', sizeof (lnr_msg->public_key)); + lnr_msg->contains_sig = htons (contains_signature); if (GNUNET_YES == contains_signature) lnr_msg->signature = *signature; diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 195c8a9bd..49ab4b442 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -259,6 +259,7 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, struct GNUNET_CRYPTO_RsaSignature *signature = NULL; struct GNUNET_TIME_Absolute expire; + struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key_tmp; size_t exp_msg_len; size_t msg_len = 0; size_t name_len = 0; @@ -284,11 +285,6 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, GNUNET_break_op (0); return; } - if (name_len == 0) - { - GNUNET_break_op (0); - return; - } name = (char *) &msg[1]; rd_tmp = &name[name_len]; @@ -302,10 +298,16 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, signature = NULL; else signature = &msg->signature; + if (name_len == 0) + name = NULL; + if ((name != NULL) && (signature != NULL) && (rd_count > 0)) + public_key_tmp = &msg->public_key; + else + public_key_tmp = NULL; if (qe->proc != NULL) { - qe->proc (qe->proc_cls, &msg->public_key, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature); + qe->proc (qe->proc_cls, public_key_tmp, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature); } /* Operation done, remove */ diff --git a/src/namestore/test_namestore_api.conf b/src/namestore/test_namestore_api.conf index f4cd32dbd..c437b414a 100644 --- a/src/namestore/test_namestore_api.conf +++ b/src/namestore/test_namestore_api.conf @@ -4,7 +4,7 @@ DEFAULTSERVICES = namestore UNIXPATH = /tmp/gnunet-p1-service-arm.sock [namestore] -#PREFIX = valgrind --leak-check=full +PREFIX = valgrind --leak-check=full AUTOSTART = YES UNIXPATH = /tmp/gnunet-service-namestore.sock UNIX_MATCH_UID = YES -- 2.25.1