From: Christian Grothoff Date: Sat, 7 Dec 2019 13:45:44 +0000 (+0100) Subject: flip LSD0001 defines X-Git-Tag: v0.12.0~40 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b365e4d52a723b48bb018a8c2dbfc8fe1050988a;p=oweals%2Fgnunet.git flip LSD0001 defines --- diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 600a9c9a5..37633daf1 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -238,15 +238,15 @@ run (void *cls, if (NULL != (colon = strchr (lookup_name, ':'))) *colon = '\0'; } -#ifdef LSD001 - Idna_rc rc; + /** * If DNS compatibility is requested, we first verify that the * lookup_name is in a DNS format. If yes, we convert it to UTF-8. */ if (GNUNET_YES == dns_compat) { -#endif + Idna_rc rc; + if (GNUNET_OK != GNUNET_DNSPARSER_check_name (lookup_name)) { fprintf (stderr, @@ -255,7 +255,6 @@ run (void *cls, global_ret = 3; return; } -#ifdef LSD001 if (IDNA_SUCCESS != (rc = idna_to_unicode_8z8z (lookup_name, &idna_name, IDNA_ALLOW_UNASSIGNED))) @@ -269,7 +268,7 @@ run (void *cls, } lookup_name = idna_name; } -#endif + if (GNUNET_YES != GNUNET_CLIENT_test (cfg, "arm")) diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 4b2641818..dac0ab16a 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -1279,9 +1279,9 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, if (0 == rh->name_resolution_pos) { GNUNET_asprintf (&res, - "%.*s", - strlen (cname) - (strlen (tld) + 1), - cname); + "%.*s", + strlen (cname) - (strlen (tld) + 1), + cname); } else { @@ -1289,7 +1289,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, "%.*s.%.*s", (int) rh->name_resolution_pos, rh->name, - (int) strlen (cname) - (strlen(tld)+1), + (int) strlen (cname) - (strlen (tld) + 1), cname); } rh->name_resolution_pos = strlen (res); @@ -1747,14 +1747,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, n = GNUNET_DNSPARSER_parse_name (rd[i].data, rd[i].data_size, &off); -#ifdef LSD001 ip = GNUNET_strdup (&rd[i].data[off]); off += strlen (ip) + 1; -#else - ip = GNUNET_DNSPARSER_parse_name (rd[i].data, - rd[i].data_size, - &off); -#endif if ((NULL == n) || (NULL == ip) || @@ -1877,19 +1871,24 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, (0 != rh->name_resolution_pos) ? "." : "", ns); GNUNET_free (ns); -#ifdef LSD001 - /* the GNS name is UTF-8 and may include multibyte chars. - * We have to convert the combined name to a DNS-compatible IDNA. - */ - char *tmp = ac->label; - if (IDNA_SUCCESS != idna_to_ascii_8z (tmp, &ac->label, IDNA_ALLOW_UNASSIGNED)) + { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _ ("Name `%s' cannot be converted to IDNA."), tmp); - return GNUNET_SYSERR; + /* the GNS name is UTF-8 and may include multibyte chars. + * We have to convert the combined name to a DNS-compatible IDNA. + */ + char *tmp = ac->label; + + if (IDNA_SUCCESS != idna_to_ascii_8z (tmp, + &ac->label, + IDNA_ALLOW_UNASSIGNED)) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + _ ("Name `%s' cannot be converted to IDNA."), + tmp); + return GNUNET_SYSERR; + } + GNUNET_free (tmp); } - GNUNET_free (tmp); -#endif GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, rh->ac_tail, diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c index 7b69282cb..77ad3a358 100644 --- a/src/gns/nss/nss_gns_query.c +++ b/src/gns/nss/nss_gns_query.c @@ -74,9 +74,7 @@ gns_resolve_name (int af, const char *name, struct userdata *u) { char *argv[] = { "gnunet-gns", "-r", /* Raw output for easier parsing */ -#ifdef LSD001 "-d", /* DNS compatibility (allow IDNA names, no UTF-8) */ -#endif "-t", (AF_INET6 == af) ? "AAAA" : "A", "-u", diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c index 38c3582c1..871fc9324 100644 --- a/src/gns/plugin_gnsrecord_gns.c +++ b/src/gns/plugin_gnsrecord_gns.c @@ -78,19 +78,8 @@ gns_value_to_string (void *cls, GNUNET_free_non_null (ns); return NULL; } -#ifdef LSD001 //DNS server IP/name must be UTF-8 - ip = GNUNET_strdup((char*) &data[off]); -#else - // Must be IP or DNS name - ip = GNUNET_DNSPARSER_parse_name (data, data_size, &off); - if ((NULL == ip) || (off != data_size)) - { - GNUNET_break_op (0); - GNUNET_free_non_null (ns); - GNUNET_free_non_null (ip); - return NULL; - } -#endif + /* DNS server IP/name must be UTF-8 */ + ip = GNUNET_strdup ((char*) &data[off]); GNUNET_asprintf (&nstr, "%s@%s", ns, ip); GNUNET_free_non_null (ns); GNUNET_free_non_null (ip); @@ -215,9 +204,9 @@ gns_string_to_value (void *cls, off = 0; if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf, - sizeof(nsbuf), - &off, - cpy)) + sizeof(nsbuf), + &off, + cpy)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ( @@ -226,21 +215,9 @@ gns_string_to_value (void *cls, GNUNET_free (cpy); return GNUNET_SYSERR; } -#ifdef LSD001 //The DNS server location/name is in UTF-8 + /* The DNS server location/name is in UTF-8 */ GNUNET_memcpy (&nsbuf[off], at, strlen (at) + 1); off += strlen (at) + 1; -#else - if (GNUNET_OK != - GNUNET_DNSPARSER_builder_add_name (nsbuf, sizeof(nsbuf), &off, at)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ ( - "Failed to serialize GNS2DNS record with value `%s': Not a DNS name\n"), - s); - GNUNET_free (cpy); - return GNUNET_SYSERR; - } -#endif GNUNET_free (cpy); *data_size = off; *data = GNUNET_malloc (off); diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c index 2b05dea56..b27688019 100644 --- a/src/gnsrecord/gnsrecord_crypto.c +++ b/src/gnsrecord/gnsrecord_crypto.c @@ -54,12 +54,7 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, { static const char ctx_key[] = "gns-aes-ctx-key"; static const char ctx_iv[] = "gns-aes-ctx-iv"; -/** - * Next time we break protocol (v12) we harmonize the KDF usage in GNS: - * We use the strings above as salt and the public key as IKM similar to - * how derive_h is done in crypto_ecc.c. - */ -#ifdef LSD001 + GNUNET_CRYPTO_kdf (skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey), ctx_key, strlen (ctx_key), pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), @@ -71,19 +66,6 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), label, strlen (label), NULL, 0); -#else - GNUNET_CRYPTO_kdf (skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey), - pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), - label, strlen (label), - ctx_key, strlen (ctx_key), - NULL, 0); - GNUNET_CRYPTO_kdf (iv, sizeof(struct - GNUNET_CRYPTO_SymmetricInitializationVector), - pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), - label, strlen (label), - ctx_iv, strlen (ctx_iv), - NULL, 0); -#endif }