gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: -misc bugfixes


From: gnunet
Subject: [taler-anastasis] branch master updated: -misc bugfixes
Date: Wed, 19 Jan 2022 20:59:39 +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 849abca  -misc bugfixes
849abca is described below

commit 849abca1f45619dc4e967e49a84fb9e189de3cf2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jan 19 20:59:37 2022 +0100

    -misc bugfixes
---
 src/backend/anastasis-httpd_policy-meta.c         | 26 ++++++++---------------
 src/cli/anastasis-cli-discover.c                  |  4 +++-
 src/reducer/anastasis_api_discovery.c             |  1 +
 src/restclient/anastasis_api_policy_meta_lookup.c |  4 ++++
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy-meta.c 
b/src/backend/anastasis-httpd_policy-meta.c
index 7d143ef..a62a21e 100644
--- a/src/backend/anastasis-httpd_policy-meta.c
+++ b/src/backend/anastasis-httpd_policy-meta.c
@@ -86,7 +86,7 @@ return_policy_meta (
   const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub)
 {
   enum GNUNET_DB_QueryStatus qs;
-  uint32_t max_version;
+  uint32_t max_version = INT32_MAX; /* Postgres is using signed ints... */
   json_t *result;
 
   {
@@ -109,6 +109,8 @@ return_policy_meta (
                                            
TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                            "version");
       }
+      if (max_version > INT32_MAX)
+        max_version = INT32_MAX; /* cap to signed range */
     }
   }
   result = json_object ();
@@ -156,7 +158,6 @@ AH_policy_meta_get (
 {
   struct GNUNET_HashCode recovery_data_hash;
   enum ANASTASIS_DB_AccountStatus as;
-  MHD_RESULT ret;
   uint32_t version;
   struct GNUNET_TIME_Timestamp expiration;
 
@@ -170,8 +171,8 @@ AH_policy_meta_get (
   case ANASTASIS_DB_ACCOUNT_STATUS_PAYMENT_REQUIRED:
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_NOT_FOUND,
-                                       TALER_EC_SYNC_ACCOUNT_UNKNOWN,
-                                       NULL);
+                                       TALER_EC_ANASTASIS_POLICY_NOT_FOUND,
+                                       "account expired: payment required");
   case ANASTASIS_DB_ACCOUNT_STATUS_HARD_ERROR:
     GNUNET_break (0);
     return TALER_MHD_reply_with_error (connection,
@@ -179,19 +180,10 @@ AH_policy_meta_get (
                                        TALER_EC_GENERIC_DB_FETCH_FAILED,
                                        "lookup account");
   case ANASTASIS_DB_ACCOUNT_STATUS_NO_RESULTS:
-    {
-      struct MHD_Response *resp;
-
-      resp = MHD_create_response_from_buffer (0,
-                                              NULL,
-                                              MHD_RESPMEM_PERSISTENT);
-      TALER_MHD_add_global_headers (resp);
-      ret = MHD_queue_response (connection,
-                                MHD_HTTP_NO_CONTENT,
-                                resp);
-      MHD_destroy_response (resp);
-    }
-    return ret;
+    return TALER_MHD_reply_with_error (connection,
+                                       MHD_HTTP_NOT_FOUND,
+                                       TALER_EC_ANASTASIS_POLICY_NOT_FOUND,
+                                       "no such account");
   case ANASTASIS_DB_ACCOUNT_STATUS_VALID_HASH_RETURNED:
     /* We have results, should fetch and return them! */
     break;
diff --git a/src/cli/anastasis-cli-discover.c b/src/cli/anastasis-cli-discover.c
index ee5f154..a7edcf1 100644
--- a/src/cli/anastasis-cli-discover.c
+++ b/src/cli/anastasis-cli-discover.c
@@ -96,13 +96,15 @@ print_policy_cb (void *cls,
 {
   if (NULL == hcpd)
   {
+    fprintf (stderr,
+             "All results received, terminating\n");
     pd = NULL;
     global_ret = 0;
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
   fprintf (stdout,
-           "%s %u %u - %s %s\n",
+           "%s %u %u : \"%s\" \"%s\"\n",
            provider_url,
            (unsigned int) version,
            (unsigned int) attribute_mask,
diff --git a/src/reducer/anastasis_api_discovery.c 
b/src/reducer/anastasis_api_discovery.c
index 8ae7692..0ec2a81 100644
--- a/src/reducer/anastasis_api_discovery.c
+++ b/src/reducer/anastasis_api_discovery.c
@@ -237,6 +237,7 @@ start_po (struct ANASTASIS_PolicyDiscovery *pd,
   po = GNUNET_new (struct ProviderOperation);
   po->pd = pd;
   po->attribute_mask = mask;
+  po->provider_url = GNUNET_strdup (provider_url);
   po->vc = ANASTASIS_recovery_get_versions (ANASTASIS_REDUX_ctx_,
                                             id_data,
                                             max_version,
diff --git a/src/restclient/anastasis_api_policy_meta_lookup.c 
b/src/restclient/anastasis_api_policy_meta_lookup.c
index b49d1b8..8ea6436 100644
--- a/src/restclient/anastasis_api_policy_meta_lookup.c
+++ b/src/restclient/anastasis_api_policy_meta_lookup.c
@@ -160,6 +160,7 @@ handle_policy_meta_lookup_finished (void *cls,
             break;
           }
           metas[off].version = (uint32_t) ver;
+          metas[off].meta_data = md[off];
           off++;
         }
         if (off < mlen)
@@ -200,6 +201,9 @@ handle_policy_meta_lookup_finished (void *cls,
     response_code = 0;
     break;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "HTTP status for policy meta lookup is %u\n",
+              (unsigned int) response_code);
   plo->cb (plo->cb_cls,
            response_code,
            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]