flip LSD0001 defines
authorChristian Grothoff <christian@grothoff.org>
Sat, 7 Dec 2019 13:45:44 +0000 (14:45 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 7 Dec 2019 13:45:44 +0000 (14:45 +0100)
src/gns/gnunet-gns.c
src/gns/gnunet-service-gns_resolver.c
src/gns/nss/nss_gns_query.c
src/gns/plugin_gnsrecord_gns.c
src/gnsrecord/gnsrecord_crypto.c

index 600a9c9a58233174171d8639c2e54d88eec874ca..37633daf1accc3c97e38ff30fd52f2aadc60b20e 100644 (file)
@@ -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"))
index 4b26418186099ff861b4d13e47910ac5b4e1dec1..dac0ab16a5c63cd560335b376b6329370b3cce5a 100644 (file)
@@ -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,
index 7b69282cb48f4531455049974879b72639465eed..77ad3a3583f16e2d3409ffe2f0c1e44a889293ac 100644 (file)
@@ -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",
index 38c3582c14f87d2a85aa3630be8cddf2ac20ec87..871fc93245b35e9d33d68e3b7dc254b9e31061a1 100644 (file)
@@ -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);
index 2b05dea56fb79312fb611a472f08ba4ac446f5be..b276880196f1d8c080dac3ad7c9803ee0c6cd4e1 100644 (file)
@@ -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
 }