aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-23 12:42:00 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-23 12:42:00 +0200
commite1f46c052dca3cd7a390f18f97b10162fe537a15 (patch)
treedaa43ca3b189b6f86425801dc94413a71a04a66c /src/namestore
parentff4d7b51f37f61633766664647e9b148af1e4f0a (diff)
downloadgnunet-e1f46c052dca3cd7a390f18f97b10162fe537a15.tar.gz
gnunet-e1f46c052dca3cd7a390f18f97b10162fe537a15.zip
move to @ for empty label, fix empty-label resolution bug in GNS API, install gnunet-zoneimport and add man page
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/Makefile.am4
-rw-r--r--src/namestore/gnunet-namestore.c2
-rw-r--r--src/namestore/gnunet-service-namestore.c16
-rw-r--r--src/namestore/gnunet-zoneimport.c25
-rw-r--r--src/namestore/namestore_api.c2
-rw-r--r--src/namestore/plugin_rest_namestore.c2
6 files changed, 21 insertions, 30 deletions
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index fd8f8054f..5f18506a7 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -124,9 +124,7 @@ libexec_PROGRAMS = \
124 gnunet-service-namestore 124 gnunet-service-namestore
125 125
126bin_PROGRAMS = \ 126bin_PROGRAMS = \
127 gnunet-namestore 127 gnunet-namestore \
128
129noinst_PROGRAMS = \
130 gnunet-zoneimport 128 gnunet-zoneimport
131 129
132if HAVE_MHD 130if HAVE_MHD
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 9a1805af4..660737595 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -408,7 +408,7 @@ display_record (void *cls,
408 { 408 {
409 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && 409 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
410 (0 != strcmp (rname, 410 (0 != strcmp (rname,
411 GNUNET_GNS_MASTERZONE_STR)) ) 411 GNUNET_GNS_EMPTY_LABEL_AT)) )
412 continue; 412 continue;
413 typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); 413 typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
414 s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, 414 s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 3a3291c07..3685c93af 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -362,13 +362,13 @@ client_connect_cb (void *cls,
362 362
363 363
364/** 364/**
365 * Function called with the records for the #GNUNET_GNS_MASTERZONE_STR 365 * Function called with the records for the #GNUNET_GNS_EMPTY_LABEL_AT
366 * label in the zone. Used to locate the #GNUNET_GNSRECORD_TYPE_NICK 366 * label in the zone. Used to locate the #GNUNET_GNSRECORD_TYPE_NICK
367 * record, which (if found) is then copied to @a cls for future use. 367 * record, which (if found) is then copied to @a cls for future use.
368 * 368 *
369 * @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found) 369 * @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found)
370 * @param private_key the private key of the zone (unused) 370 * @param private_key the private key of the zone (unused)
371 * @param label should be #GNUNET_GNS_MASTERZONE_STR 371 * @param label should be #GNUNET_GNS_EMPTY_LABEL_AT
372 * @param rd_count number of records in @a rd 372 * @param rd_count number of records in @a rd
373 * @param rd records stored under @a label in the zone 373 * @param rd records stored under @a label in the zone
374 */ 374 */
@@ -382,7 +382,7 @@ lookup_nick_it (void *cls,
382 struct GNUNET_GNSRECORD_Data **res = cls; 382 struct GNUNET_GNSRECORD_Data **res = cls;
383 383
384 (void) private_key; 384 (void) private_key;
385 if (0 != strcmp (label, GNUNET_GNS_MASTERZONE_STR)) 385 if (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT))
386 { 386 {
387 GNUNET_break (0); 387 GNUNET_break (0);
388 return; 388 return;
@@ -423,7 +423,7 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
423 nick = NULL; 423 nick = NULL;
424 res = GSN_database->lookup_records (GSN_database->cls, 424 res = GSN_database->lookup_records (GSN_database->cls,
425 zone, 425 zone,
426 GNUNET_GNS_MASTERZONE_STR, 426 GNUNET_GNS_EMPTY_LABEL_AT,
427 &lookup_nick_it, 427 &lookup_nick_it,
428 &nick); 428 &nick);
429 if ( (GNUNET_OK != res) || 429 if ( (GNUNET_OK != res) ||
@@ -531,7 +531,7 @@ send_lookup_response (struct NamestoreClient *nc,
531 char *rd_ser; 531 char *rd_ser;
532 532
533 nick = get_nick_record (zone_key); 533 nick = get_nick_record (zone_key);
534 if ((NULL != nick) && (0 != strcmp(name, GNUNET_GNS_MASTERZONE_STR))) 534 if ((NULL != nick) && (0 != strcmp(name, GNUNET_GNS_EMPTY_LABEL_AT)))
535 { 535 {
536 nick->flags = (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; 536 nick->flags = (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
537 merge_with_nick_records (nick, 537 merge_with_nick_records (nick,
@@ -766,7 +766,7 @@ lookup_it (void *cls,
766 { 766 {
767 if ( (NULL != rlc->nick) && 767 if ( (NULL != rlc->nick) &&
768 (0 != strcmp (label, 768 (0 != strcmp (label,
769 GNUNET_GNS_MASTERZONE_STR)) ) 769 GNUNET_GNS_EMPTY_LABEL_AT)) )
770 { 770 {
771 /* Merge */ 771 /* Merge */
772 rd_res = NULL; 772 rd_res = NULL;
@@ -1043,12 +1043,12 @@ handle_record_store (void *cls,
1043 unsigned int rd_clean_off; 1043 unsigned int rd_clean_off;
1044 1044
1045 /* remove "NICK" records, unless this is for the 1045 /* remove "NICK" records, unless this is for the
1046 #GNUNET_GNS_MASTERZONE_STR label */ 1046 #GNUNET_GNS_EMPTY_LABEL_AT label */
1047 rd_clean_off = 0; 1047 rd_clean_off = 0;
1048 for (unsigned int i=0;i<rd_count;i++) 1048 for (unsigned int i=0;i<rd_count;i++)
1049 { 1049 {
1050 rd_clean[rd_clean_off] = rd[i]; 1050 rd_clean[rd_clean_off] = rd[i];
1051 if ( (0 == strcmp (GNUNET_GNS_MASTERZONE_STR, 1051 if ( (0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT,
1052 conv_name)) || 1052 conv_name)) ||
1053 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type) ) 1053 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type) )
1054 rd_clean_off++; 1054 rd_clean_off++;
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 279bfddea..89afeeeb1 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -21,9 +21,6 @@
21 * @file src/namestore/gnunet-zoneimport.c 21 * @file src/namestore/gnunet-zoneimport.c
22 * @brief import a DNS zone for publication in GNS, incremental 22 * @brief import a DNS zone for publication in GNS, incremental
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 *
25 * TODO:
26 * - set NICKname for zone's records
27 */ 24 */
28#include "platform.h" 25#include "platform.h"
29#include <gnunet_util_lib.h> 26#include <gnunet_util_lib.h>
@@ -50,11 +47,6 @@
50 */ 47 */
51#define MAX_RETRIES 5 48#define MAX_RETRIES 5
52 49
53/**
54 * After how many lookups should we always sync to disk?
55 */
56#define TRANSACTION_SYNC_FREQ 100
57
58 50
59/** 51/**
60 * Some zones may include authoritative records for other 52 * Some zones may include authoritative records for other
@@ -795,6 +787,7 @@ store_completed_cb (void *cls,
795 const char *emsg) 787 const char *emsg)
796{ 788{
797 struct Request *req = cls; 789 struct Request *req = cls;
790 struct Record *rec;
798 791
799 req->qe = NULL; 792 req->qe = NULL;
800 pending--; 793 pending--;
@@ -811,6 +804,14 @@ store_completed_cb (void *cls,
811 "Stored records under `%s'\n", 804 "Stored records under `%s'\n",
812 req->label); 805 req->label);
813 } 806 }
807 /* Free records */
808 while (NULL != (rec = req->rec_head))
809 {
810 GNUNET_CONTAINER_DLL_remove (req->rec_head,
811 req->rec_tail,
812 rec);
813 GNUNET_free (rec);
814 }
814} 815}
815 816
816 817
@@ -877,14 +878,6 @@ process_result (void *cls,
877 pending--; 878 pending--;
878 return; 879 return;
879 } 880 }
880 /* Free old/legacy records */
881 while (NULL != (rec = req->rec_head))
882 {
883 GNUNET_CONTAINER_DLL_remove (req->rec_head,
884 req->rec_tail,
885 rec);
886 GNUNET_free (rec);
887 }
888 /* import new records */ 881 /* import new records */
889 req->issue_num = 0; /* success, reset counter! */ 882 req->issue_num = 0; /* success, reset counter! */
890 req->p = p; 883 req->p = p;
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index a187bd250..05bdf17da 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1087,7 +1087,7 @@ GNUNET_NAMESTORE_set_nick (struct GNUNET_NAMESTORE_Handle *h,
1087 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE; 1087 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
1088 return GNUNET_NAMESTORE_records_store (h, 1088 return GNUNET_NAMESTORE_records_store (h,
1089 pkey, 1089 pkey,
1090 GNUNET_GNS_MASTERZONE_STR, 1090 GNUNET_GNS_EMPTY_LABEL_AT,
1091 1, 1091 1,
1092 &rd, 1092 &rd,
1093 cont, 1093 cont,
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 4602106da..aedb39159 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -460,7 +460,7 @@ namestore_list_response (void *cls,
460 for (unsigned int i=0; i<rd_len; i++) 460 for (unsigned int i=0; i<rd_len; i++)
461 { 461 {
462 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && 462 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
463 (0 != strcmp (rname, GNUNET_GNS_MASTERZONE_STR)) ) 463 (0 != strcmp (rname, GNUNET_GNS_EMPTY_LABEL_AT)) )
464 continue; 464 continue;
465 465
466 if ( (rd[i].record_type != handle->type) && 466 if ( (rd[i].record_type != handle->type) &&