gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (b46735f -> 80a7fe9)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (b46735f -> 80a7fe9)
Date: Wed, 13 Sep 2017 14:36:33 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from b46735f  add argument to TALER_EXCHANGE_check_keys_current() to allow 
forcing the download
     new 7123015  create tables in taler-auditor-sign instead of failing 
obscurely
     new e243a89  style fix
     new 80a7fe9  add logic to signal exchange to reload keys

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/auditor/taler-auditor-sign.c                   | 26 +++++--
 src/exchange-lib/test_exchange_api.c               |  8 ++-
 src/exchange-lib/test_exchange_api.conf            |  3 +
 .../test_exchange_api_keys_cherry_picking.c        | 80 +++++++++++++++++++++-
 src/exchange/taler-exchange-httpd.c                |  3 +-
 5 files changed, 107 insertions(+), 13 deletions(-)

diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c
index 5494cd2..3fa1d76 100644
--- a/src/auditor/taler-auditor-sign.c
+++ b/src/auditor/taler-auditor-sign.c
@@ -196,8 +196,9 @@ main (int argc,
                          argc, argv) < 0)
     return 1;
   cfg = GNUNET_CONFIGURATION_create ();
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg,
-                                                  cfgfile))
+  if (GNUNET_SYSERR ==
+      GNUNET_CONFIGURATION_load (cfg,
+                                 cfgfile))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _("Malformed configuration file `%s', exit ...\n"),
@@ -283,7 +284,7 @@ main (int argc,
              "Denomination list has length zero, signature not produced.\n");
     GNUNET_DISK_file_close (fh);
     GNUNET_free (eddsa_priv);
-    return 2;  
+    return 2;
   }
   if (NULL ==
       (adb = TALER_AUDITORDB_plugin_load (cfg)))
@@ -294,7 +295,7 @@ main (int argc,
     GNUNET_free (eddsa_priv);
     return 3;
   }
-  
+
   kv.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS);
   kv.purpose.size = htonl (sizeof (struct TALER_ExchangeKeyValidityPS));
   GNUNET_CRYPTO_hash (auditor_url,
@@ -355,6 +356,21 @@ main (int argc,
     GNUNET_free (eddsa_priv);
     return 1;
   }
+
+  /* Create required tables */
+  if (GNUNET_OK !=
+      adb->create_tables (adb->cls))
+  {
+    fprintf (stderr,
+             "Failed to create tables in auditor's database\n");
+    TALER_AUDITORDB_plugin_unload (adb);
+    GNUNET_free (dks);
+    GNUNET_free (sigs);
+    GNUNET_free (eddsa_priv);
+    return 3;
+  }
+
+
   /* Update DB */
   {
     enum GNUNET_DB_QueryStatus qs;
@@ -389,7 +405,7 @@ main (int argc,
        return 3;
       }
     }
-  }  
+  }
   TALER_AUDITORDB_plugin_unload (adb);
 
   /* write result to disk */
diff --git a/src/exchange-lib/test_exchange_api.c 
b/src/exchange-lib/test_exchange_api.c
index b5b6804..4c0a49e 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -3773,9 +3773,11 @@ main (int argc,
   GNUNET_SIGNAL_handler_uninstall (shc_chld);
   shc_chld = NULL;
   GNUNET_DISK_pipe_close (sigpipe);
-  GNUNET_OS_process_kill (exchanged,
-                          SIGTERM);
-  GNUNET_OS_process_wait (exchanged);
+  GNUNET_break (0 ==
+                GNUNET_OS_process_kill (exchanged,
+                                        SIGTERM));
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_OS_process_wait (exchanged));
   GNUNET_OS_process_destroy (exchanged);
   return (GNUNET_OK == result) ? 0 : 1;
 }
diff --git a/src/exchange-lib/test_exchange_api.conf 
b/src/exchange-lib/test_exchange_api.conf
index a8543bc..6539928 100644
--- a/src/exchange-lib/test_exchange_api.conf
+++ b/src/exchange-lib/test_exchange_api.conf
@@ -26,6 +26,9 @@ BASE_URL = "https://exchange.com/";
 [exchangedb-postgres]
 DB_CONN_STR = "postgres:///talercheck"
 
+[auditordb-postgres]
+DB_CONN_STR = "postgres:///talercheck"
+
 [exchange-wire-sepa]
 # Enable 'sepa' to test SEPA-specific routines.
 ENABLE = YES
