gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (02992dd1 -> 7fd4f1d8)


From: gnunet
Subject: [taler-exchange] branch master updated (02992dd1 -> 7fd4f1d8)
Date: Sun, 08 Aug 2021 00:01:10 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from 02992dd1 debian: bump version
     new 0a0c1675 -require receiver-name in iban payto URIs
     new 7fd4f1d8 -sepa is ancient, iban is correct

The 2 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/exchangedb/test_exchangedb.c |  4 ++--
 src/json/test_json_wire.c        |  2 +-
 src/util/payto.c                 | 42 ++++++++++++++++++++++++++++++++--------
 3 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index fd11de2e..be9950b9 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -782,7 +782,7 @@ cb_wt_check (void *cls,
                                      &merchant_pub_wt));
   GNUNET_assert (0 == strcmp (json_string_value (json_object_get (wire,
                                                                   
"payto_uri")),
-                              "payto://sepa/DE67830654080004822650"));
+                              
"payto://iban/DE67830654080004822650?receiver-name=test"));
   GNUNET_assert (0 == GNUNET_memcmp (h_wire,
                                      &h_wire_wt));
   GNUNET_assert (exec_time.abs_value_us == wire_out_date.abs_value_us);
@@ -1570,7 +1570,7 @@ run (void *cls)
   deposit.coin.denom_sig.rsa_signature = NULL;
   wire = GNUNET_JSON_PACK (
     GNUNET_JSON_pack_string ("payto_uri",
-                             "payto://sepa/DE67830654080004822650"),
+                             
"payto://iban/DE67830654080004822650?receiver-name=Test"),
     GNUNET_JSON_pack_string ("salt",
                              "this-is-a-salt-value"));
   ZR_BLK (&cbc);
diff --git a/src/json/test_json_wire.c b/src/json/test_json_wire.c
index f9264c61..b417b25f 100644
--- a/src/json/test_json_wire.c
+++ b/src/json/test_json_wire.c
@@ -34,7 +34,7 @@ main (int argc,
   json_t *wire_iban;
   const char *payto_xtalerbank = "payto://x-taler-bank/42";
   const char *payto_iban =
-    "payto://iban/BIC-TO-BE-SKIPPED/DE89370400440532013000";
+    "payto://iban/BIC-TO-BE-SKIPPED/DE89370400440532013000?receiver-name=Test";
   char *p_xtalerbank;
   char *p_iban;
 
diff --git a/src/util/payto.c b/src/util/payto.c
index 7819184e..b8fd2e43 100644
--- a/src/util/payto.c
+++ b/src/util/payto.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2019-2020 Taler Systems SA
+  Copyright (C) 2019-2021 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -29,14 +29,16 @@
 
 
 /**
- * Extract the subject value from the URI parameters.
+ * Extract the value under @a key from the URI parameters.
  *
  * @param payto_uri the URL to parse
- * @return NULL if the subject parameter is not found.
+ * @param search_key key to look for, including "="
+ * @return NULL if the @a key parameter is not found.
  *         The caller should free the returned value.
  */
-char *
-TALER_payto_get_subject (const char *payto_uri)
+static char *
+payto_get_key (const char *payto_uri,
+               const char *search_key)
 {
   const char *key;
   const char *value_start;
@@ -49,8 +51,8 @@ TALER_payto_get_subject (const char *payto_uri)
 
   do {
     if (0 == strncasecmp (++key,
-                          "subject",
-                          strlen ("subject")))
+                          search_key,
+                          strlen (search_key)))
     {
       value_start = strchr (key,
                             (unsigned char) '=');
@@ -68,6 +70,21 @@ TALER_payto_get_subject (const char *payto_uri)
 }
 
 
+/**
+ * Extract the subject value from the URI parameters.
+ *
+ * @param payto_uri the URL to parse
+ * @return NULL if the subject parameter is not found.
+ *         The caller should free the returned value.
+ */
+char *
+TALER_payto_get_subject (const char *payto_uri)
+{
+  return payto_get_key (payto_uri,
+                        "subject=");
+}
+
+
 /**
  * Obtain the payment method from a @a payto_uri. The
  * format of a payto URI is 'payto://$METHOD/$SOMETHING'.
@@ -432,7 +449,7 @@ validate_iban (const char *iban)
  * Validate payto://iban/ account URL (only account information,
  * wire subject and amount are ignored).
  *
- * @param account_url URL to parse
+ * @param account_url payto URL to parse
  * @return NULL on success, otherwise an error message
  *      to be freed by the caller
  */
@@ -470,6 +487,15 @@ validate_payto_iban (const char *account_url)
     return err;
   }
   GNUNET_free (result);
+  {
+    char *target;
+
+    target = payto_get_key (account_url,
+                            "receiver-name=");
+    if (NULL == target)
+      return GNUNET_strdup ("'receiver-name' parameter missing");
+    GNUNET_free (target);
+  }
   return NULL;
 }
 

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