gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: test for use-after-free crash wh


From: gnunet
Subject: [taler-exchange] branch master updated: test for use-after-free crash when getting keys
Date: Mon, 13 Jul 2020 23:37:32 +0200

This is an automated email from the git hooks/post-receive script.

jonathan-buchanan pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 8147661f test for use-after-free crash when getting keys
     new c673caba Merge branch 'master' of ssh://git.taler.net/exchange into 
HEAD
8147661f is described below

commit 8147661f94b31710393e4695b78fe54864a2c3e7
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Mon Jul 13 17:31:46 2020 -0400

    test for use-after-free crash when getting keys
---
 src/include/taler_twister_testing_lib.h           | 17 ++++++
 src/testing/test_exchange_api_twisted.c           | 33 ++++++++++-
 src/testing/testing_api_cmd_twister_exec_client.c | 68 +++++++++++++++++++++++
 3 files changed, 116 insertions(+), 2 deletions(-)

diff --git a/src/include/taler_twister_testing_lib.h 
b/src/include/taler_twister_testing_lib.h
index fb0c352d..4ff3f42a 100644
--- a/src/include/taler_twister_testing_lib.h
+++ b/src/include/taler_twister_testing_lib.h
@@ -99,6 +99,23 @@ TALER_TESTING_cmd_modify_object_ul (const char *label,
                                     const char *value);
 
 
+/**
+ * Create a "modify header" CMD.  This command instructs
+ * the twister to modify a header in the next HTTP response.
+ *
+ * @param label command label
+ * @param config_filename configuration filename.
+ * @param header name of the header to modify.
+ * @param value value to set the header to.
+ * @return the command
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_modify_header_dl (const char *label,
+                                    const char *config_filename,
+                                    const char *path,
+                                    const char *value);
+
+
 /**
  * Create a "malform response" CMD.  This command makes
  * the next response randomly malformed (by truncating it).
diff --git a/src/testing/test_exchange_api_twisted.c 
b/src/testing/test_exchange_api_twisted.c
index c99c7410..25cee058 100644
--- a/src/testing/test_exchange_api_twisted.c
+++ b/src/testing/test_exchange_api_twisted.c
@@ -33,7 +33,7 @@
 #include "taler_bank_service.h"
 #include "taler_fakebank_lib.h"
 #include "taler_testing_lib.h"
-#include <taler/taler_twister_testing_lib.h>
+#include "taler_twister_testing_lib.h"
 #include <taler/taler_twister_service.h>
 
 /**
@@ -153,7 +153,8 @@ run (void *cls,
    * NOTE: not all CMDs actually need the twister,
    * so it may be better to move those into the "main"
    * lib test suite.
-   */struct TALER_TESTING_Command refund[] = {
+   */
+  struct TALER_TESTING_Command refund[] = {
     CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
                               "EUR:5.01"),
     CMD_EXEC_WIREWATCH ("wirewatch-r1"),
@@ -208,11 +209,39 @@ run (void *cls,
     TALER_TESTING_cmd_end ()
   };
 
+  /**
+   * Test that we don't get errors when the keys from the exchange
+   * are out of date.
+   */
+  struct TALER_TESTING_Command expired_keys[] = {
+    TALER_TESTING_cmd_modify_header_dl ("modify-expiration",
+                                        CONFIG_FILE,
+                                        MHD_HTTP_HEADER_EXPIRES,
+                                        "Wed, 19 Jan 586524 08:01:49 GMT"),
+    TALER_TESTING_cmd_check_keys_pull_all_keys (
+      "check-keys-expiration-0",
+      2,
+      5),
+    /**
+     * Run some normal commands after this to make sure everything is fine.
+     */
+    CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r2",
+                              "EUR:55.01"),
+    CMD_EXEC_WIREWATCH ("wirewatch-r2"),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r2",
+                                       "create-reserve-r2",
+                                       "EUR:5",
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_end ()
+  };
+
   struct TALER_TESTING_Command commands[] = {
     TALER_TESTING_cmd_batch ("refresh-reveal-409-conflict",
                              refresh_409_conflict),
     TALER_TESTING_cmd_batch ("refund",
                              refund),
+    TALER_TESTING_cmd_batch ("expired-keys",
+                             expired_keys),
     TALER_TESTING_cmd_end ()
   };
 
diff --git a/src/testing/testing_api_cmd_twister_exec_client.c 
b/src/testing/testing_api_cmd_twister_exec_client.c
index bfcfe459..3f1fefab 100644
--- a/src/testing/testing_api_cmd_twister_exec_client.c
+++ b/src/testing/testing_api_cmd_twister_exec_client.c
@@ -495,6 +495,39 @@ modify_object_ul_run (void *cls,
 }
 
 
+/**
+ * Run a "modify header" CMD
+ *
+ * @param cls closure.
+ * @param cmd the command being run.
+ * @param is the interpreter state.
+ */
+static void
+modify_header_dl_run (void *cls,
+                      const struct TALER_TESTING_Command *cmd,
+                      struct TALER_TESTING_Interpreter *is)
+{
+  struct ModifyObjectState *mos = cls;
+
+  mos->proc = GNUNET_OS_start_process (GNUNET_NO,
+                                       GNUNET_OS_INHERIT_STD_ALL,
+                                       NULL, NULL, NULL,
+                                       "taler-twister",
+                                       "taler-twister",
+                                       "-H", mos->path,
+                                       "--value", mos->value,
+                                       "-c", mos->config_filename,
+                                       NULL);
+  if (NULL == mos->proc)
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (is);
+    return;
+  }
+  TALER_TESTING_wait_for_sigchld (is);
+}
+
+
 /**
  * Create a "delete object" CMD.  This command deletes
  * the JSON object pointed by @a path.
@@ -1020,4 +1053,39 @@ TALER_TESTING_cmd_modify_object_ul (const char *label,
 }
 
 
+/**
+ * Create a "modify header" CMD.  This command instructs
+ * the twister to modify a header in the next HTTP response.
+ *
+ * @param label command label
+ * @param config_filename configuration filename.
+ * @param header name of the header to modify.
+ * @param value value to set the header to.
+ * @return the command
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_modify_header_dl (const char *label,
+                                    const char *config_filename,
+                                    const char *path,
+                                    const char *value)
+{
+  struct ModifyObjectState *mos;
+
+  mos = GNUNET_new (struct ModifyObjectState);
+  mos->path = path;
+  mos->value = value;
+  mos->config_filename = config_filename;
+
+  struct TALER_TESTING_Command cmd = {
+    .label = label,
+    .run = &modify_header_dl_run,
+    .cleanup = &modify_object_cleanup,
+    .traits = &modify_object_traits,
+    .cls = mos
+  };
+
+  return cmd;
+}
+
+
 /* end of testing_api_cmd_exec_client.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]