[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -fix namestore logic
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -fix namestore logic |
Date: |
Tue, 08 Feb 2022 00:29:53 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new fab89196f -fix namestore logic
fab89196f is described below
commit fab89196f0a3a14b8d1e3de593958b78f6d58775
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Feb 8 00:29:47 2022 +0100
-fix namestore logic
---
src/gnsrecord/gnsrecord_misc.c | 12 +++---
src/namestore/gnunet-namestore.c | 71 +-------------------------------
src/namestore/gnunet-service-namestore.c | 22 ++++++----
3 files changed, 21 insertions(+), 84 deletions(-)
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index c4a39a33d..9b5e47c4c 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -156,8 +156,8 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int
rd_count,
struct GNUNET_TIME_Absolute at_shadow;
struct GNUNET_TIME_Relative rt_shadow;
- if (NULL == rd)
- return GNUNET_TIME_UNIT_ZERO_ABS;
+ if (0 == rd_count)
+ return GNUNET_TIME_absolute_max (GNUNET_TIME_UNIT_ZERO_ABS, min);
expire = GNUNET_TIME_UNIT_FOREVER_ABS;
for (unsigned int c = 0; c < rd_count; c++)
{
@@ -194,7 +194,7 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int
rd_count,
expire = GNUNET_TIME_absolute_min (at,
expire);
}
- expire = GNUNET_TIME_absolute_min (expire, min);
+ expire = GNUNET_TIME_absolute_max (expire, min);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Determined expiration time for block with %u records to be %s\n",
rd_count,
@@ -422,7 +422,7 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
int have_empty_label = (0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, label));
unsigned int rd_count_tmp;
- minimum_expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ minimum_expiration = GNUNET_TIME_UNIT_ZERO_ABS;
now = GNUNET_TIME_absolute_get ();
rd_count_tmp = 0;
for (unsigned int i = 0; i < rd_count; i++)
@@ -498,7 +498,7 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
if (have_empty_label)
{
*emsg = GNUNET_strdup (_ (
- "Redirection records not allowed in
apex..\n"));
+ "Redirection records not allowed in apex.."));
return GNUNET_SYSERR;
}
if ((GNUNET_YES == have_other) ||
@@ -520,7 +520,7 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
(GNUNET_YES == have_gns2dns))
{
*emsg = GNUNET_strdup (_ (
- "Mutually exclusive records.\n"));
+ "Mutually exclusive records."));
return GNUNET_SYSERR;
}
have_other = GNUNET_YES;
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 71f23e315..ba8f633cc 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -447,8 +447,8 @@ display_record (const char *rname,
if ((GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
(0 != strcmp (rname, GNUNET_GNS_EMPTY_LABEL_AT)))
continue;
- if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
- continue;
+ /*if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
+ continue;*/
if ((type != rd[i].record_type) && (GNUNET_GNSRECORD_TYPE_ANY != type))
continue;
typestr = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
@@ -651,28 +651,6 @@ get_existing_record (void *cls,
{
switch (rd[i].record_type)
{
- case GNUNET_DNSPARSER_TYPE_CNAME:
- fprintf (
- stderr,
- _ (
- "A %s record exists already under `%s', no other records can be
added.\n"),
- "CNAME",
- rec_name);
- ret = 1;
- test_finished ();
- return;
-
- case GNUNET_GNSRECORD_TYPE_PKEY:
- case GNUNET_GNSRECORD_TYPE_EDKEY:
- fprintf (
- stderr,
- _ (
- "A zone key record exists already under `%s', no other records can
be added.\n"),
- rec_name);
- ret = 1;
- test_finished ();
- return;
-
case GNUNET_DNSPARSER_TYPE_SOA:
if (GNUNET_DNSPARSER_TYPE_SOA == type)
{
@@ -688,51 +666,6 @@ get_existing_record (void *cls,
break;
}
}
- switch (type)
- {
- case GNUNET_DNSPARSER_TYPE_CNAME:
- if (0 != rd_count)
- {
- fprintf (stderr,
- _ (
- "Records already exist under `%s', cannot add `%s'
record.\n"),
- rec_name,
- "CNAME");
- ret = 1;
- test_finished ();
- return;
- }
- break;
-
- case GNUNET_GNSRECORD_TYPE_PKEY:
- case GNUNET_GNSRECORD_TYPE_EDKEY:
- if (0 != rd_count)
- {
- fprintf (stderr,
- _ (
- "Records already exist under `%s', cannot add record.\n"),
- rec_name);
- ret = 1;
- test_finished ();
- return;
- }
- break;
-
- case GNUNET_GNSRECORD_TYPE_GNS2DNS:
- for (unsigned int i = 0; i < rd_count; i++)
- if (GNUNET_GNSRECORD_TYPE_GNS2DNS != rd[i].record_type)
- {
- fprintf (
- stderr,
- _ (
- "Non-GNS2DNS records already exist under `%s', cannot add GNS2DNS
record.\n"),
- rec_name);
- ret = 1;
- test_finished ();
- return;
- }
- break;
- }
memset (rdn, 0, sizeof(struct GNUNET_GNSRECORD_Data));
GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof(struct GNUNET_GNSRECORD_Data));
rde = &rdn[0];
diff --git a/src/namestore/gnunet-service-namestore.c
b/src/namestore/gnunet-service-namestore.c
index 51f9b9168..8c93b9a0d 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1484,12 +1484,12 @@ get_block_exp_existing (void *cls,
char *emsg;
if (GNUNET_OK != GNUNET_GNSRECORD_convert_records_for_export (label,
- rd,
- rd_count,
- rd_pub,
- &rd_pub_count,
- exp,
- &emsg))
+ rd,
+ rd_count,
+ rd_pub,
+ &rd_pub_count,
+ exp,
+ &emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s\n", emsg);
@@ -1522,7 +1522,8 @@ handle_record_store (void *cls, const struct
RecordStoreMessage *rp_msg)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received NAMESTORE_RECORD_STORE message\n");
- existing_block_exp.abs_value_us = 0;
+ existing_block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
+ new_block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
rid = ntohl (rp_msg->gns_header.r_id);
name_len = ntohs (rp_msg->name_len);
rd_count = ntohs (rp_msg->rd_count);
@@ -1634,7 +1635,7 @@ handle_record_store (void *cls, const struct
RecordStoreMessage *rp_msg)
existing_block_exp.abs_value_us;
rd_nf[rd_nf_count].data = NULL;
rd_nf[rd_nf_count].data_size = 0;
- rd_nf[rd_nf_count].flags |= GNUNET_GNSRECORD_RF_PRIVATE;
+ rd_nf[rd_nf_count].flags = GNUNET_GNSRECORD_RF_PRIVATE;
rd_nf_count++;
}
if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) &&
@@ -1652,7 +1653,10 @@ handle_record_store (void *cls, const struct
RecordStoreMessage *rp_msg)
if (GNUNET_OK != res)
{
- /* store not successful or zonemaster, not need to tell monitors */
+ /* store not successful, no need to tell monitors */
+ send_store_response (nc, res, _("Store failed"), rid);
+ GNUNET_SERVICE_client_continue (nc->client);
+ GNUNET_free (conv_name);
}
sa = GNUNET_malloc (sizeof(struct StoreActivity)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -fix namestore logic,
gnunet <=