gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -proper conflict on /register fo


From: gnunet
Subject: [taler-exchange] branch master updated: -proper conflict on /register for existing account with different pw
Date: Thu, 25 Aug 2022 19:43:18 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 83225275 -proper conflict on /register for existing account with 
different pw
83225275 is described below

commit 83225275361a92390f92245e0edb04e1c675dc91
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Aug 25 19:43:16 2022 +0200

    -proper conflict on /register for existing account with different pw
---
 contrib/gana            |  2 +-
 src/bank-lib/fakebank.c | 53 +++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 2e264e28..a8ec467f 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 2e264e2856ee1f490d894a64d36bd4eac71802eb
+Subproject commit a8ec467f79aab32f671c146ca9cffb812920e1a2
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index bde51b6a..0a18c521 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -239,6 +239,11 @@ struct Account
    */
   char *payto_uri;
 
+  /**
+   * Password set for the account (if any).
+   */
+  char *password;
+
   /**
    * Current account balance.
    */
@@ -1415,6 +1420,7 @@ free_account (void *cls,
   GNUNET_free (account->account_name);
   GNUNET_free (account->receiver_name);
   GNUNET_free (account->payto_uri);
+  GNUNET_free (account->password);
   GNUNET_free (account);
   return GNUNET_OK;
 }
@@ -2826,6 +2832,20 @@ do_post_withdrawal (struct TALER_FAKEBANK_Handle *h,
   credit_account = lookup_account (h,
                                    credit_name,
                                    NULL);
+  if (NULL == credit_account)
+  {
+    MHD_RESULT res;
+
+    GNUNET_break_op (0);
+    GNUNET_assert (0 ==
+                   pthread_mutex_unlock (&h->big_lock));
+    res = TALER_MHD_reply_with_error (connection,
+                                      MHD_HTTP_NOT_FOUND,
+                                      TALER_EC_BANK_UNKNOWN_ACCOUNT,
+                                      credit_name);
+    GNUNET_free (credit_name);
+    return res;
+  }
   GNUNET_free (credit_name);
   if ( (NULL != wo->exchange_account) &&
        (credit_account != wo->exchange_account) )
@@ -3381,6 +3401,7 @@ post_testing_register (struct TALER_FAKEBANK_Handle *h,
       GNUNET_JSON_spec_end ()
     };
     enum GNUNET_GenericReturnValue ret;
+    struct Account *acc;
 
     if (GNUNET_OK !=
         (ret = TALER_MHD_parse_json_data (connection,
@@ -3391,12 +3412,32 @@ post_testing_register (struct TALER_FAKEBANK_Handle *h,
       json_decref (json);
       return (GNUNET_NO == ret) ? MHD_YES : MHD_NO;
     }
-    (void) lookup_account (h,
-                           username,
-                           username);
-    return TALER_MHD_reply_json (connection,
-                                 json_object (), /* FIXME: #7301 */
-                                 MHD_HTTP_OK);
+    acc = lookup_account (h,
+                          username,
+                          NULL);
+    if (NULL != acc)
+    {
+      if (0 != strcmp (password,
+                       acc->password))
+      {
+        return TALER_MHD_reply_with_error (connection,
+                                           MHD_HTTP_CONFLICT,
+                                           TALER_EC_BANK_REGISTER_CONFLICT,
+                                           "password");
+      }
+    }
+    else
+    {
+      acc = lookup_account (h,
+                            username,
+                            username);
+      acc->password = GNUNET_strdup (password);
+    }
+    return TALER_MHD_reply_static (connection,
+                                   MHD_HTTP_NO_CONTENT,
+                                   NULL,
+                                   NULL,
+                                   0);
   }
   json_decref (json);
   return res;

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