diff options
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/Makefile.am | 5 | ||||
-rw-r--r-- | src/gns/gns.h | 2 | ||||
-rw-r--r-- | src/gns/gns_api.c | 4 | ||||
-rw-r--r-- | src/gns/gns_tld_api.c | 21 | ||||
-rw-r--r-- | src/gns/gnunet-gns-import.c | 9 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns.c | 6 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns.h | 3 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_interceptor.c | 2 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 71 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.h | 2 | ||||
-rw-r--r-- | src/gns/plugin_block_gns.c | 15 | ||||
-rw-r--r-- | src/gns/plugin_gnsrecord_gns.c | 33 | ||||
-rw-r--r-- | src/gns/plugin_rest_gns.c | 3 | ||||
-rwxr-xr-x | src/gns/test_gns_dht_lookup.sh | 1 |
14 files changed, 105 insertions, 72 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 5a9c70997..744ba66ec 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am | |||
@@ -109,6 +109,7 @@ libgnunet_plugin_rest_gns_la_SOURCES = \ | |||
109 | plugin_rest_gns.c | 109 | plugin_rest_gns.c |
110 | libgnunet_plugin_rest_gns_la_LIBADD = \ | 110 | libgnunet_plugin_rest_gns_la_LIBADD = \ |
111 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 111 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
112 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \ | ||
112 | libgnunetgns.la \ | 113 | libgnunetgns.la \ |
113 | $(top_builddir)/src/rest/libgnunetrest.la \ | 114 | $(top_builddir)/src/rest/libgnunetrest.la \ |
114 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 115 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
@@ -124,6 +125,7 @@ libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ | |||
124 | plugin_gnsrecord_gns.c | 125 | plugin_gnsrecord_gns.c |
125 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ | 126 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ |
126 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 127 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
128 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
127 | $(top_builddir)/src/util/libgnunetutil.la \ | 129 | $(top_builddir)/src/util/libgnunetutil.la \ |
128 | $(LTLIBINTL) | 130 | $(LTLIBINTL) |
129 | libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ | 131 | libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ |
@@ -135,6 +137,7 @@ gnunet_gns_SOURCES = \ | |||
135 | gnunet_gns_LDADD = \ | 137 | gnunet_gns_LDADD = \ |
136 | libgnunetgns.la \ | 138 | libgnunetgns.la \ |
137 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 139 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
140 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
138 | $(top_builddir)/src/util/libgnunetutil.la \ | 141 | $(top_builddir)/src/util/libgnunetutil.la \ |
139 | $(LIBIDN) $(LIBIDN2) \ | 142 | $(LIBIDN) $(LIBIDN2) \ |
140 | $(GN_LIBINTL) | 143 | $(GN_LIBINTL) |
@@ -144,6 +147,7 @@ gnunet_gns_benchmark_SOURCES = \ | |||
144 | gnunet_gns_benchmark_LDADD = \ | 147 | gnunet_gns_benchmark_LDADD = \ |
145 | libgnunetgns.la \ | 148 | libgnunetgns.la \ |
146 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 149 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
150 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
147 | $(top_builddir)/src/util/libgnunetutil.la \ | 151 | $(top_builddir)/src/util/libgnunetutil.la \ |
148 | $(GN_LIBINTL) | 152 | $(GN_LIBINTL) |
149 | 153 | ||
@@ -247,6 +251,7 @@ libgnunet_plugin_block_gns_la_LIBADD = \ | |||
247 | $(top_builddir)/src/util/libgnunetutil.la \ | 251 | $(top_builddir)/src/util/libgnunetutil.la \ |
248 | $(top_builddir)/src/block/libgnunetblock.la \ | 252 | $(top_builddir)/src/block/libgnunetblock.la \ |
249 | $(top_builddir)/src/block/libgnunetblockgroup.la \ | 253 | $(top_builddir)/src/block/libgnunetblockgroup.la \ |
254 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
250 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la | 255 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la |
251 | libgnunet_plugin_block_gns_la_LDFLAGS = \ | 256 | libgnunet_plugin_block_gns_la_LDFLAGS = \ |
252 | $(GN_LIBINTL) \ | 257 | $(GN_LIBINTL) \ |
diff --git a/src/gns/gns.h b/src/gns/gns.h index a193632b7..d824742ad 100644 --- a/src/gns/gns.h +++ b/src/gns/gns.h | |||
@@ -48,7 +48,7 @@ struct LookupMessage | |||
48 | /** | 48 | /** |
49 | * Zone that is to be used for lookup | 49 | * Zone that is to be used for lookup |
50 | */ | 50 | */ |
51 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 51 | struct GNUNET_IDENTITY_PublicKey zone; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Local options for where to look for results | 54 | * Local options for where to look for results |
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index bf95bf340..841a0d240 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -343,7 +343,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) | |||
343 | struct GNUNET_GNS_LookupRequest * | 343 | struct GNUNET_GNS_LookupRequest * |
344 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | 344 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, |
345 | const char *name, | 345 | const char *name, |
346 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 346 | const struct GNUNET_IDENTITY_PublicKey *zone, |
347 | uint32_t type, | 347 | uint32_t type, |
348 | enum GNUNET_GNS_LocalOptions options, | 348 | enum GNUNET_GNS_LocalOptions options, |
349 | uint16_t recursion_depth_limit, | 349 | uint16_t recursion_depth_limit, |
@@ -411,7 +411,7 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | |||
411 | struct GNUNET_GNS_LookupRequest* | 411 | struct GNUNET_GNS_LookupRequest* |
412 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | 412 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, |
413 | const char *name, | 413 | const char *name, |
414 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 414 | const struct GNUNET_IDENTITY_PublicKey *zone, |
415 | uint32_t type, | 415 | uint32_t type, |
416 | enum GNUNET_GNS_LocalOptions options, | 416 | enum GNUNET_GNS_LocalOptions options, |
417 | GNUNET_GNS_LookupResultProcessor proc, | 417 | GNUNET_GNS_LookupResultProcessor proc, |
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c index 3ebf07db6..b883662ad 100644 --- a/src/gns/gns_tld_api.c +++ b/src/gns/gns_tld_api.c | |||
@@ -167,7 +167,7 @@ process_lookup_result (void *cls, | |||
167 | */ | 167 | */ |
168 | static void | 168 | static void |
169 | lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, | 169 | lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, |
170 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 170 | const struct GNUNET_IDENTITY_PublicKey *pkey) |
171 | { | 171 | { |
172 | ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle, | 172 | ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle, |
173 | ltr->name, | 173 | ltr->name, |
@@ -190,11 +190,11 @@ lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, | |||
190 | */ | 190 | */ |
191 | static void | 191 | static void |
192 | identity_zone_cb (void *cls, | 192 | identity_zone_cb (void *cls, |
193 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 193 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
194 | const char *ego_name) | 194 | const char *ego_name) |
195 | { | 195 | { |
196 | struct GNUNET_GNS_LookupWithTldRequest *ltr = cls; | 196 | struct GNUNET_GNS_LookupWithTldRequest *ltr = cls; |
197 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 197 | struct GNUNET_IDENTITY_PublicKey pkey; |
198 | 198 | ||
199 | ltr->id_co = NULL; | 199 | ltr->id_co = NULL; |
200 | if (NULL == priv) | 200 | if (NULL == priv) |
@@ -219,7 +219,7 @@ identity_zone_cb (void *cls, | |||
219 | ltr->options = GNUNET_GNS_LO_NO_DHT; | 219 | ltr->options = GNUNET_GNS_LO_NO_DHT; |
220 | else | 220 | else |
221 | ltr->options = GNUNET_GNS_LO_LOCAL_MASTER; | 221 | ltr->options = GNUNET_GNS_LO_LOCAL_MASTER; |
222 | GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pkey); | 222 | GNUNET_IDENTITY_key_get_public (priv, &pkey); |
223 | lookup_with_public_key (ltr, &pkey); | 223 | lookup_with_public_key (ltr, &pkey); |
224 | } | 224 | } |
225 | 225 | ||
@@ -249,7 +249,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
249 | const char *tld; | 249 | const char *tld; |
250 | char *dot_tld; | 250 | char *dot_tld; |
251 | char *zonestr; | 251 | char *zonestr; |
252 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 252 | struct GNUNET_IDENTITY_PublicKey pkey; |
253 | 253 | ||
254 | ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest); | 254 | ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest); |
255 | ltr->gns_handle = handle; | 255 | ltr->gns_handle = handle; |
@@ -261,8 +261,10 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
261 | /* start with trivial case: TLD is zkey */ | 261 | /* start with trivial case: TLD is zkey */ |
262 | tld = get_tld (ltr->name); | 262 | tld = get_tld (ltr->name); |
263 | if (GNUNET_OK == | 263 | if (GNUNET_OK == |
264 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tld, strlen (tld), &pkey)) | 264 | GNUNET_IDENTITY_public_key_from_string (tld, &pkey)) |
265 | { | 265 | { |
266 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
267 | "`%s' seems to be a valid zone key\n", tld); | ||
266 | eat_tld (ltr->name, tld); | 268 | eat_tld (ltr->name, tld); |
267 | lookup_with_public_key (ltr, &pkey); | 269 | lookup_with_public_key (ltr, &pkey); |
268 | return ltr; | 270 | return ltr; |
@@ -281,9 +283,8 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
281 | &zonestr)) | 283 | &zonestr)) |
282 | { | 284 | { |
283 | if (GNUNET_OK != | 285 | if (GNUNET_OK != |
284 | GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr, | 286 | GNUNET_IDENTITY_public_key_from_string (zonestr, |
285 | strlen (zonestr), | 287 | &pkey)) |
286 | &pkey)) | ||
287 | { | 288 | { |
288 | GNUNET_log_config_invalid ( | 289 | GNUNET_log_config_invalid ( |
289 | GNUNET_ERROR_TYPE_ERROR, | 290 | GNUNET_ERROR_TYPE_ERROR, |
@@ -304,6 +305,8 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
304 | } | 305 | } |
305 | GNUNET_free (dot_tld); | 306 | GNUNET_free (dot_tld); |
306 | } | 307 | } |
308 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
309 | "`%s' should be a valid ego\n", ltr->name); | ||
307 | ltr->id_co = | 310 | ltr->id_co = |
308 | GNUNET_IDENTITY_ego_lookup_by_suffix (ltr->gns_handle->cfg, | 311 | GNUNET_IDENTITY_ego_lookup_by_suffix (ltr->gns_handle->cfg, |
309 | ltr->name, | 312 | ltr->name, |
diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c index 78db28cab..972fb49cd 100644 --- a/src/gns/gnunet-gns-import.c +++ b/src/gns/gnunet-gns-import.c | |||
@@ -168,12 +168,17 @@ check_pkey (unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, | |||
168 | char *pk, int *found_rec) | 168 | char *pk, int *found_rec) |
169 | { | 169 | { |
170 | int i; | 170 | int i; |
171 | struct GNUNET_IDENTITY_PublicKey pubkey; | ||
171 | 172 | ||
172 | for (i = 0; i < rd_len; i++) | 173 | for (i = 0; i < rd_len; i++) |
173 | { | 174 | { |
174 | char *s; | 175 | char *s; |
175 | if ((GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type) || | 176 | if (sizeof (uint32_t) > rd[i].data_size) |
176 | (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) ) | 177 | continue; |
178 | if (GNUNET_OK != GNUNET_GNSRECORD_identity_from_data (rd[i].data, | ||
179 | rd[i].data_size, | ||
180 | rd[i].record_type, | ||
181 | &pubkey)) | ||
177 | continue; | 182 | continue; |
178 | s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, | 183 | s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, |
179 | rd[i].data, | 184 | rd[i].data, |
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 8c5b2d6c4..52300ae3b 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -123,7 +123,7 @@ struct GNS_TopLevelDomain | |||
123 | /** | 123 | /** |
124 | * Public key associated with the @a tld. | 124 | * Public key associated with the @a tld. |
125 | */ | 125 | */ |
126 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 126 | struct GNUNET_IDENTITY_PublicKey pkey; |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Top-level domain as a string, including leading ".". | 129 | * Top-level domain as a string, including leading ".". |
@@ -177,7 +177,7 @@ static struct GNS_TopLevelDomain *tld_tail; | |||
177 | */ | 177 | */ |
178 | int | 178 | int |
179 | GNS_find_tld (const char *tld_str, | 179 | GNS_find_tld (const char *tld_str, |
180 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 180 | struct GNUNET_IDENTITY_PublicKey *pkey) |
181 | { | 181 | { |
182 | if ('\0' == *tld_str) | 182 | if ('\0' == *tld_str) |
183 | return GNUNET_NO; | 183 | return GNUNET_NO; |
@@ -485,7 +485,7 @@ read_service_conf (void *cls, | |||
485 | const char *option, | 485 | const char *option, |
486 | const char *value) | 486 | const char *value) |
487 | { | 487 | { |
488 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 488 | struct GNUNET_IDENTITY_PublicKey pk; |
489 | struct GNS_TopLevelDomain *tld; | 489 | struct GNS_TopLevelDomain *tld; |
490 | 490 | ||
491 | (void) cls; | 491 | (void) cls; |
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h index 2a432f8aa..d4fb9ec9f 100644 --- a/src/gns/gnunet-service-gns.h +++ b/src/gns/gnunet-service-gns.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #ifndef GNUNET_SERVICE_GNS_H | 26 | #ifndef GNUNET_SERVICE_GNS_H |
27 | #define GNUNET_SERVICE_GNS_H | 27 | #define GNUNET_SERVICE_GNS_H |
28 | 28 | ||
29 | #include "gnunet_identity_service.h" | ||
29 | 30 | ||
30 | /** | 31 | /** |
31 | * Find GNS zone belonging to TLD @a tld. | 32 | * Find GNS zone belonging to TLD @a tld. |
@@ -36,7 +37,7 @@ | |||
36 | */ | 37 | */ |
37 | int | 38 | int |
38 | GNS_find_tld (const char *tld_str, | 39 | GNS_find_tld (const char *tld_str, |
39 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 40 | struct GNUNET_IDENTITY_PublicKey *pkey); |
40 | 41 | ||
41 | 42 | ||
42 | /** | 43 | /** |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 19416a506..b53f4af6b 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -314,7 +314,7 @@ handle_dns_request (void *cls, | |||
314 | { | 314 | { |
315 | struct GNUNET_DNSPARSER_Packet *p; | 315 | struct GNUNET_DNSPARSER_Packet *p; |
316 | struct InterceptLookupHandle *ilh; | 316 | struct InterceptLookupHandle *ilh; |
317 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 317 | struct GNUNET_IDENTITY_PublicKey zone; |
318 | 318 | ||
319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
320 | "Hijacked a DNS request. Processing.\n"); | 320 | "Hijacked a DNS request. Processing.\n"); |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index cb75b23c7..d9d0d3099 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -173,7 +173,7 @@ struct AuthorityChain | |||
173 | /** | 173 | /** |
174 | * The zone of the GNS authority | 174 | * The zone of the GNS authority |
175 | */ | 175 | */ |
176 | struct GNUNET_CRYPTO_EcdsaPublicKey gns_authority; | 176 | struct GNUNET_IDENTITY_PublicKey gns_authority; |
177 | 177 | ||
178 | struct | 178 | struct |
179 | { | 179 | { |
@@ -305,7 +305,7 @@ struct GNS_ResolverHandle | |||
305 | /** | 305 | /** |
306 | * The top-level GNS authoritative zone to query | 306 | * The top-level GNS authoritative zone to query |
307 | */ | 307 | */ |
308 | struct GNUNET_CRYPTO_EcdsaPublicKey authority_zone; | 308 | struct GNUNET_IDENTITY_PublicKey authority_zone; |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * called when resolution phase finishes | 311 | * called when resolution phase finishes |
@@ -1251,7 +1251,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1251 | const char *tld; | 1251 | const char *tld; |
1252 | struct AuthorityChain *ac; | 1252 | struct AuthorityChain *ac; |
1253 | int af; | 1253 | int af; |
1254 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 1254 | struct GNUNET_IDENTITY_PublicKey zone; |
1255 | 1255 | ||
1256 | nlen = strlen (cname); | 1256 | nlen = strlen (cname); |
1257 | tld = GNS_get_tld (cname); | 1257 | tld = GNS_get_tld (cname); |
@@ -1296,7 +1296,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1296 | { | 1296 | { |
1297 | GNUNET_asprintf (&res, | 1297 | GNUNET_asprintf (&res, |
1298 | "%.*s", | 1298 | "%.*s", |
1299 | strlen (cname) - (strlen (tld) + 1), | 1299 | (int) (strlen (cname) - (strlen (tld) + 1)), |
1300 | cname); | 1300 | cname); |
1301 | } | 1301 | } |
1302 | else | 1302 | else |
@@ -1305,7 +1305,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1305 | "%.*s.%.*s", | 1305 | "%.*s.%.*s", |
1306 | (int) rh->name_resolution_pos, | 1306 | (int) rh->name_resolution_pos, |
1307 | rh->name, | 1307 | rh->name, |
1308 | (int) strlen (cname) - (strlen (tld) + 1), | 1308 | (int) (strlen (cname) - (strlen (tld) + 1)), |
1309 | cname); | 1309 | cname); |
1310 | } | 1310 | } |
1311 | rh->name_resolution_pos = strlen (res); | 1311 | rh->name_resolution_pos = strlen (res); |
@@ -1696,10 +1696,13 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh, | |||
1696 | const struct GNUNET_GNSRECORD_Data *rd) | 1696 | const struct GNUNET_GNSRECORD_Data *rd) |
1697 | { | 1697 | { |
1698 | struct AuthorityChain *ac; | 1698 | struct AuthorityChain *ac; |
1699 | struct GNUNET_IDENTITY_PublicKey auth; | ||
1699 | 1700 | ||
1700 | /* delegation to another zone */ | 1701 | /* delegation to another zone */ |
1701 | if (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) != | 1702 | if (GNUNET_OK != GNUNET_GNSRECORD_identity_from_data (rd->data, |
1702 | rd->data_size) | 1703 | rd->data_size, |
1704 | rd->record_type, | ||
1705 | &auth)) | ||
1703 | { | 1706 | { |
1704 | GNUNET_break_op (0); | 1707 | GNUNET_break_op (0); |
1705 | fail_resolution (rh); | 1708 | fail_resolution (rh); |
@@ -1709,9 +1712,7 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh, | |||
1709 | ac = GNUNET_new (struct AuthorityChain); | 1712 | ac = GNUNET_new (struct AuthorityChain); |
1710 | ac->rh = rh; | 1713 | ac->rh = rh; |
1711 | ac->gns_authority = GNUNET_YES; | 1714 | ac->gns_authority = GNUNET_YES; |
1712 | GNUNET_memcpy (&ac->authority_info.gns_authority, | 1715 | ac->authority_info.gns_authority = auth; |
1713 | rd->data, | ||
1714 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
1715 | ac->label = resolver_lookup_get_next_label (rh); | 1716 | ac->label = resolver_lookup_get_next_label (rh); |
1716 | /* add AC to tail */ | 1717 | /* add AC to tail */ |
1717 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 1718 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
@@ -1754,7 +1755,7 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, | |||
1754 | char *n; | 1755 | char *n; |
1755 | size_t off; | 1756 | size_t off; |
1756 | struct Gns2DnsPending *gp; | 1757 | struct Gns2DnsPending *gp; |
1757 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 1758 | struct GNUNET_IDENTITY_PublicKey zone; |
1758 | struct sockaddr_in v4; | 1759 | struct sockaddr_in v4; |
1759 | struct sockaddr_in6 v6; | 1760 | struct sockaddr_in6 v6; |
1760 | 1761 | ||
@@ -2257,19 +2258,25 @@ handle_gns_resolution_result (void *cls, | |||
2257 | break; | 2258 | break; |
2258 | 2259 | ||
2259 | case GNUNET_GNSRECORD_TYPE_PKEY: | 2260 | case GNUNET_GNSRECORD_TYPE_PKEY: |
2261 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
2260 | { | 2262 | { |
2261 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 2263 | struct GNUNET_IDENTITY_PublicKey pubkey; |
2262 | 2264 | if (rd[i].data_size < sizeof(uint32_t)) | |
2263 | if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) | 2265 | { |
2266 | GNUNET_break_op (0); | ||
2267 | break; | ||
2268 | } | ||
2269 | if (GNUNET_OK != | ||
2270 | GNUNET_GNSRECORD_identity_from_data (rd[i].data, | ||
2271 | rd[i].data_size, | ||
2272 | rd[i].record_type, | ||
2273 | &pubkey)) | ||
2264 | { | 2274 | { |
2265 | GNUNET_break_op (0); | 2275 | GNUNET_break_op (0); |
2266 | break; | 2276 | break; |
2267 | } | 2277 | } |
2268 | GNUNET_memcpy (&pub, | ||
2269 | rd[i].data, | ||
2270 | rd[i].data_size); | ||
2271 | rd_off++; | 2278 | rd_off++; |
2272 | if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) | 2279 | if (rd[i].record_type != rh->record_type) |
2273 | { | 2280 | { |
2274 | /* try to resolve "@" */ | 2281 | /* try to resolve "@" */ |
2275 | struct AuthorityChain *ac; | 2282 | struct AuthorityChain *ac; |
@@ -2277,7 +2284,7 @@ handle_gns_resolution_result (void *cls, | |||
2277 | ac = GNUNET_new (struct AuthorityChain); | 2284 | ac = GNUNET_new (struct AuthorityChain); |
2278 | ac->rh = rh; | 2285 | ac->rh = rh; |
2279 | ac->gns_authority = GNUNET_YES; | 2286 | ac->gns_authority = GNUNET_YES; |
2280 | ac->authority_info.gns_authority = pub; | 2287 | ac->authority_info.gns_authority = pubkey; |
2281 | ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); | 2288 | ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); |
2282 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 2289 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
2283 | rh->ac_tail, | 2290 | rh->ac_tail, |
@@ -2367,6 +2374,7 @@ handle_gns_resolution_result (void *cls, | |||
2367 | return; | 2374 | return; |
2368 | 2375 | ||
2369 | case GNUNET_GNSRECORD_TYPE_PKEY: | 2376 | case GNUNET_GNSRECORD_TYPE_PKEY: |
2377 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
2370 | GNUNET_break_op (1 == rd_count); /* PKEY should be unique */ | 2378 | GNUNET_break_op (1 == rd_count); /* PKEY should be unique */ |
2371 | recursive_pkey_resolution (rh, | 2379 | recursive_pkey_resolution (rh, |
2372 | &rd[0]); | 2380 | &rd[0]); |
@@ -2469,10 +2477,7 @@ handle_dht_response (void *cls, | |||
2469 | return; | 2477 | return; |
2470 | } | 2478 | } |
2471 | block = data; | 2479 | block = data; |
2472 | if (size != | 2480 | if (size != GNUNET_GNSRECORD_block_get_size (block)) |
2473 | ntohl (block->purpose.size) | ||
2474 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | ||
2475 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature)) | ||
2476 | { | 2481 | { |
2477 | /* how did this pass DHT block validation!? */ | 2482 | /* how did this pass DHT block validation!? */ |
2478 | GNUNET_break (0); | 2483 | GNUNET_break (0); |
@@ -2480,8 +2485,8 @@ handle_dht_response (void *cls, | |||
2480 | return; | 2485 | return; |
2481 | } | 2486 | } |
2482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2487 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2483 | "Decrypting DHT block of size %u for `%s', expires %s\n", | 2488 | "Decrypting DHT block of size %lu for `%s', expires %s\n", |
2484 | ntohl (block->purpose.size), | 2489 | GNUNET_GNSRECORD_block_get_size (block), |
2485 | rh->name, | 2490 | rh->name, |
2486 | GNUNET_STRINGS_absolute_time_to_string (exp)); | 2491 | GNUNET_STRINGS_absolute_time_to_string (exp)); |
2487 | if (GNUNET_OK != | 2492 | if (GNUNET_OK != |
@@ -2495,8 +2500,8 @@ handle_dht_response (void *cls, | |||
2495 | fail_resolution (rh); | 2500 | fail_resolution (rh); |
2496 | return; | 2501 | return; |
2497 | } | 2502 | } |
2498 | if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( | 2503 | if (0 == GNUNET_TIME_absolute_get_remaining ( |
2499 | block->expiration_time)). | 2504 | GNUNET_GNSRECORD_block_get_expiration (block)). |
2500 | rel_value_us) | 2505 | rel_value_us) |
2501 | { | 2506 | { |
2502 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2507 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2594,7 +2599,7 @@ handle_namecache_block_response (void *cls, | |||
2594 | struct GNS_ResolverHandle *rh = cls; | 2599 | struct GNS_ResolverHandle *rh = cls; |
2595 | struct AuthorityChain *ac = rh->ac_tail; | 2600 | struct AuthorityChain *ac = rh->ac_tail; |
2596 | const char *label = ac->label; | 2601 | const char *label = ac->label; |
2597 | const struct GNUNET_CRYPTO_EcdsaPublicKey *auth = | 2602 | const struct GNUNET_IDENTITY_PublicKey *auth = |
2598 | &ac->authority_info.gns_authority; | 2603 | &ac->authority_info.gns_authority; |
2599 | struct GNUNET_HashCode query; | 2604 | struct GNUNET_HashCode query; |
2600 | 2605 | ||
@@ -2604,8 +2609,8 @@ handle_namecache_block_response (void *cls, | |||
2604 | ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) && | 2609 | ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) && |
2605 | (ac != rh->ac_head))) && | 2610 | (ac != rh->ac_head))) && |
2606 | ((NULL == block) || | 2611 | ((NULL == block) || |
2607 | (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( | 2612 | (0 == GNUNET_TIME_absolute_get_remaining ( |
2608 | block->expiration_time)). | 2613 | GNUNET_GNSRECORD_block_get_expiration (block)). |
2609 | rel_value_us))) | 2614 | rel_value_us))) |
2610 | { | 2615 | { |
2611 | /* namecache knows nothing; try DHT lookup */ | 2616 | /* namecache knows nothing; try DHT lookup */ |
@@ -2622,8 +2627,8 @@ handle_namecache_block_response (void *cls, | |||
2622 | } | 2627 | } |
2623 | 2628 | ||
2624 | if ((NULL == block) || | 2629 | if ((NULL == block) || |
2625 | (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( | 2630 | (0 == GNUNET_TIME_absolute_get_remaining ( |
2626 | block->expiration_time)). | 2631 | GNUNET_GNSRECORD_block_get_expiration (block)). |
2627 | rel_value_us)) | 2632 | rel_value_us)) |
2628 | { | 2633 | { |
2629 | /* DHT not permitted and no local result, fail */ | 2634 | /* DHT not permitted and no local result, fail */ |
@@ -2857,7 +2862,7 @@ start_resolver_lookup (void *cls) | |||
2857 | * @return handle to cancel operation | 2862 | * @return handle to cancel operation |
2858 | */ | 2863 | */ |
2859 | struct GNS_ResolverHandle * | 2864 | struct GNS_ResolverHandle * |
2860 | GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 2865 | GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone, |
2861 | uint32_t record_type, | 2866 | uint32_t record_type, |
2862 | const char *name, | 2867 | const char *name, |
2863 | enum GNUNET_GNS_LocalOptions options, | 2868 | enum GNUNET_GNS_LocalOptions options, |
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index 3dab3c91a..b099c5d65 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -86,7 +86,7 @@ typedef void | |||
86 | * @return handle to cancel operation | 86 | * @return handle to cancel operation |
87 | */ | 87 | */ |
88 | struct GNS_ResolverHandle * | 88 | struct GNS_ResolverHandle * |
89 | GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 89 | GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone, |
90 | uint32_t record_type, | 90 | uint32_t record_type, |
91 | const char *name, | 91 | const char *name, |
92 | enum GNUNET_GNS_LocalOptions options, | 92 | enum GNUNET_GNS_LocalOptions options, |
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index aabedcaac..9b58c9034 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c | |||
@@ -145,17 +145,13 @@ block_plugin_gns_evaluate (void *cls, | |||
145 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 145 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
146 | } | 146 | } |
147 | block = reply_block; | 147 | block = reply_block; |
148 | if (ntohl (block->purpose.size) + sizeof(struct | 148 | if (GNUNET_GNSRECORD_block_get_size (block) > reply_block_size) |
149 | GNUNET_CRYPTO_EcdsaSignature) | ||
150 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) != | ||
151 | reply_block_size) | ||
152 | { | 149 | { |
153 | GNUNET_break_op (0); | 150 | GNUNET_break_op (0); |
154 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 151 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
155 | } | 152 | } |
156 | GNUNET_CRYPTO_hash (&block->derived_key, | 153 | GNUNET_GNSRECORD_query_from_block (block, |
157 | sizeof(block->derived_key), | 154 | &h); |
158 | &h); | ||
159 | if (0 != GNUNET_memcmp (&h, query)) | 155 | if (0 != GNUNET_memcmp (&h, query)) |
160 | { | 156 | { |
161 | GNUNET_break_op (0); | 157 | GNUNET_break_op (0); |
@@ -206,9 +202,8 @@ block_plugin_gns_get_key (void *cls, | |||
206 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 202 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
207 | } | 203 | } |
208 | block = reply_block; | 204 | block = reply_block; |
209 | GNUNET_CRYPTO_hash (&block->derived_key, | 205 | GNUNET_GNSRECORD_query_from_block (block, |
210 | sizeof(block->derived_key), | 206 | key); |
211 | key); | ||
212 | return GNUNET_OK; | 207 | return GNUNET_OK; |
213 | } | 208 | } |
214 | 209 | ||
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c index 81f2b9eff..a2ad0b905 100644 --- a/src/gns/plugin_gnsrecord_gns.c +++ b/src/gns/plugin_gnsrecord_gns.c | |||
@@ -50,13 +50,18 @@ gns_value_to_string (void *cls, | |||
50 | size_t data_size) | 50 | size_t data_size) |
51 | { | 51 | { |
52 | const char *cdata; | 52 | const char *cdata; |
53 | struct GNUNET_IDENTITY_PublicKey pk; | ||
53 | 54 | ||
54 | switch (type) | 55 | switch (type) |
55 | { | 56 | { |
56 | case GNUNET_GNSRECORD_TYPE_PKEY: | 57 | case GNUNET_GNSRECORD_TYPE_PKEY: |
57 | if (data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) | 58 | case GNUNET_GNSRECORD_TYPE_EDKEY: |
59 | if (GNUNET_OK != GNUNET_GNSRECORD_identity_from_data (data, | ||
60 | data_size, | ||
61 | type, | ||
62 | &pk)) | ||
58 | return NULL; | 63 | return NULL; |
59 | return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); | 64 | return GNUNET_IDENTITY_public_key_to_string (&pk); |
60 | 65 | ||
61 | case GNUNET_GNSRECORD_TYPE_NICK: | 66 | case GNUNET_GNSRECORD_TYPE_NICK: |
62 | return GNUNET_strndup (data, data_size); | 67 | return GNUNET_strndup (data, data_size); |
@@ -153,24 +158,35 @@ gns_string_to_value (void *cls, | |||
153 | void **data, | 158 | void **data, |
154 | size_t *data_size) | 159 | size_t *data_size) |
155 | { | 160 | { |
156 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 161 | struct GNUNET_IDENTITY_PublicKey pk; |
162 | uint32_t record_type; | ||
157 | 163 | ||
158 | if (NULL == s) | 164 | if (NULL == s) |
159 | return GNUNET_SYSERR; | 165 | return GNUNET_SYSERR; |
160 | switch (type) | 166 | switch (type) |
161 | { | 167 | { |
162 | case GNUNET_GNSRECORD_TYPE_PKEY: | 168 | case GNUNET_GNSRECORD_TYPE_PKEY: |
169 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
163 | if (GNUNET_OK != | 170 | if (GNUNET_OK != |
164 | GNUNET_CRYPTO_ecdsa_public_key_from_string (s, strlen (s), &pkey)) | 171 | GNUNET_IDENTITY_public_key_from_string (s, &pk)) |
165 | { | 172 | { |
166 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 173 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
167 | _ ("Unable to parse PKEY record `%s'\n"), | 174 | _ ("Unable to parse zone key record `%s'\n"), |
168 | s); | 175 | s); |
169 | return GNUNET_SYSERR; | 176 | return GNUNET_SYSERR; |
170 | } | 177 | } |
171 | *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); | 178 | *data_size = GNUNET_IDENTITY_key_get_length (&pk); |
172 | GNUNET_memcpy (*data, &pkey, sizeof(pkey)); | 179 | if (GNUNET_OK != GNUNET_GNSRECORD_data_from_identity (&pk, |
173 | *data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); | 180 | (char **) data, |
181 | data_size, | ||
182 | &record_type)) | ||
183 | return GNUNET_SYSERR; | ||
184 | if (record_type != type) | ||
185 | { | ||
186 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
187 | _("Record type does not match parsed record type\n")); | ||
188 | return GNUNET_SYSERR; | ||
189 | } | ||
174 | return GNUNET_OK; | 190 | return GNUNET_OK; |
175 | 191 | ||
176 | case GNUNET_GNSRECORD_TYPE_NICK: | 192 | case GNUNET_GNSRECORD_TYPE_NICK: |
@@ -301,6 +317,7 @@ static struct | |||
301 | const char *name; | 317 | const char *name; |
302 | uint32_t number; | 318 | uint32_t number; |
303 | } gns_name_map[] = { { "PKEY", GNUNET_GNSRECORD_TYPE_PKEY }, | 319 | } gns_name_map[] = { { "PKEY", GNUNET_GNSRECORD_TYPE_PKEY }, |
320 | { "EDKEY", GNUNET_GNSRECORD_TYPE_PKEY }, | ||
304 | { "NICK", GNUNET_GNSRECORD_TYPE_NICK }, | 321 | { "NICK", GNUNET_GNSRECORD_TYPE_NICK }, |
305 | { "LEHO", GNUNET_GNSRECORD_TYPE_LEHO }, | 322 | { "LEHO", GNUNET_GNSRECORD_TYPE_LEHO }, |
306 | { "VPN", GNUNET_GNSRECORD_TYPE_VPN }, | 323 | { "VPN", GNUNET_GNSRECORD_TYPE_VPN }, |
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 6ec921f70..2ccb5be2b 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "gnunet_rest_lib.h" | 28 | #include "gnunet_rest_lib.h" |
29 | #include "gnunet_json_lib.h" | 29 | #include "gnunet_json_lib.h" |
30 | #include "gnunet_gnsrecord_lib.h" | 30 | #include "gnunet_gnsrecord_lib.h" |
31 | #include "gnunet_gnsrecord_json_lib.h" | ||
31 | #include "gnunet_gns_service.h" | 32 | #include "gnunet_gns_service.h" |
32 | #include "microhttpd.h" | 33 | #include "microhttpd.h" |
33 | #include <jansson.h> | 34 | #include <jansson.h> |
@@ -264,7 +265,7 @@ handle_gns_response (void *cls, | |||
264 | return; | 265 | return; |
265 | } | 266 | } |
266 | 267 | ||
267 | result_obj = GNUNET_JSON_from_gnsrecord (handle->name, rd, rd_count); | 268 | result_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (handle->name, rd, rd_count); |
268 | 269 | ||
269 | result = json_dumps (result_obj, 0); | 270 | result = json_dumps (result_obj, 0); |
270 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); | 271 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); |
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh index d5516fd03..8d446c507 100755 --- a/src/gns/test_gns_dht_lookup.sh +++ b/src/gns/test_gns_dht_lookup.sh | |||
@@ -26,6 +26,7 @@ gnunet-arm -i datastore -c test_gns_lookup.conf | |||
26 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf | 26 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf |
27 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') | 27 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') |
28 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf | 28 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
29 | echo "MYEGO: $MY_EGO OTHER_EGO: $DELEGATED_PKEY" | ||
29 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 30 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
30 | #This works | 31 | #This works |
31 | gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 32 | gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |