diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-23 12:42:00 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-23 12:42:00 +0200 |
commit | e1f46c052dca3cd7a390f18f97b10162fe537a15 (patch) | |
tree | daa43ca3b189b6f86425801dc94413a71a04a66c /src/gns | |
parent | ff4d7b51f37f61633766664647e9b148af1e4f0a (diff) | |
download | gnunet-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/gns')
-rw-r--r-- | src/gns/gns_tld_api.c | 14 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 8 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c index 293e37140..8a4d03b11 100644 --- a/src/gns/gns_tld_api.c +++ b/src/gns/gns_tld_api.c | |||
@@ -94,7 +94,7 @@ struct GNUNET_GNS_LookupWithTldRequest | |||
94 | * @return the part of @a name after the last ".", | 94 | * @return the part of @a name after the last ".", |
95 | * or @a name if @a name does not contain a "." | 95 | * or @a name if @a name does not contain a "." |
96 | */ | 96 | */ |
97 | static const char * | 97 | static char * |
98 | get_tld (const char *name) | 98 | get_tld (const char *name) |
99 | { | 99 | { |
100 | const char *tld; | 100 | const char *tld; |
@@ -105,14 +105,14 @@ get_tld (const char *name) | |||
105 | tld = name; | 105 | tld = name; |
106 | else | 106 | else |
107 | tld++; /* skip the '.' */ | 107 | tld++; /* skip the '.' */ |
108 | return tld; | 108 | return GNUNET_strdup (tld); |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Eat the TLD of the given @a name. | 113 | * Eat the TLD of the given @a name. |
114 | * | 114 | * |
115 | * @param name a name | 115 | * @param[in,out] name a name |
116 | */ | 116 | */ |
117 | static void | 117 | static void |
118 | eat_tld (char *name) | 118 | eat_tld (char *name) |
@@ -124,7 +124,7 @@ eat_tld (char *name) | |||
124 | (unsigned char) '.'); | 124 | (unsigned char) '.'); |
125 | if (NULL == tld) | 125 | if (NULL == tld) |
126 | strcpy (name, | 126 | strcpy (name, |
127 | GNUNET_GNS_MASTERZONE_STR); | 127 | GNUNET_GNS_EMPTY_LABEL_AT); |
128 | else | 128 | else |
129 | *tld = '\0'; | 129 | *tld = '\0'; |
130 | } | 130 | } |
@@ -229,7 +229,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
229 | void *proc_cls) | 229 | void *proc_cls) |
230 | { | 230 | { |
231 | struct GNUNET_GNS_LookupWithTldRequest *ltr; | 231 | struct GNUNET_GNS_LookupWithTldRequest *ltr; |
232 | const char *tld; | 232 | char *tld; |
233 | char *dot_tld; | 233 | char *dot_tld; |
234 | char *zonestr; | 234 | char *zonestr; |
235 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 235 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
@@ -251,6 +251,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
251 | eat_tld (ltr->name); | 251 | eat_tld (ltr->name); |
252 | lookup_with_public_key (ltr, | 252 | lookup_with_public_key (ltr, |
253 | &pkey); | 253 | &pkey); |
254 | GNUNET_free (tld); | ||
254 | return ltr; | 255 | return ltr; |
255 | } | 256 | } |
256 | 257 | ||
@@ -277,6 +278,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
277 | GNUNET_free (dot_tld); | 278 | GNUNET_free (dot_tld); |
278 | GNUNET_free (ltr->name); | 279 | GNUNET_free (ltr->name); |
279 | GNUNET_free (ltr); | 280 | GNUNET_free (ltr); |
281 | GNUNET_free (tld); | ||
280 | return NULL; | 282 | return NULL; |
281 | } | 283 | } |
282 | GNUNET_free (dot_tld); | 284 | GNUNET_free (dot_tld); |
@@ -284,6 +286,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
284 | eat_tld (ltr->name); | 286 | eat_tld (ltr->name); |
285 | lookup_with_public_key (ltr, | 287 | lookup_with_public_key (ltr, |
286 | &pkey); | 288 | &pkey); |
289 | GNUNET_free (tld); | ||
287 | return ltr; | 290 | return ltr; |
288 | } | 291 | } |
289 | GNUNET_free (dot_tld); | 292 | GNUNET_free (dot_tld); |
@@ -301,6 +304,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
301 | tld, | 304 | tld, |
302 | &identity_zone_cb, | 305 | &identity_zone_cb, |
303 | ltr); | 306 | ltr); |
307 | GNUNET_free (tld); | ||
304 | if (NULL == ltr->id_op) | 308 | if (NULL == ltr->id_op) |
305 | { | 309 | { |
306 | GNUNET_free (ltr->name); | 310 | GNUNET_free (ltr->name); |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 74eb47f29..745a2f3bd 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -2096,14 +2096,14 @@ handle_gns_resolution_result (void *cls, | |||
2096 | rd_off++; | 2096 | rd_off++; |
2097 | if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) | 2097 | if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) |
2098 | { | 2098 | { |
2099 | /* try to resolve "+" */ | 2099 | /* try to resolve "@" */ |
2100 | struct AuthorityChain *ac; | 2100 | struct AuthorityChain *ac; |
2101 | 2101 | ||
2102 | ac = GNUNET_new (struct AuthorityChain); | 2102 | ac = GNUNET_new (struct AuthorityChain); |
2103 | ac->rh = rh; | 2103 | ac->rh = rh; |
2104 | ac->gns_authority = GNUNET_YES; | 2104 | ac->gns_authority = GNUNET_YES; |
2105 | ac->authority_info.gns_authority = pub; | 2105 | ac->authority_info.gns_authority = pub; |
2106 | ac->label = GNUNET_strdup (GNUNET_GNS_MASTERZONE_STR); | 2106 | ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); |
2107 | ac->suggested_shortening_label = NULL; | 2107 | ac->suggested_shortening_label = NULL; |
2108 | ac->shortening_started = GNUNET_NO; | 2108 | ac->shortening_started = GNUNET_NO; |
2109 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 2109 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
@@ -2629,8 +2629,8 @@ start_resolver_lookup (void *cls) | |||
2629 | ac->suggested_shortening_label = NULL; | 2629 | ac->suggested_shortening_label = NULL; |
2630 | if (NULL == ac->label) | 2630 | if (NULL == ac->label) |
2631 | /* name was just the "TLD", so we default to label | 2631 | /* name was just the "TLD", so we default to label |
2632 | #GNUNET_GNS_MASTERZONE_STR */ | 2632 | #GNUNET_GNS_EMPTY_LABEL_AT */ |
2633 | ac->label = GNUNET_strdup (GNUNET_GNS_MASTERZONE_STR); | 2633 | ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); |
2634 | ac->gns_authority = GNUNET_YES; | 2634 | ac->gns_authority = GNUNET_YES; |
2635 | ac->authority_info.gns_authority = rh->authority_zone; | 2635 | ac->authority_info.gns_authority = rh->authority_zone; |
2636 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 2636 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |