gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: properly count down retries


From: gnunet
Subject: [taler-anastasis] branch master updated: properly count down retries
Date: Sun, 04 Apr 2021 16:42:11 +0200

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 de8c84a  properly count down retries
de8c84a is described below

commit de8c84a8eb3db3f2afb2826fca27f1ea2c1ca95f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Apr 4 16:42:09 2021 +0200

    properly count down retries
---
 src/backend/anastasis-httpd_truth.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 0e8aa21..3794463 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -954,6 +954,8 @@ AH_handler_truth_get (
       enum GNUNET_DB_QueryStatus qs;
       struct GNUNET_TIME_Absolute rt;
       uint64_t code;
+      enum ANASTASIS_DB_CodeStatus cs;
+      struct GNUNET_HashCode hc;
 
       rt = GNUNET_TIME_UNIT_FOREVER_ABS;
       qs = db->create_challenge_code (db->cls,
@@ -982,6 +984,33 @@ AH_handler_truth_get (
                                            
TALER_EC_ANASTASIS_TRUTH_RATE_LIMITED,
                                            NULL);
       }
+      /* decrement trial counter */
+      ANASTASIS_hash_answer (code + 1,  /* always use wrong answer */
+                             &hc);
+      cs = db->verify_challenge_code (db->cls,
+                                      &gc->truth_uuid,
+                                      &hc);
+      switch (cs)
+      {
+      case ANASTASIS_DB_CODE_STATUS_CHALLENGE_CODE_MISMATCH:
+        /* good, what we wanted */
+        break;
+      case ANASTASIS_DB_CODE_STATUS_HARD_ERROR:
+      case ANASTASIS_DB_CODE_STATUS_SOFT_ERROR:
+        GNUNET_break (0);
+        return TALER_MHD_reply_with_error (gc->connection,
+                                           MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
+                                           "verify_challenge_code");
+      case ANASTASIS_DB_CODE_STATUS_NO_RESULTS:
+        return TALER_MHD_reply_with_error (connection,
+                                           MHD_HTTP_TOO_MANY_REQUESTS,
+                                           
TALER_EC_ANASTASIS_TRUTH_RATE_LIMITED,
+                                           NULL);
+      case ANASTASIS_DB_CODE_STATUS_VALID_CODE_STORED:
+        /* this should be impossible, we used code+1 */
+        GNUNET_assert (0);
+      }
     }
     if ( (decrypted_truth_size != sizeof (challenge_response)) ||
          (0 != memcmp (&challenge_response,

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