[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 02/05: add_authentication action
From: |
gnunet |
Subject: |
[taler-anastasis] 02/05: add_authentication action |
Date: |
Wed, 23 Sep 2020 19:04:24 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 8c1e5234a014276bd7ad44abf40147562304e155
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Mon Sep 21 08:34:05 2020 +0200
add_authentication action
---
src/lib/anastasis_api_backup_redux.c | 56 ++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index d6331d1..8297127 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -36,6 +36,11 @@ json_t *redux_countries;
*/
json_t *redux_id_attr;
+/**
+ * JSON containing anastasis providers.
+ */
+json_t *provider_list;
+
/**
* Callback function FIXME: Description.
@@ -473,7 +478,58 @@ add_authentication (const json_t *state,
ANASTASIS_ActionCallback cb,
void *cb_cls)
{
+ json_t *new_state;
+ char *dn;
+ json_error_t error;
+ {
+ char *path;
+
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ if (NULL == path)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_asprintf (&dn,
+ "%s/share/anastasis/provider-list.json",
+ path);
+ GNUNET_free (path);
+ }
+ provider_list = json_load_file (dn, JSON_COMPACT, &error);
+ if (NULL == provider_list)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to parse `%s': %s at %d:%d (%d)\n",
+ dn,
+ error.text,
+ error.line,
+ error.column,
+ error.position);
+ GNUNET_free (dn);
+ return GNUNET_SYSERR;
+ }
+ new_state = json_deep_copy (state);
+ if (NULL == new_state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+
+ json_object_set (new_state,
+ "backup-state",
+ json_string ("ReduxUserAttributesAddedState"));
+
+ json_object_set_new (new_state,
+ "provider-list",
+ provider_list);
+
+ cb (cb_cls,
+ ANASTASIS_EC_NONE,
+ new_state);
+ json_decref (new_state);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.