aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-25 12:39:06 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-25 12:39:06 +0200
commit8a408cc2604b6706e7f55391e4006b2b6d070430 (patch)
treed55e4ef4cdf22723b65af551103987f7d72e5582
parentd964554dd20a3668e7fcca913aaa9aa71d2fed6e (diff)
downloadgnunet-8a408cc2604b6706e7f55391e4006b2b6d070430.tar.gz
gnunet-8a408cc2604b6706e7f55391e4006b2b6d070430.zip
ensure that gnunet-namestore at most adds one SOA per zone
-rw-r--r--src/include/gnunet_gns_service.h51
-rw-r--r--src/namestore/gnunet-namestore.c13
2 files changed, 38 insertions, 26 deletions
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 7b4230f6b..ca92e8221 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -39,9 +39,8 @@
39#include "gnunet_namestore_service.h" 39#include "gnunet_namestore_service.h"
40 40
41#ifdef __cplusplus 41#ifdef __cplusplus
42extern "C" 42extern "C" {
43{ 43#if 0 /* keep Emacsens' auto-indent happy */
44#if 0 /* keep Emacsens' auto-indent happy */
45} 44}
46#endif 45#endif
47#endif 46#endif
@@ -96,10 +95,10 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
96 * @param rd_count number of records in @a rd 95 * @param rd_count number of records in @a rd
97 * @param rd the records in reply 96 * @param rd the records in reply
98 */ 97 */
99typedef void 98typedef void (*GNUNET_GNS_LookupResultProcessor) (
100(*GNUNET_GNS_LookupResultProcessor) (void *cls, 99 void *cls,
101 uint32_t rd_count, 100 uint32_t rd_count,
102 const struct GNUNET_GNSRECORD_Data *rd); 101 const struct GNUNET_GNSRECORD_Data *rd);
103 102
104 103
105/** 104/**
@@ -140,12 +139,12 @@ enum GNUNET_GNS_LocalOptions
140 */ 139 */
141struct GNUNET_GNS_LookupRequest * 140struct GNUNET_GNS_LookupRequest *
142GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, 141GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
143 const char *name, 142 const char *name,
144 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 143 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
145 uint32_t type, 144 uint32_t type,
146 enum GNUNET_GNS_LocalOptions options, 145 enum GNUNET_GNS_LocalOptions options,
147 GNUNET_GNS_LookupResultProcessor proc, 146 GNUNET_GNS_LookupResultProcessor proc,
148 void *proc_cls); 147 void *proc_cls);
149 148
150 149
151/** 150/**
@@ -168,11 +167,11 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr);
168 * @param rd_count number of records in @a rd 167 * @param rd_count number of records in @a rd
169 * @param rd the records in the reply 168 * @param rd the records in the reply
170 */ 169 */
171typedef void 170typedef void (*GNUNET_GNS_LookupResultProcessor2) (
172(*GNUNET_GNS_LookupResultProcessor2) (void *cls, 171 void *cls,
173 int gns_tld, 172 int gns_tld,
174 uint32_t rd_count, 173 uint32_t rd_count,
175 const struct GNUNET_GNSRECORD_Data *rd); 174 const struct GNUNET_GNSRECORD_Data *rd);
176 175
177 176
178/** 177/**
@@ -188,13 +187,13 @@ typedef void
188 * @param proc_cls closure for @a proc 187 * @param proc_cls closure for @a proc
189 * @return handle to the get request 188 * @return handle to the get request
190 */ 189 */
191struct GNUNET_GNS_LookupWithTldRequest* 190struct GNUNET_GNS_LookupWithTldRequest *
192GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, 191GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
193 const char *name, 192 const char *name,
194 uint32_t type, 193 uint32_t type,
195 enum GNUNET_GNS_LocalOptions options, 194 enum GNUNET_GNS_LocalOptions options,
196 GNUNET_GNS_LookupResultProcessor2 proc, 195 GNUNET_GNS_LookupResultProcessor2 proc,
197 void *proc_cls); 196 void *proc_cls);
198 197
199 198
200/** 199/**
@@ -207,7 +206,7 @@ void *
207GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr); 206GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr);
208 207
209 208
210#if 0 /* keep Emacsens' auto-indent happy */ 209#if 0 /* keep Emacsens' auto-indent happy */
211{ 210{
212#endif 211#endif
213#ifdef __cplusplus 212#ifdef __cplusplus
@@ -216,4 +215,4 @@ GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr);
216 215
217#endif 216#endif
218 217
219/** @} */ /* end of group */ 218/** @} */ /* end of group */
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index cbaf9a5cb..5f4daa4a8 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -669,6 +669,19 @@ get_existing_record (void *cls,
669 ret = 1; 669 ret = 1;
670 test_finished (); 670 test_finished ();
671 return; 671 return;
672 case GNUNET_DNSPARSER_TYPE_SOA:
673 if (GNUNET_DNSPARSER_TYPE_SOA == type)
674 {
675 fprintf (
676 stderr,
677 _ (
678 "A SOA record exists already under `%s', cannot add a second SOA to the same zone.\n"),
679 rec_name);
680 ret = 1;
681 test_finished ();
682 return;
683 }
684 break;
672 } 685 }
673 } 686 }
674 switch (type) 687 switch (type)