[PATCH] Re: Question about GNS record representation in json
fence <[email protected]> Wed, 14 Aug 2024 21:16:33 +0200
| Newsgroups | gmane.network.gnunet.devel |
|---|---|
| Message-ID | <[email protected]> |
So I've looked into the issue and fixed it. The shadow flag wasn't parsed properly from JSON and it overwrote the "is_supplemental" flag when converting a record to JSON. As for the rewrite, I don't have that much time on my hand right now. kind regards, fence On 13.08.2024 13:24, Schanzenbach, Martin wrote: > This may be a bug/oversight. > The reason may be that shadow records must be ignored by the resolver > and are never returned as part of a resolution process. > > If you have any use or require a symmetric API, then this can be changed. > Feel free to modify the code accordingly. > > Note that the REST service is in dire need of a rewrite (see https:// > www.gnunet.org/en/gsoc.html "Pluggable REST service components"). > So, if you have some spare time you can check that out as well :) > > BR > Martin > > On 12.08.24 17:10, fence wrote: >> Hewo, >> >> Is there a reason why GNUNET_JSON_GNSRECORD_FLAG_SHADOW is only >> deserialised but never serialised? >> >> Is that a bug or was the functionality removed and still being parsed >> in case an old client still sending the flag? >> >> kind regards, >> fence >> >
0001-lib-fix-gnsrecord-json-serialization.patch
(text/plain, 2.4 KB)
From 70f7a4f76907b1fe463a33e6d005fb6c80df7ad7 Mon Sep 17 00:00:00 2001 From: fence <[email protected]> Date: Wed, 14 Aug 2024 20:20:40 +0200 Subject: [PATCH] lib: fix gnsrecord json serialization --- src/lib/gnsrecord/json_gnsrecord.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/gnsrecord/json_gnsrecord.c b/src/lib/gnsrecord/json_gnsrecord.c index 9a08e0157..f83c6e17b 100644 --- a/src/lib/gnsrecord/json_gnsrecord.c +++ b/src/lib/gnsrecord/json_gnsrecord.c @@ -99,7 +99,7 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd) unpack_state = json_unpack_ex (data, &err, 0, - "{s:s, s:s, s:I, s:b, s:b, s:b, s:b}", + "{s:s, s:s, s:I, s:b, s:b, s:b, s:b, s:b}", GNUNET_JSON_GNSRECORD_VALUE, &value, GNUNET_JSON_GNSRECORD_TYPE, @@ -124,7 +124,7 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd) unpack_state = json_unpack_ex (data, &err, 0, - "{s:s, s:s, s:I, s:b, s:b, s:b, s:b}", + "{s:s, s:s, s:I, s:b, s:b, s:b, s:b, s:b}", GNUNET_JSON_GNSRECORD_VALUE, &value, GNUNET_JSON_GNSRECORD_TYPE, @@ -349,7 +349,7 @@ GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname, "Packing %s %s %" PRIu64 " %d\n", value_str, record_type_str, rd[i].expiration_time, rd[i].flags); record = json_pack ( - "{s:s,s:s,s:I,s:b,s:b,s:b,s:b, s:b}", + "{s:s, s:s, s:I, s:b, s:b, s:b, s:b, s:b}", GNUNET_JSON_GNSRECORD_VALUE, value_str, GNUNET_JSON_GNSRECORD_TYPE, record_type_str, (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) @@ -364,7 +364,7 @@ GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname, rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL, - GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, + GNUNET_JSON_GNSRECORD_FLAG_SHADOW, rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW); GNUNET_free (value_str); if (NULL == record) -- 2.39.3 (Apple Git-145)