[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 08/08: fix db, fix reducer
From: |
gnunet |
Subject: |
[taler-anastasis] 08/08: fix db, fix reducer |
Date: |
Fri, 06 Nov 2020 18:06:33 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit eb4a3aa9025eae264345cf2207f8eec3d1193330
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Fri Nov 6 18:06:16 2020 +0100
fix db, fix reducer
---
src/include/anastasis_redux.h | 1 +
src/lib/Makefile.am | 1 +
src/lib/anastasis_api_backup_redux.c | 122 ++++++++++++++---------------
src/lib/anastasis_api_config.c | 1 +
src/lib/anastasis_api_redux.c | 18 ++---
src/stasis/plugin_anastasis_postgres.c | 2 +-
src/stasis/test_anastasis_db_postgres.conf | 2 +-
7 files changed, 73 insertions(+), 74 deletions(-)
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index de3985f..d7e8050 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -25,6 +25,7 @@
#include <jansson.h>
#include <gnunet/gnunet_util_lib.h>
+#include <taler/taler_mhd_lib.h>
#include "anastasis_error_codes.h"
#include "anastasis_service.h"
#include "anastasis.h"
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index bab381d..eabe66a 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -111,6 +111,7 @@ libanastasisredux_la_LIBADD = \
-lgnunetjson \
-lgnunetcurl \
-lgnunetutil \
+ -ltalermhd \
-ltalerutil \
-ltalerjson \
-lanastasisrest \
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index 5449bae..54c7d28 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -253,7 +253,7 @@ add_authentication (json_t *state,
ANASTASIS_ActionCallback cb,
void *cb_cls)
{
- json_t *auth_providers = json_object_get (arguments,
+ json_t *auth_providers = json_object_get (state,
"authentication_providers");
GNUNET_assert (NULL != auth_providers);
@@ -1123,68 +1123,67 @@ enter_secret (json_t *state,
json_object_set (state,
"core_secret",
arguments));
- {
- // upload truths
- size_t truth_index;
- json_t *truth;
- json_t *truths = initialize_truths (state);
-
- GNUNET_assert (json_is_array (truths));
- json_array_foreach (truths, truth_index, truth)
- {
- struct TruthUploadState *tus = GNUNET_new (struct TruthUploadState);
- struct ANASTASIS_CRYPTO_PowSalt backend_salt;
- struct ANASTASIS_CRYPTO_UserIdentifierP user_id;
- const char *backend_url = json_string_value (json_object_get (truth,
-
"backend_url"));
-
- tus->method = json_string_value (json_object_get (truth,
- "method"));
- tus->instructions = json_string_value (json_object_get (truth,
- "instructions"));
- tus->mime_type = json_string_value (json_object_get (truth,
- "mime_type"));
- const char *salt_str = json_string_value (json_object_get (truth,
-
"backen_salt"));
- GNUNET_STRINGS_string_to_data (salt_str,
- strlen (salt_str),
- &backend_salt,
- sizeof (struct ANASTASIS_CRYPTO_PowSalt));
-
- tus->id_data = json_object_get (state,
- "identity_attributes");
-
- if (0 == strcmp ("question", tus->method))
- {
- json_t *truth_data = json_object_get (truth,
- "truth_data");
- // FIXME: hash secure question or salt into truth_data?
- tus->truth_data = json_string_value (json_object_get (truth_data,
- "answer"));
- tus->truth_data_size = strlen (tus->truth_data);
- }
- // FIXME: other method types
-
- ANASTASIS_CRYPTO_user_identifier_derive (tus->id_data,
- &backend_salt,
- &user_id);
- tus->tuo = ANASTASIS_truth_upload (ctx,
- &user_id,
- backend_url,
- tus->method,
- tus->mime_type,
- &backend_salt,
- tus->truth_data,
- tus->truth_data_size,
- &truth_payment_cb,
- tus->tpc_cls,
- &truth_upload_cb,
- tus);
- }
- }
+ // {
+ // // upload truths
+ // size_t truth_index;
+ // json_t *truth;
+ // json_t *truths = initialize_truths (state);
+
+ // GNUNET_assert (json_is_array (truths));
+ // json_array_foreach (truths, truth_index, truth)
+ // {
+ // struct TruthUploadState *tus = GNUNET_new (struct TruthUploadState);
+ // struct ANASTASIS_CRYPTO_PowSalt backend_salt;
+ // struct ANASTASIS_CRYPTO_UserIdentifierP user_id;
+ // const char *backend_url = json_string_value (json_object_get (truth,
+ //
"backend_url"));
+
+ // tus->method = json_string_value (json_object_get (truth,
+ // "method"));
+ // tus->instructions = json_string_value (json_object_get (truth,
+ //
"instructions"));
+ // tus->mime_type = json_string_value (json_object_get (truth,
+ // "mime_type"));
+ // const char *salt_str = json_string_value (json_object_get (truth,
+ //
"backen_salt"));
+ // GNUNET_STRINGS_string_to_data (salt_str,
+ // strlen (salt_str),
+ // &backend_salt,
+ // sizeof (struct
ANASTASIS_CRYPTO_PowSalt));
+
+ // tus->id_data = json_object_get (state,
+ // "identity_attributes");
+
+ // if (0 == strcmp ("question", tus->method))
+ // {
+ // json_t *truth_data = json_object_get (truth,
+ // "truth_data");
+ // // FIXME: hash secure question or salt into truth_data?
+ // tus->truth_data = json_string_value (json_object_get (truth_data,
+ // "answer"));
+ // tus->truth_data_size = strlen (tus->truth_data);
+ // }
+ // // FIXME: other method types
+
+ // ANASTASIS_CRYPTO_user_identifier_derive (tus->id_data,
+ // &backend_salt,
+ // &user_id);
+ // tus->tuo = ANASTASIS_truth_upload (ctx,
+ // &user_id,
+ // backend_url,
+ // tus->method,
+ // tus->mime_type,
+ // &backend_salt,
+ // tus->truth_data,
+ // tus->truth_data_size,
+ // &truth_payment_cb,
+ // tus->tpc_cls,
+ // &truth_upload_cb,
+ // tus);
+ // }
+ // }
// try uploading recovery document
- /*
set_state (state,
ANASTASIS_backup_state_to_string (
ANASTASIS_BACKUP_STATE_POLICIES_PAYING));
@@ -1192,7 +1191,6 @@ enter_secret (json_t *state,
cb (cb_cls,
ANASTASIS_EC_NONE,
state);
- */
return NULL;
}
diff --git a/src/lib/anastasis_api_config.c b/src/lib/anastasis_api_config.c
index 1f65ab3..5c66868 100644
--- a/src/lib/anastasis_api_config.c
+++ b/src/lib/anastasis_api_config.c
@@ -141,6 +141,7 @@ handle_config_finished (void *cls,
&co->insurance,
&co->salt
);
+ json_decref (co->methods);
GNUNET_JSON_parse_free (spec);
ANASTASIS_config_cancel (co);
return;
diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 007420d..1959ae5 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -197,6 +197,9 @@ free_config_request (struct ConfigRequest *cr)
if (NULL != cr->tt)
GNUNET_SCHEDULER_cancel (cr->tt);
GNUNET_free (cr->backend_currency);
+ GNUNET_free (cr->backend_url);
+ GNUNET_free (cr->backend_id);
+ GNUNET_free (cr->backend_name);
json_decref (cr->backend_methods);
GNUNET_free (cr);
}
@@ -748,14 +751,14 @@ select_country (json_t *state,
{
char *path;
- path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
if (NULL == path)
{
GNUNET_break (0);
return NULL;
}
GNUNET_asprintf (&dn,
- "%s/share/anastasis/provider-list.json",
+ "%s/provider-list.json",
path);
GNUNET_free (path);
}
@@ -772,6 +775,7 @@ select_country (json_t *state,
GNUNET_free (dn);
return NULL;
}
+ GNUNET_free (dn);
// get configs from providers
{
@@ -794,14 +798,7 @@ select_country (json_t *state,
"provider_name"));
const char *provider_id = json_string_value (json_object_get (provider,
"provider_id"));
- const char *provider_salt_str =
- json_string_value (json_object_get (provider,
- "provider_salt"));
-
- GNUNET_STRINGS_string_to_data (provider_salt_str,
- strlen (provider_salt_str),
- &cr->backend_salt,
- sizeof (cr->backend_salt));
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Url is: %s\n", url);
cr->backend_url = GNUNET_strdup (url);
@@ -826,6 +823,7 @@ select_country (json_t *state,
cr);
}
}
+ json_decref (provider_list);
conclude_select_country (sch);
{
struct ANASTASIS_ReduxAction *ra;
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index f9f4eed..edec66f 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -2096,7 +2096,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
",expiration"
") VALUES "
"($1, $2, $3, $4, $5, $6);",
- 7),
+ 6),
GNUNET_PQ_make_prepare ("recovery_document_insert",
"INSERT INTO anastasis_recoverydocument "
"(user_id"
diff --git a/src/stasis/test_anastasis_db_postgres.conf
b/src/stasis/test_anastasis_db_postgres.conf
index 8971a62..a1e3d88 100644
--- a/src/stasis/test_anastasis_db_postgres.conf
+++ b/src/stasis/test_anastasis_db_postgres.conf
@@ -1,6 +1,6 @@
[anastasis]
#The DB plugin to use
-DB = postgres
+DB = anastasischeck
[taler]
CURRENCY = EUR
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (f7e2529 -> eb4a3aa), gnunet, 2020/11/06
- [taler-anastasis] 02/08: description, gnunet, 2020/11/06
- [taler-anastasis] 04/08: reducer - worked on payment/upload, gnunet, 2020/11/06
- [taler-anastasis] 01/08: add insurance to config, gnunet, 2020/11/06
- [taler-anastasis] 06/08: work on truth upload, gnunet, 2020/11/06
- [taler-anastasis] 05/08: initialize truths, gnunet, 2020/11/06
- [taler-anastasis] 07/08: Merge branch 'master' of ssh://git.taler.net/anastasis, gnunet, 2020/11/06
- [taler-anastasis] 08/08: fix db, fix reducer,
gnunet <=
- [taler-anastasis] 03/08: reducer - better error handling, gnunet, 2020/11/06