[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated (a1490e9 -> 265b244)
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated (a1490e9 -> 265b244) |
Date: |
Fri, 20 Nov 2020 14:36:00 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a change to branch master
in repository anastasis.
from a1490e9 payment backend and errors
new fe36c52 fix order id generation
new 1a5d3df fix anastasis API test
new 265b244 merge
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/backend/anastasis-httpd.c | 14 +++----
src/backend/anastasis-httpd_policy_upload.c | 46 ++++++++++++++++------
src/cli/test_anastasis_reducer.conf | 6 +++
src/cli/test_anastasis_reducer_1.conf | 6 +++
src/cli/test_anastasis_reducer_2.conf | 6 +++
src/cli/test_anastasis_reducer_3.conf | 6 +++
src/cli/test_reducer.sh | 10 +++--
...stasis_reducer.conf => test_reducerEUWWNI.conf} | 0
src/lib/anastasis.c | 11 ++++--
src/lib/testing_api_cmd_policy_store.c | 3 +-
src/lib/testing_cmd_secret_share.c | 11 ++++--
src/stasis/plugin_anastasis_postgres.c | 9 ++---
12 files changed, 91 insertions(+), 37 deletions(-)
copy src/cli/{test_anastasis_reducer.conf => test_reducerEUWWNI.conf} (100%)
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index c866bb7..c665a77 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -771,14 +771,12 @@ main (int argc,
GNUNET_OS_init (ANASTASIS_project_data_default ());
fprintf (stderr, "Here with PID %d, project is %s\n", (int) getpid (),
GNUNET_OS_project_data_get ()->project_dirname);
- if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc, argv,
- "anastasis-httpd",
- "Anastasis HTTP interface",
- options, &run, NULL))
-
- if (GNUNET_SYSERR == res)
- return 3;
+ res = GNUNET_PROGRAM_run (argc, argv,
+ "anastasis-httpd",
+ "Anastasis HTTP interface",
+ options, &run, NULL);
+ if (GNUNET_SYSERR == res)
+ return 3;
if (GNUNET_NO == res)
return 0;
return (GNUNET_OK == result) ? 0 : 1;
diff --git a/src/backend/anastasis-httpd_policy_upload.c
b/src/backend/anastasis-httpd_policy_upload.c
index 0b64415..7be4a87 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -416,22 +416,29 @@ check_payment_cb (void *cls,
MHD_resume_connection (puc->con);
AH_trigger_daemon ();
- if (osr->status)
+ switch (osr->status)
{
- enum ANASTASIS_DB_QueryStatus qs;
+ case TALER_MERCHANT_OSC_PAID:
+ {
+
+ enum ANASTASIS_DB_QueryStatus qs;
- qs = db->increment_lifetime (db->cls,
- &puc->account,
- &puc->payment_identifier,
- GNUNET_TIME_UNIT_YEARS); /* FIXME: always
annual ?*/
- if (0 <= qs)
+ qs = db->increment_lifetime (db->cls,
+ &puc->account,
+ &puc->payment_identifier,
+ GNUNET_TIME_UNIT_YEARS); /* FIXME: always
annual ?*/
+ if (0 <= qs)
+ return; /* continue as planned */
+ GNUNET_break (0);
+ puc->resp = TALER_MHD_make_error (
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "increment lifetime");
+ puc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
return; /* continue as planned */
- GNUNET_break (0);
- puc->resp = TALER_MHD_make_error (
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "increment lifetime");
- puc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- return; /* continue as planned */
+ }
+ case TALER_MERCHANT_OSC_UNPAID:
+ case TALER_MERCHANT_OSC_CLAIMED:
+ break;
}
if (NULL != puc->existing_order_id)
{
@@ -862,6 +869,19 @@ AH_handler_policy_post (struct MHD_Connection *connection,
if ((qs >= 0) && (! paid || ! valid_counter))
{
+ if (qs == 0)
+ {
+ // generate new payment identifier
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &puc->payment_identifier,
+ sizeof (
+ struct ANASTASIS_PaymentSecretP));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d Payment-Identifier generated is: %s\n",
+ __FILE__,
+ __LINE__,
+ TALER_B2S (&puc->payment_identifier));
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %s:%d paid is: '%d' and valid_counter is '%d'\n",
__FILE__,
diff --git a/src/cli/test_anastasis_reducer.conf
b/src/cli/test_anastasis_reducer.conf
index ca7a6e9..e95b3cd 100644
--- a/src/cli/test_anastasis_reducer.conf
+++ b/src/cli/test_anastasis_reducer.conf
@@ -56,6 +56,12 @@ SUPPORTED_METHODS = question
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
+# Server salt 16 Byte
+SERVER_SALT = AUfO1KGOKYIFlFQg
+
# This specifies which database the postgres backend uses.
[anastasisdb-postgres]
CONFIG = postgres:///anastasischeck
diff --git a/src/cli/test_anastasis_reducer_1.conf
b/src/cli/test_anastasis_reducer_1.conf
index 30fba38..502da6b 100644
--- a/src/cli/test_anastasis_reducer_1.conf
+++ b/src/cli/test_anastasis_reducer_1.conf
@@ -51,11 +51,17 @@ QUESTION_COST = TESTKUDOS:0
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
# Upload limit
UPLOAD_LIMIT_MB = 1
SUPPORTED_METHODS = question
+# Server salt 16 Byte
+SERVER_SALT = BUfO1KGOKYIFlFQg
+
# This specifies which database the postgres backend uses.
[anastasisdb-postgres]
CONFIG = postgres:///anastasischeck
diff --git a/src/cli/test_anastasis_reducer_2.conf
b/src/cli/test_anastasis_reducer_2.conf
index 173fd4b..e6de4d9 100644
--- a/src/cli/test_anastasis_reducer_2.conf
+++ b/src/cli/test_anastasis_reducer_2.conf
@@ -51,11 +51,17 @@ QUESTION_COST = TESTKUDOS:0
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
# Upload limit
UPLOAD_LIMIT_MB = 1
SUPPORTED_METHODS = question
+# Server salt 16 Byte
+SERVER_SALT = CUfO1KGOKYIFlFQg
+
# This specifies which database the postgres backend uses.
[anastasisdb-postgres]
CONFIG = postgres:///anastasischeck
diff --git a/src/cli/test_anastasis_reducer_3.conf
b/src/cli/test_anastasis_reducer_3.conf
index 9a82d0c..b74f5f0 100644
--- a/src/cli/test_anastasis_reducer_3.conf
+++ b/src/cli/test_anastasis_reducer_3.conf
@@ -51,6 +51,12 @@ QUESTION_COST = TESTKUDOS:0
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
+# Server salt 16 Byte
+SERVER_SALT = DUfO1KGOKYIFlFQg
+
# Upload limit
UPLOAD_LIMIT_MB = 1
diff --git a/src/cli/test_reducer.sh b/src/cli/test_reducer.sh
index b5e42c7..2f680a4 100755
--- a/src/cli/test_reducer.sh
+++ b/src/cli/test_reducer.sh
@@ -39,17 +39,21 @@ jq -h > /dev/null || exit_skip "jq required"
echo " FOUND"
echo -n "Testing for taler"
-taler-exchange-httpd -h > /dev/null || exit_skip "taler-exchange required"
-taler-merchant-httpd -h > /dev/null || exit_skip "taler-merchant required"
+taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange required"
+taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant required"
echo " FOUND"
echo -n "Testing for taler-bank-manage"
-taler-bank-manage -h >/dev/null </dev/null || exit_skip " MISSING"
+taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
echo -n "Testing for taler-wallet-cli"
taler-wallet-cli -v >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
+echo -n "Testing for anastasis-httpd "
+anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
+echo " FOUND"
+
diff --git a/src/cli/test_anastasis_reducer.conf
b/src/cli/test_reducerEUWWNI.conf
similarity index 100%
copy from src/cli/test_anastasis_reducer.conf
copy to src/cli/test_reducerEUWWNI.conf
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 8805364..f107fb0 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1531,6 +1531,7 @@ policy_store_cb (void *cls,
So if you hit this, you might just want to modify
the code here to handle this better! */
+ GNUNET_break (0);
return;
}
pss->payment_order_id = GNUNET_strdup (&m[strlen ("/-/-/")]);
@@ -1550,8 +1551,9 @@ policy_store_cb (void *cls,
ec);
pss->ss->spc = NULL;
}
- ANASTASIS_secret_share_cancel (pss->ss);
- policy_store_cleanup (pss);
+ // FIXME: Wrong place for cleanup!
+ // ANASTASIS_secret_share_cancel (pss->ss);
+ // policy_store_cleanup (pss);
}
return;
case ANASTASIS_US_CONFLICTING_POLICY:
@@ -1578,8 +1580,9 @@ policy_store_cb (void *cls,
http_status);
pss->ss->src = NULL;
}
- ANASTASIS_secret_share_cancel (pss->ss);
- policy_store_cleanup (pss);
+ // FIXME: Wrong place for cleanup!
+ // ANASTASIS_secret_share_cancel (pss->ss);
+ // policy_store_cleanup (pss);
}
}
diff --git a/src/lib/testing_api_cmd_policy_store.c
b/src/lib/testing_api_cmd_policy_store.c
index 3750d20..0b3216b 100644
--- a/src/lib/testing_api_cmd_policy_store.c
+++ b/src/lib/testing_api_cmd_policy_store.c
@@ -207,7 +207,8 @@ policy_store_cb (void *cls,
the above token must appear in the payment request!
So if you hit this, you might just want to modify
- the code here to handle this better! */return;
+ the code here to handle this better! */
+ return;
}
pss->payment_order_id = GNUNET_strdup (&m[strlen ("/-/-/")]);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/lib/testing_cmd_secret_share.c
b/src/lib/testing_cmd_secret_share.c
index c63b83b..8e1edb4 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -135,6 +135,10 @@ secret_share_payment_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"At %s:%d we are in SPC\n",
__FILE__, __LINE__);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "At %s:%d the taler pay url is %s\n",
+ __FILE__, __LINE__,
+ taler_pay_url);
if (sss->http_status != MHD_HTTP_PAYMENT_REQUIRED)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -156,7 +160,7 @@ secret_share_payment_cb (void *cls,
"Did not find `%s' in `%s'\n",
"/-/-/",
taler_pay_url);
- GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (sss->is);
return;
}
m = strstr (taler_pay_url, "/-/-/");
@@ -166,6 +170,7 @@ secret_share_payment_cb (void *cls,
"Did not find `%s' in `%s'\n",
"/-/-/",
taler_pay_url);
+ TALER_TESTING_interpreter_fail (sss->is);
/* NOTE: The above is a simplifying assumption for the
test-logic, hitting this code merely means that
the assumptions for the test (i.e. no instance) are
@@ -173,7 +178,8 @@ secret_share_payment_cb (void *cls,
the above token must appear in the payment request!
So if you hit this, you might just want to modify
- the code here to handle this better! */return;
+ the code here to handle this better! */
+ return;
}
sss->payment_order_id = GNUNET_strdup (&m[strlen ("/-/-/")]);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -233,7 +239,6 @@ secret_share_result_cb (void *cls,
return;
}
TALER_TESTING_interpreter_fail (sss->is);
- return;
}
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index 0805267..09a98d9 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -362,12 +362,12 @@ payment_by_account_cb (void *cls,
struct PaymentIteratorContext *pic = cls;
for (unsigned int i = 0; i < num_results; i++)
{
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Absolute creation_date;
struct ANASTASIS_PaymentSecretP payment_identifier;
struct TALER_Amount amount;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_absolute_time ("creation_date",
- ×tamp),
+ &creation_date),
GNUNET_PQ_result_spec_auto_from_type ("payment_identifier",
&payment_identifier),
TALER_PQ_result_spec_amount ("amount",
@@ -391,7 +391,7 @@ payment_by_account_cb (void *cls,
ANASTASIS_PaymentSecretP));
pic->qs = i + 1;
pic->it (pic->it_cls,
- timestamp,
+ creation_date,
order_id,
&amount);
GNUNET_PQ_cleanup_result (rs);
@@ -1978,7 +1978,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
",creation_date"
") VALUES "
"($1, $2, $3, $4, $5, $6);",
- 4),
+ 6),
GNUNET_PQ_make_prepare ("challenge_payment_insert",
"INSERT INTO anastasis_challenge_payment "
"(truth_public_key"
@@ -2193,7 +2193,6 @@ libanastasis_plugin_db_postgres_init (void *cls)
"AND expiration_date > $2 "
"AND retry_counter > 0;",
2),
-
GNUNET_PQ_make_prepare ("challengecode_update_retry",
"UPDATE anastasis_challengecode "
"SET "
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (a1490e9 -> 265b244),
gnunet <=