fix ftbfs experimental -- cy1
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Tue, 28 Apr 2020 15:16:40 +0000 (17:16 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Tue, 28 Apr 2020 15:16:40 +0000 (17:16 +0200)
src/abd/abd.h
src/abd/abd_serialization.c
src/abd/delegate_misc.c
src/abd/gnunet-abd.c
src/abd/plugin_gnsrecord_abd.c

index 1e9d6bcea54389349ab101985e57762c73774798..0af0d43caaf3b8e65587bf798abb3c09e43f4e6f 100644 (file)
@@ -245,14 +245,14 @@ struct DelegateEntry
 {
 
   /**
-   * The signature for this credential by the issuer
+   * Signature meta
    */
-  struct GNUNET_CRYPTO_EcdsaSignature signature;
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
 
   /**
-   * Signature meta
+   * The signature for this credential by the issuer
    */
-  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+  struct GNUNET_CRYPTO_EcdsaSignature signature;
 
   /**
    * Public key of the issuer
index 90a89886b0ef6346f1e38e937276fdc97ae44d20..c03fab7dc07c7a0bcba336200ab334c574953656 100644 (file)
@@ -451,7 +451,7 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele,
 
   if (GNUNET_OK !=
       GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
-                                  &cdata->purpose,
+                                  cdata,
                                   &cdata->signature,
                                   &cdata->issuer_key))
   {
@@ -474,7 +474,7 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size)
   cdata = (struct DelegateEntry *) data;
   if (GNUNET_OK !=
       GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
-                                  &cdata->purpose,
+                                  cdata,
                                   &cdata->signature,
                                   &cdata->issuer_key))
   {
index df34cff8bd6135e480b59c5156bc3d64ae46159c..4740a3e307944dc975b87ee431e6d44629ed3025 100644 (file)
@@ -240,13 +240,7 @@ GNUNET_ABD_delegate_issue (
 
   GNUNET_memcpy (&del[1], tmp_str, attr_len);
 
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_ecdsa_sign (issuer, &del->purpose, &del->signature))
-  {
-    GNUNET_break (0);
-    GNUNET_free (del);
-    return NULL;
-  }
+  GNUNET_CRYPTO_ecdsa_sign (issuer, del, &del->signature);
 
   dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
   dele->signature = del->signature;
index eb3e29e23f63e5d6f6f6753c5b33f0d3758bddc3..6cf4aab0d33af2ab643acea13c8f1a65da559e28 100644 (file)
@@ -512,11 +512,13 @@ get_existing_record (void *cls,
                      unsigned int rd_count,
                      const struct GNUNET_GNSRECORD_Data *rd)
 {
-  struct GNUNET_GNSRECORD_Data rdn[rd_count + 1];
   struct GNUNET_GNSRECORD_Data *rde;
+  struct GNUNET_GNSRECORD_Data* rdn =
+    GNUNET_malloc(sizeof(*rdn)*(rd_count + 1));
 
   memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
-  GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
+  GNUNET_memcpy (&rdn[1], rd,
+                 rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
   rde = &rdn[0];
   rde->data = data;
   rde->data_size = data_size;
@@ -539,7 +541,7 @@ get_existing_record (void *cls,
                                            rde,
                                            &add_continuation,
                                            &add_qe);
-
+  GNUNET_free(rdn);
   return;
 }
 
@@ -602,10 +604,18 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
     if (GNUNET_OK !=
         GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size))
     {
-      fprintf (stderr,
-               "Value `%s' invalid for record type `%s'\n",
-               subject,
-               typestring);
+      if(typestring == NULL) {
+        fputs("No value for unknown record type\n", stderr);
+      } else if(subject == NULL) {
+        fprintf(stderr,
+                "No value for record type`%s'\n",
+                typestring);
+      } else {
+        fprintf (stderr,
+                 "Value `%s' invalid for record type `%s'\n",
+                 subject,
+                 typestring);
+      }
       GNUNET_SCHEDULER_shutdown ();
       return;
     }
@@ -917,7 +927,8 @@ run (void *cls,
     int i;
     while (NULL != (tok = strtok (NULL, ",")))
       count++;
-    struct GNUNET_ABD_Delegate delegates[count];
+    struct GNUNET_ABD_Delegate* delegates =
+      GNUNET_malloc(sizeof(*delegates)*count);
     struct GNUNET_ABD_Delegate *dele;
     GNUNET_free (tmp);
     tmp = GNUNET_strdup (subject_delegate);
@@ -946,9 +957,11 @@ run (void *cls,
                                         NULL);
     for (i = 0; i < count; i++)
     {
-      GNUNET_free ((char *) delegates[i].issuer_attribute);
+      GNUNET_free_nz ((char *) delegates[i].issuer_attribute);
+      delegates[i].issuer_attribute = NULL;
     }
     GNUNET_free (tmp);
+    GNUNET_free(delegates);
   }
   else
   {
index c7635b99756a03474a9e9c9258eb1b08341d399f..850fa9a45ed46e7e403fd36843eecd327286cb95 100644 (file)
@@ -235,8 +235,10 @@ abd_string_to_value (void *cls,
                                            (char *) &sets[1]);
       for (i = 0; i < entries; i++)
       {
-        if (0 != set[i].subject_attribute_len)
-          GNUNET_free ((char *) set[i].subject_attribute);
+        if (0 != set[i].subject_attribute_len) {
+          GNUNET_free_nz ((char *) set[i].subject_attribute);
+          set[i].subject_attribute = NULL;
+        }
       }
       sets->set_count = htonl (entries);
       sets->data_size = GNUNET_htonll (tmp_data_size);