gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: fail if exchange-account configu


From: gnunet
Subject: [taler-exchange] branch master updated: fail if exchange-account configuration is definitively wrong (#5642)
Date: Fri, 28 Aug 2020 23:43:07 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new f486df99 fail if exchange-account configuration is definitively wrong 
(#5642)
f486df99 is described below

commit f486df99c87f4ea660a4e39fe4497c9fd2afa847
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Aug 28 23:43:05 2020 +0200

    fail if exchange-account configuration is definitively wrong (#5642)
---
 src/exchange-tools/taler-exchange-wire.c | 11 ++++++++---
 src/exchangedb/exchangedb_accounts.c     | 21 ++++++++++++++++-----
 src/include/taler_exchangedb_lib.h       |  3 ++-
 3 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/exchange-tools/taler-exchange-wire.c 
b/src/exchange-tools/taler-exchange-wire.c
index 2f6b4ad7..8aa3f570 100644
--- a/src/exchange-tools/taler-exchange-wire.c
+++ b/src/exchange-tools/taler-exchange-wire.c
@@ -169,9 +169,14 @@ run (void *cls,
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Signing /wire responses\n");
-  TALER_EXCHANGEDB_find_accounts (cfg,
-                                  &sign_account_data,
-                                  NULL);
+  if (GNUNET_OK !=
+      TALER_EXCHANGEDB_find_accounts (cfg,
+                                      &sign_account_data,
+                                      NULL))
+  {
+    global_ret = 1;
+    return;
+  }
 }
 
 
diff --git a/src/exchangedb/exchangedb_accounts.c 
b/src/exchangedb/exchangedb_accounts.c
index 986d4ae2..5b74c836 100644
--- a/src/exchangedb/exchangedb_accounts.c
+++ b/src/exchangedb/exchangedb_accounts.c
@@ -52,6 +52,11 @@ struct FindAccountContext
    * Closure for @e cb.
    */
   void *cb_cls;
+
+  /**
+   * Set to #GNUNET_SYSERR if the configuration is invalid.
+   */
+  int res;
 };
 
 
@@ -86,6 +91,7 @@ check_for_account (void *cls,
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
                                section,
                                "PAYTO_URI");
+    ctx->res = GNUNET_SYSERR;
     return;
   }
   method = TALER_payto_get_method (payto_uri);
@@ -94,6 +100,7 @@ check_for_account (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "payto URI in config ([%s]/PAYTO_URI) malformed\n",
                 section);
+    ctx->res = GNUNET_SYSERR;
     GNUNET_free (payto_uri);
     return;
   }
@@ -135,20 +142,24 @@ check_for_account (void *cls,
  * @param cfg configuration to use
  * @param cb callback to invoke
  * @param cb_cls closure for @a cb
+ * @return #GNUNET_OK if the configuration seems valid, #GNUNET_SYSERR if not
  */
-void
+int
 TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                 TALER_EXCHANGEDB_AccountCallback cb,
                                 void *cb_cls)
 {
-  struct FindAccountContext ctx;
+  struct FindAccountContext ctx = {
+    .cfg = cfg,
+    .cb = cb,
+    .cb_cls = cb_cls,
+    .res = GNUNET_OK
+  };
 
-  ctx.cfg = cfg;
-  ctx.cb = cb;
-  ctx.cb_cls = cb_cls;
   GNUNET_CONFIGURATION_iterate_sections (cfg,
                                          &check_for_account,
                                          &ctx);
+  return ctx.res;
 }
 
 
diff --git a/src/include/taler_exchangedb_lib.h 
b/src/include/taler_exchangedb_lib.h
index 33ead98b..5400330e 100644
--- a/src/include/taler_exchangedb_lib.h
+++ b/src/include/taler_exchangedb_lib.h
@@ -438,8 +438,9 @@ typedef void
  * @param cfg configuration to use
  * @param cb callback to invoke
  * @param cb_cls closure for @a cb
+ * @return #GNUNET_OK if the configuration seems valid, #GNUNET_SYSERR if not
  */
-void
+int
 TALER_EXCHANGEDB_find_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                 TALER_EXCHANGEDB_AccountCallback cb,
                                 void *cb_cls);

-- 
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]