aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-02-14 16:00:15 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-02-14 16:00:15 +0100
commit336acc33010eb725c873791ed6eb9039cb1aedd2 (patch)
treee6f8bbbcc9cf6c3f7e133ba83f772e6cb7e518b1 /src/namestore
parent6866469e6dd066cecef416afda3f119a958db1a8 (diff)
downloadgnunet-336acc33010eb725c873791ed6eb9039cb1aedd2.tar.gz
gnunet-336acc33010eb725c873791ed6eb9039cb1aedd2.zip
GNS/NAMESTORE: Fix GNS2DNS delegations
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-service-namestore.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 8c93b9a0d..c3482cd6a 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -918,21 +918,32 @@ refresh_block (struct NamestoreClient *nc,
918 const struct GNUNET_GNSRECORD_Data *rd) 918 const struct GNUNET_GNSRECORD_Data *rd)
919{ 919{
920 struct GNUNET_GNSRECORD_Block *block; 920 struct GNUNET_GNSRECORD_Block *block;
921 struct GNUNET_GNSRECORD_Data rd_clean[rd_count];
921 struct CacheOperation *cop; 922 struct CacheOperation *cop;
922 struct GNUNET_IDENTITY_PublicKey pkey; 923 struct GNUNET_IDENTITY_PublicKey pkey;
923 struct GNUNET_GNSRECORD_Data *nick; 924 struct GNUNET_GNSRECORD_Data *nick;
924 struct GNUNET_GNSRECORD_Data *res; 925 struct GNUNET_GNSRECORD_Data *res;
925 unsigned int res_count; 926 unsigned int res_count;
927 unsigned int rd_count_clean;
926 struct GNUNET_TIME_Absolute exp_time; 928 struct GNUNET_TIME_Absolute exp_time;
927 929
930 /** Do not block-cache tombstones */
931 rd_count_clean = 0;
932 for (int i = 0; i < rd_count; i++)
933 {
934 if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
935 continue;
936 rd_clean[rd_count_clean++] = rd[i];
937 }
938
928 nick = get_nick_record (zone_key); 939 nick = get_nick_record (zone_key);
929 res_count = rd_count; 940 res_count = rd_count_clean;
930 res = (struct GNUNET_GNSRECORD_Data *) rd; /* fixme: a bit unclean... */ 941 res = (struct GNUNET_GNSRECORD_Data *) rd_clean; /* fixme: a bit unclean... */
931 if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT))) 942 if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)))
932 { 943 {
933 nick->flags = 944 nick->flags =
934 (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; 945 (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
935 merge_with_nick_records (nick, rd_count, rd, &res_count, &res); 946 merge_with_nick_records (nick, rd_count_clean, rd_clean, &res_count, &res);
936 } 947 }
937 if (NULL != nick) 948 if (NULL != nick)
938 GNUNET_free (nick); 949 GNUNET_free (nick);
@@ -940,7 +951,7 @@ refresh_block (struct NamestoreClient *nc,
940 { 951 {
941 if (NULL != nc) 952 if (NULL != nc)
942 send_store_response (nc, GNUNET_OK, NULL, rid); 953 send_store_response (nc, GNUNET_OK, NULL, rid);
943 if (rd != res) 954 if (rd_clean != res)
944 GNUNET_free (res); 955 GNUNET_free (res);
945 return; /* no data, no need to update cache */ 956 return; /* no data, no need to update cache */
946 } 957 }
@@ -952,7 +963,7 @@ refresh_block (struct NamestoreClient *nc,
952 GNUNET_NO); 963 GNUNET_NO);
953 if (NULL != nc) 964 if (NULL != nc)
954 send_store_response (nc, GNUNET_OK, NULL, rid); 965 send_store_response (nc, GNUNET_OK, NULL, rid);
955 if (rd != res) 966 if (rd_clean != res)
956 GNUNET_free (res); 967 GNUNET_free (res);
957 return; 968 return;
958 } 969 }
@@ -991,7 +1002,7 @@ refresh_block (struct NamestoreClient *nc,
991 &finish_cache_operation, 1002 &finish_cache_operation,
992 cop); 1003 cop);
993 GNUNET_free (block); 1004 GNUNET_free (block);
994 if (rd != res) 1005 if (rd_clean != res)
995 GNUNET_free (res); 1006 GNUNET_free (res);
996} 1007}
997 1008