gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: add TOTP key and method validati


From: gnunet
Subject: [taler-merchant] branch master updated: add TOTP key and method validation, allow strings to be specified in the TOTP method, bump protocol to v7
Date: Thu, 01 Feb 2024 23:20:22 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new a867291e add TOTP key and method validation, allow strings to be 
specified in the TOTP method, bump protocol to v7
a867291e is described below

commit a867291ea863948c604ebeeb1f6ffd3e684bb75b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Feb 1 23:20:18 2024 +0100

    add TOTP key and method validation, allow strings to be specified in the 
TOTP method, bump protocol to v7
---
 configure.ac                                                | 13 +++++++++++++
 src/backend/taler-merchant-httpd_config.c                   |  2 +-
 .../taler-merchant-httpd_private-patch-otp-devices-ID.c     |  9 +++------
 src/backend/taler-merchant-httpd_private-post-otp-devices.c |  8 +++-----
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2c0cb654..a0dc66bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,6 +241,7 @@ AS_CASE([$with_exchange],
         [no], [AC_MSG_ERROR([--with-exchange is required])],
         [LDFLAGS="-L$with_exchange/lib $LDFLAGS"
          CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
+
 AC_CHECK_HEADERS([taler/taler_util.h],
  [AC_CHECK_LIB([talerutil], [TALER_denom_ewv_copy], libtalerutil=1)])
 AM_CONDITIONAL(HAVE_TALERUTIL, test x$libtalerutil = x1)
@@ -252,6 +253,18 @@ AS_IF([test $libtalerutil != 1],
 ***   https://taler.net
 *** ]])])
 
+libtalerjson=0
+AC_CHECK_HEADERS([taler/taler_json_lib.h],
+ [AC_CHECK_LIB([talerjson], [TALER_JSON_spec_otp_type], libtalerjson=1)])
+AM_CONDITIONAL(HAVE_TALERJSON, test x$libtalerjson = x1)
+AS_IF([test $libtalerjson != 1],
+  [AC_MSG_ERROR([[
+***
+*** You need libtalerjson >= 0.9.4 to build this program.
+*** This library is part of the GNU Taler exchange, available at
+***   https://taler.net
+*** ]])])
+
 
 # Check for Taler's libtalerpq
 
diff --git a/src/backend/taler-merchant-httpd_config.c 
b/src/backend/taler-merchant-httpd_config.c
index 87278116..b4906787 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -42,7 +42,7 @@
  * #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in
  * merchant_api_config.c!
  */
-#define MERCHANT_PROTOCOL_VERSION "6:1:2"
+#define MERCHANT_PROTOCOL_VERSION "7:0:3"
 
 
 /**
diff --git a/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c 
b/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c
index aff85d8f..cb784b8d 100644
--- a/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c
@@ -37,17 +37,16 @@ TMH_private_patch_otp_devices_ID (const struct 
TMH_RequestHandler *rh,
   const char *device_id = hc->infix;
   struct TALER_MERCHANTDB_OtpDeviceDetails tp = {0};
   enum GNUNET_DB_QueryStatus qs;
-  uint32_t otp_algorithm;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_string ("otp_device_description",
                              (const char **) &tp.otp_description),
-    GNUNET_JSON_spec_uint32 ("otp_algorithm",
-                             &otp_algorithm),
+    TALER_JSON_spec_otp_type ("otp_algorithm",
+                              &tp.otp_algorithm),
     GNUNET_JSON_spec_mark_optional (
       GNUNET_JSON_spec_uint64 ("otp_ctr",
                                &tp.otp_ctr),
       NULL),
-    GNUNET_JSON_spec_string ("otp_key",
+    TALER_JSON_spec_otp_key ("otp_key",
                              (const char **) &tp.otp_key),
     GNUNET_JSON_spec_end ()
   };
@@ -66,8 +65,6 @@ TMH_private_patch_otp_devices_ID (const struct 
TMH_RequestHandler *rh,
              : MHD_NO;
   }
 
-  tp.otp_algorithm = (enum TALER_MerchantConfirmationAlgorithm) otp_algorithm;
-
   qs = TMH_db->update_otp (TMH_db->cls,
                            mi->settings.id,
                            device_id,
diff --git a/src/backend/taler-merchant-httpd_private-post-otp-devices.c 
b/src/backend/taler-merchant-httpd_private-post-otp-devices.c
index 5521ce97..ff70fb58 100644
--- a/src/backend/taler-merchant-httpd_private-post-otp-devices.c
+++ b/src/backend/taler-merchant-httpd_private-post-otp-devices.c
@@ -63,19 +63,18 @@ TMH_private_post_otp_devices (const struct 
TMH_RequestHandler *rh,
   struct TALER_MERCHANTDB_OtpDeviceDetails tp = { 0 };
   const char *device_id;
   enum GNUNET_DB_QueryStatus qs;
-  uint32_t otp_algorithm;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_string ("otp_device_id",
                              &device_id),
     GNUNET_JSON_spec_string ("otp_device_description",
                              (const char **) &tp.otp_description),
-    GNUNET_JSON_spec_uint32 ("otp_algorithm",
-                             &otp_algorithm),
+    TALER_JSON_spec_otp_type ("otp_algorithm",
+                              &tp.otp_algorithm),
     GNUNET_JSON_spec_mark_optional (
       GNUNET_JSON_spec_uint64 ("otp_ctr",
                                &tp.otp_ctr),
       NULL),
-    GNUNET_JSON_spec_string ("otp_key",
+    TALER_JSON_spec_otp_key ("otp_key",
                              (const char **) &tp.otp_key),
     GNUNET_JSON_spec_end ()
   };
@@ -95,7 +94,6 @@ TMH_private_post_otp_devices (const struct TMH_RequestHandler 
*rh,
              : MHD_NO;
     }
   }
-  tp.otp_algorithm = (enum TALER_MerchantConfirmationAlgorithm) otp_algorithm;
 
   /* finally, interact with DB until no serialization error */
   for (unsigned int i = 0; i<MAX_RETRIES; i++)

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