From: Matthias Wachs Date: Wed, 7 Mar 2012 08:55:06 +0000 (+0000) Subject: - fix in api X-Git-Tag: initial-import-from-subversion-38251~14390 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=19d6b482f8586fa1010f50791b5fcc4d77c3a6bc;p=oweals%2Fgnunet.git - fix in api - added second zone to test --- diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index da772cf82..fbf4711ae 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -93,6 +93,7 @@ struct GNUNET_NAMESTORE_ZoneIterator GNUNET_HashCode zone; uint32_t no_flags; uint32_t flags; + int has_zone; }; @@ -1485,7 +1486,17 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, it->proc = proc; it->proc_cls = proc; it->op_id = rid; - it->zone = *zone; + + if (NULL != zone) + { + it->zone = *zone; + it->has_zone = GNUNET_YES; + } + else + { + memset (&it->zone, '\0', sizeof (it->zone)); + it->has_zone = GNUNET_NO; + } GNUNET_CONTAINER_DLL_insert_tail(h->z_head, h->z_tail, it); /* set msg_size*/ @@ -1500,7 +1511,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START); msg->gns_header.header.size = htons (msg_size); msg->gns_header.r_id = htonl (rid); - if (NULL == zone) + if (NULL != zone) msg->zone = *zone; else memset (&msg->zone, '\0', sizeof (msg->zone)); diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 019036991..7d98eefb0 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -40,6 +40,10 @@ static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; static GNUNET_HashCode zone; +static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2; +static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2; +static GNUNET_HashCode zone2; + static struct GNUNET_NAMESTORE_ZoneIterator *zi; static int res; @@ -51,6 +55,10 @@ struct GNUNET_CRYPTO_RsaSignature *sig_2; char * s_name_2; struct GNUNET_NAMESTORE_RecordData *s_rd_2; +struct GNUNET_CRYPTO_RsaSignature *sig_3; +char * s_name_3; +struct GNUNET_NAMESTORE_RecordData *s_rd_3; + static void start_arm (const char *cfgname) { @@ -334,6 +342,12 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone); + privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2"); + GNUNET_assert (privkey2 != NULL); + GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); + GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2); + + start_arm (cfgfile); GNUNET_assert (arm != NULL); @@ -354,6 +368,13 @@ run (void *cls, char *const *args, const char *cfgfile, sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1); GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont, NULL); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n"); + /* name in different zone */ + GNUNET_asprintf(&s_name_3, "dummy3"); + s_rd_3 = create_record(1); + sig_3 = GNUNET_NAMESTORE_create_signature(privkey, s_name_3, s_rd_3, 1); + GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL); } static int