gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: implement version check


From: gnunet
Subject: [taler-anastasis] branch master updated: implement version check
Date: Sat, 13 Mar 2021 23:02:30 +0100

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new f5597bc  implement version check
f5597bc is described below

commit f5597bcd05153e8b1c4727a6dcd844ef10fbab0e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Mar 13 23:02:27 2021 +0100

    implement version check
---
 .../anastasis_authorization_plugin_email.c         |  4 +-
 .../anastasis_authorization_plugin_file.c          |  3 +-
 .../anastasis_authorization_plugin_post.c          |  4 +-
 .../anastasis_authorization_plugin_sms.c           |  4 +-
 src/backend/anastasis-httpd_truth.c                |  4 +-
 src/lib/anastasis_recovery.c                       |  2 +-
 src/reducer/anastasis_api_backup_redux.c           |  1 -
 src/reducer/anastasis_api_recovery_redux.c         |  2 +-
 src/restclient/anastasis_api_config.c              | 62 +++++++++++++++++++---
 9 files changed, 67 insertions(+), 19 deletions(-)

diff --git a/src/authorization/anastasis_authorization_plugin_email.c 
b/src/authorization/anastasis_authorization_plugin_email.c
index 679fee9..d7174e2 100644
--- a/src/authorization/anastasis_authorization_plugin_email.c
+++ b/src/authorization/anastasis_authorization_plugin_email.c
@@ -367,8 +367,8 @@ email_process (struct ANASTASIS_AUTHORIZATION_State *as,
     const char *at;
     size_t len;
 
-    /* FIXME: i18n based on language preferences of the client */
-    /* FIXME: Reply in JSON if requested by client */
+    /* FIXME #6749: i18n based on language preferences of the client */
+    /* FIXME #6754: Reply in JSON if requested by client */
     at = strchr (as->email, '@');
     if (NULL == at)
       len = 0;
diff --git a/src/authorization/anastasis_authorization_plugin_file.c 
b/src/authorization/anastasis_authorization_plugin_file.c
index a9fe607..8951537 100644
--- a/src/authorization/anastasis_authorization_plugin_file.c
+++ b/src/authorization/anastasis_authorization_plugin_file.c
@@ -195,7 +195,8 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
     char *response;
     MHD_RESULT mres;
 
-    /* FIXME: internationalization, mention UUID, etc. */
+    /* FIXME #6749: i18n based on language preferences of the client */
+    /* FIXME #6754: Reply in JSON if requested by client */
     response_size = GNUNET_asprintf (&response,
                                      "Challenge written to file");
     resp = MHD_create_response_from_buffer (response_size,
diff --git a/src/authorization/anastasis_authorization_plugin_post.c 
b/src/authorization/anastasis_authorization_plugin_post.c
index f926402..d5e8147 100644
--- a/src/authorization/anastasis_authorization_plugin_post.c
+++ b/src/authorization/anastasis_authorization_plugin_post.c
@@ -442,8 +442,8 @@ post_process (struct ANASTASIS_AUTHORIZATION_State *as,
     size_t reply_len;
     char *reply;
 
-    /* FIXME: i18n based on language preferences of the client */
-    /* FIXME: Reply in JSON if requested by client */
+    /* FIXME #6749: i18n based on language preferences of the client */
+    /* FIXME #6754: Reply in JSON if requested by client */
     reply_len = GNUNET_asprintf (&reply,
                                  "Recovery message zip code %s",
                                  zip);
diff --git a/src/authorization/anastasis_authorization_plugin_sms.c 
b/src/authorization/anastasis_authorization_plugin_sms.c
index 98a58e0..ba4750a 100644
--- a/src/authorization/anastasis_authorization_plugin_sms.c
+++ b/src/authorization/anastasis_authorization_plugin_sms.c
@@ -366,8 +366,8 @@ sms_process (struct ANASTASIS_AUTHORIZATION_State *as,
     const char *end;
     size_t slen;
 
-    /* FIXME: i18n based on language preferences of the client */
-    /* FIXME: Reply in JSON if requested by client */
+    /* FIXME #6749: i18n based on language preferences of the client */
+    /* FIXME #6754: Reply in JSON if requested by client */
     slen = strlen (as->phone_number);
     if (slen > 4)
       end = &as->phone_number[slen - 4];
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index b02ac0c..c50d5b9 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -771,7 +771,7 @@ AH_handler_truth_get (
         return MHD_YES;
       case ANASTASIS_AUTHORIZATION_RES_FAILED:
         /* Challenge transmission failed, our fault! */
-        // FIXME: give at least a refund!?
+        // FIXME #6750: give at least a refund!?
         gc->authorization->cleanup (gc->as);
         gc->as = NULL;
         return MHD_YES;
@@ -1143,7 +1143,7 @@ AH_handler_truth_get (
       break;
     case ANASTASIS_AUTHORIZATION_RES_FAILED:
       /* sending challenge failed */
-      // FIXME: give at least a refund!?
+      // FIXME #6750: give at least a refund!?
       break;
     case ANASTASIS_AUTHORIZATION_RES_SUSPENDED:
       /* we have been suspended, see you later */
diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c
index a504a97..87b2153 100644
--- a/src/lib/anastasis_recovery.c
+++ b/src/lib/anastasis_recovery.c
@@ -567,7 +567,7 @@ policy_lookup_cb (void *cls,
                 http_status,
                 __FILE__,
                 __LINE__);
-    // FIXME: should differenciate by @a http_status here!
+    // FIXME #6764: should differenciate by @a http_status here!
     r->csc (r->csc_cls,
             ANASTASIS_RS_POLICY_DOWNLOAD_FAILED,
             NULL,
diff --git a/src/reducer/anastasis_api_backup_redux.c 
b/src/reducer/anastasis_api_backup_redux.c
index 5545365..7da288a 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -773,7 +773,6 @@ done_authentication (json_t *state,
  * @param cb callback to call during/after operation
  * @param cb_cls callback closure
  */
-// FIXME: deduplicate with logic in anastasis_api_redux.c!
 static struct ANASTASIS_ReduxAction *
 add_provider (json_t *state,
               const json_t *arguments,
diff --git a/src/reducer/anastasis_api_recovery_redux.c 
b/src/reducer/anastasis_api_recovery_redux.c
index 934afa6..f10566b 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -1581,7 +1581,7 @@ core_early_secret_cb (void *cls,
   if (NULL != rss->pd_head)
     return;   /* wait for another one */
   /* all failed! report failure! */
-  /* FIXME: return 'rc' to application more nicely */
+  /* FIXME #6764: return 'rc' to application more nicely */
   set_state (rss->state,
              ANASTASIS_GENERIC_STATE_ERROR);
 
diff --git a/src/restclient/anastasis_api_config.c 
b/src/restclient/anastasis_api_config.c
index be7272b..17721a4 100644
--- a/src/restclient/anastasis_api_config.c
+++ b/src/restclient/anastasis_api_config.c
@@ -29,6 +29,18 @@
 #include <taler/taler_json_lib.h>
 
 
+/**
+ * Which version of the Taler protocol is implemented
+ * by this library?  Used to determine compatibility.
+ */
+#define ANASTASIS_PROTOCOL_CURRENT 0
+
+/**
+ * How many versions are we backwards compatible with?
+ */
+#define ANASTASIS_PROTOCOL_AGE 0
+
+
 struct ANASTASIS_ConfigOperation
 {
   /**
@@ -122,6 +134,47 @@ handle_config_finished (void *cls,
         GNUNET_break_op (0);
         break;
       }
+      if (0 != strcmp (name,
+                       "anastasis"))
+      {
+        GNUNET_JSON_parse_free (spec);
+        break;
+      }
+      {
+        unsigned int age;
+        unsigned int revision;
+        unsigned int current;
+        char dummy;
+
+        if (3 != sscanf (acfg.version,
+                         "%u:%u:%u%c",
+                         &current,
+                         &revision,
+                         &age,
+                         &dummy))
+        {
+          GNUNET_break_op (0);
+          GNUNET_JSON_parse_free (spec);
+          break;
+        }
+        if ( (ANASTASIS_PROTOCOL_CURRENT < current) &&
+             (ANASTASIS_PROTOCOL_CURRENT < current - age) )
+        {
+          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                      "Provider protocol version too new\n");
+          GNUNET_JSON_parse_free (spec);
+          break;
+        }
+        if ( (ANASTASIS_PROTOCOL_CURRENT > current) &&
+             (ANASTASIS_PROTOCOL_CURRENT - ANASTASIS_PROTOCOL_AGE > current) )
+        {
+          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                      "Provider protocol version too old\n");
+          GNUNET_break_op (0);
+          GNUNET_JSON_parse_free (spec);
+          break;
+        }
+      }
       if ( (GNUNET_OK !=
             TALER_amount_cmp_currency (&acfg.liability_limit,
                                        &acfg.annual_fee)) ||
@@ -129,16 +182,11 @@ handle_config_finished (void *cls,
             strcasecmp (acfg.currency,
                         acfg.annual_fee.currency)) )
       {
+        GNUNET_break_op (0);
         GNUNET_JSON_parse_free (spec);
         break;
       }
-      if (0 != strcmp (name,
-                       "anastasis"))
-      {
-        GNUNET_JSON_parse_free (spec);
-        break;
-      }
-      /* FIXME: implement protocol version check here eventually */
+
       if (! json_is_array (methods))
       {
         GNUNET_break_op (0);

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