diff --git a/src/exchange-lib/test_exchange_api_keys_cherry_picking.c 
b/src/exchange-lib/test_exchange_api_keys_cherry_picking.c
index 02e62a3..9f77170 100644
--- a/src/exchange-lib/test_exchange_api_keys_cherry_picking.c
+++ b/src/exchange-lib/test_exchange_api_keys_cherry_picking.c
@@ -138,6 +138,13 @@ struct Command
        */
       unsigned int num_denom_keys;
 
+      /**
+       * Which generation of /keys are we verifying here?
+       * Used to make sure we got the right number of
+       * interactions.
+       */
+      unsigned int generation;
+
     } check_keys;
 
   } details;
@@ -171,6 +178,17 @@ struct InterpreterState
    */
   unsigned int ip;
 
+  /**
+   * Is the interpreter running (#GNUNET_YES) or waiting
+   * for /keys (#GNUNET_NO)?
+   */
+  int working;
+
+  /**
+   * How often have we gotten a /keys response so far?
+   */
+  unsigned int key_generation;
+
 };
 
 
@@ -305,6 +323,48 @@ interpreter_run (void *cls)
                                           is);
       return;
     }
+  case OC_SIGNAL_EXCHANGE:
+    {
+      GNUNET_break (0 ==
+                    GNUNET_OS_process_kill (exchanged,
+                                            SIGUSR1));
+      /* give exchange time to process the signal */
+      sleep (1);
+      next_command (is);
+      return;
+    }
+  case OC_CHECK_KEYS:
+    {
+      if (is->key_generation < cmd->details.check_keys.generation)
+      {
+        /* Go back to waiting for /keys signal! */
+        is->working = GNUNET_NO;
+        GNUNET_break (0 ==
+                      TALER_EXCHANGE_check_keys_current (exchange,
+                                                         
GNUNET_YES).abs_value_us);
+        return;
+      }
+      if (is->key_generation > cmd->details.check_keys.generation)
+      {
+        /* We got /keys too often, strange. Fatal. May theoretically happen if
+           somehow we were really unlucky and /keys expired "naturally", but
+           obviously with a sane configuration this should also not be. */
+        GNUNET_break (0);
+        fail (is);
+        return;
+      }
+      /* /keys was updated, let's check they were OK! */
+      if (cmd->details.check_keys.num_denom_keys !=
+          is->keys->num_denom_keys)
+      {
+        /* Did not get the expected number of denomination keys! */
+        GNUNET_break (0);
+        fail (is);
+        return;
+      }
+      next_command (is);
+      return;
+    }
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unknown instruction %d at %u (%s)\n",
@@ -388,6 +448,12 @@ do_shutdown (void *cls)
         cmd->details.run_process.child_death_task = NULL;
       }
       break;
+    case OC_SIGNAL_EXCHANGE:
+      /* nothing to do */
+      break;
+    case OC_CHECK_KEYS:
+      /* nothing to do */
+      break;
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Unknown instruction %d at %u (%s)\n",
@@ -457,6 +523,10 @@ cert_cb (void *cls,
 
   /* run actual tests via interpreter-loop */
   is->keys = keys;
+  if (GNUNET_YES == is->working)
+    return;
+  is->working = GNUNET_YES;
+  is->key_generation++;
   is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
                                        is);
 }
@@ -473,6 +543,8 @@ run (void *cls)
   struct InterpreterState *is;
   static struct Command commands[] =
   {
+    /* Test signal handling by itself */
+    { .oc = OC_SIGNAL_EXCHANGE },
     { .oc = OC_END }
   };
 
@@ -677,9 +749,11 @@ main (int argc,
   GNUNET_SIGNAL_handler_uninstall (shc_chld);
   shc_chld = NULL;
   GNUNET_DISK_pipe_close (sigpipe);
-  GNUNET_OS_process_kill (exchanged,
-                          SIGTERM);
-  GNUNET_OS_process_wait (exchanged);
+  GNUNET_break (0 ==
+                GNUNET_OS_process_kill (exchanged,
+                                        SIGTERM));
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_OS_process_wait (exchanged));
   GNUNET_OS_process_destroy (exchanged);
   return (GNUNET_OK == result) ? 0 : 1;
 }
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 1a4d286..25021f3 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -316,12 +316,11 @@ handle_mhd_request (void *cls,
       &TEH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
     };
   struct TEH_RequestHandler *rh;
-  unsigned int i;
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Handling request for URL '%s'\n",
               url);
-  for (i=0;NULL != handlers[i].url;i++)
+  for (unsigned int i=0;NULL != handlers[i].url;i++)
   {
     rh = &handlers[i];
     if ( (0 == strcasecmp (url,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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