From 03e45f67ce326c004008516e35fd5b9e8c17cd08 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Fri, 25 Feb 2022 09:22:17 +0100 Subject: -fix namestore tests --- src/namestore/gnunet-service-namestore.c | 1 + src/namestore/plugin_namestore_sqlite.c | 10 ++++++++++ src/namestore/test_namestore_api_lookup_nick.c | 4 ++-- src/namestore/test_namestore_api_zone_to_name.c | 4 ++-- src/namestore/test_plugin_rest_namestore.sh | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 57147879f..ab8771e3f 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -1668,6 +1668,7 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) send_store_response (nc, res, _("Store failed"), rid); GNUNET_SERVICE_client_continue (nc->client); GNUNET_free (conv_name); + return; } sa = GNUNET_malloc (sizeof(struct StoreActivity) diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 7cb9b7ed0..0b3aac84f 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c @@ -329,6 +329,11 @@ namestore_sqlite_store_records (void *cls, 0, sizeof(pkey)); for (unsigned int i = 0; i < rd_count; i++) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Checking if `%d' is zonekey type\n", + rd[i].record_type); + if (GNUNET_YES == GNUNET_GNSRECORD_is_zonekey_type (rd[i].record_type)) { GNUNET_break (GNUNET_YES == @@ -336,8 +341,13 @@ namestore_sqlite_store_records (void *cls, rd[i].data_size, rd[i].record_type, &pkey)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Storing delegation zone record value `%s'\n", + GNUNET_GNSRECORD_z2s (&pkey)); + break; } + } rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); data_size = GNUNET_GNSRECORD_records_get_size (rd_count, diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index 6ce969c9b..7decf39f8 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c @@ -262,12 +262,12 @@ nick_cont (void *cls, int32_t success, const char *emsg) "Nick added : %s\n", (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); - rd_orig.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; + rd_orig.expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; rd_orig.record_type = TEST_RECORD_TYPE; rd_orig.data_size = TEST_RECORD_DATALEN; record_data = GNUNET_malloc (TEST_RECORD_DATALEN); rd_orig.data = record_data; - rd_orig.flags = 0; + rd_orig.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; memset ((char *) rd_orig.data, 'a', TEST_RECORD_DATALEN); nsqe = GNUNET_NAMESTORE_records_store (nsh, &privkey, diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 8efdba453..1e2f8248b 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -216,11 +216,11 @@ run (void *cls, { struct GNUNET_GNSRECORD_Data rd; - rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; + rd.expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY; rd.data_size = sizeof (s_zone_value.ecdsa_key); rd.data = &s_zone_value.ecdsa_key; - rd.flags = 0; + rd.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; nsh = GNUNET_NAMESTORE_connect (cfg); GNUNET_break (NULL != nsh); diff --git a/src/namestore/test_plugin_rest_namestore.sh b/src/namestore/test_plugin_rest_namestore.sh index 8a45cebf5..3c559a0b3 100755 --- a/src/namestore/test_plugin_rest_namestore.sh +++ b/src/namestore/test_plugin_rest_namestore.sh @@ -85,7 +85,7 @@ test="$(gnunet-namestore -D -z $TEST_ID -c test_namestore_api.conf)" name=$TEST_ID public="$(gnunet-identity -d -c test_namestore_api.conf | grep $TEST_ID | awk 'NR==1{print $3}')" echo "$name $public" -valgrind gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY" -c test_namestore_api.conf +gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY" -c test_namestore_api.conf #curl_get "${namestore_link}" "HTTP/1.1 200 OK" curl_get "${namestore_link}/$name" "HTTP/1.1 200 OK" curl_get "${namestore_link}/$public" "error" -- cgit v1.2.3