[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: use type instead of method/name
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: use type instead of method/name |
Date: |
Wed, 24 Feb 2021 22:43:54 +0100 |
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 010613e use type instead of method/name
010613e is described below
commit 010613ea54eb57647ff1ca7ea6260b782c8371c9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Feb 24 22:43:52 2021 +0100
use type instead of method/name
---
src/backend/anastasis-httpd_truth_upload.c | 14 +++----
src/cli/resources/04-backup.json | 8 ++--
.../test_anastasis_reducer_add_authentication.sh | 6 +--
src/reducer/anastasis_api_backup_redux.c | 46 +++++++++++-----------
src/restclient/anastasis_api_truth_store.c | 9 +----
src/testing/testing_api_cmd_truth_store.c | 5 ++-
6 files changed, 41 insertions(+), 47 deletions(-)
diff --git a/src/backend/anastasis-httpd_truth_upload.c
b/src/backend/anastasis-httpd_truth_upload.c
index 371c922..6b38c39 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -426,13 +426,13 @@ AH_handler_truth_post (
void *encrypted_truth;
size_t encrypted_truth_size;
const char *truth_mime;
- const char *method;
+ const char *type;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("keyshare_data",
&keyshare_data),
- GNUNET_JSON_spec_string ("method",
- &method),
+ GNUNET_JSON_spec_string ("type",
+ &type),
GNUNET_JSON_spec_varsize ("encrypted_truth",
&encrypted_truth,
&encrypted_truth_size),
@@ -548,9 +548,9 @@ AH_handler_truth_post (
struct TALER_Amount dummy;
if ( (0 != strcmp ("question",
- method)) &&
+ type)) &&
(NULL ==
- ANASTASIS_authorization_plugin_load (method,
+ ANASTASIS_authorization_plugin_load (type,
AH_cfg,
&dummy)) )
{
@@ -558,7 +558,7 @@ AH_handler_truth_post (
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_ANASTASIS_TRUTH_UPLOAD_METHOD_NOT_SUPPORTED,
- method);
+ type);
}
}
@@ -568,7 +568,7 @@ AH_handler_truth_post (
truth_mime,
encrypted_truth,
encrypted_truth_size,
- method,
+ type,
AH_truth_expiration);
json_decref (json);
GNUNET_JSON_parse_free (spec);
diff --git a/src/cli/resources/04-backup.json b/src/cli/resources/04-backup.json
index 63bc50f..404580c 100644
--- a/src/cli/resources/04-backup.json
+++ b/src/cli/resources/04-backup.json
@@ -156,19 +156,19 @@
},
"authentication_methods": [
{
- "method": "question",
+ "type": "question",
"instructions": "Whats your name?",
"challenge": "Hans"
},
{
- "method": "question",
+ "type": "question",
"instructions": "Whats x your name?",
"challenge": "Hansx"
},
{
- "method": "question",
+ "type": "question",
"instructions": "Where do you live?",
"challenge": "Mars"
}
]
-}
\ No newline at end of file
+}
diff --git a/src/cli/test_anastasis_reducer_add_authentication.sh
b/src/cli/test_anastasis_reducer_add_authentication.sh
index aa51a1b..c42d352 100755
--- a/src/cli/test_anastasis_reducer_add_authentication.sh
+++ b/src/cli/test_anastasis_reducer_add_authentication.sh
@@ -49,7 +49,7 @@ echo -n "Test add authentication ..."
# First method
anastasis-reducer -a \
'{"authentication_method": {
- "method": "question",
+ "type": "question",
"instructions": "Whats your name?",
"challenge": "Hans"
} }' \
@@ -71,7 +71,7 @@ echo -n "."
# Second method
anastasis-reducer -a \
'{"authentication_method": {
- "method": "question",
+ "type": "question",
"instructions": "How old are you?",
"challenge": "123"
}}' \
@@ -94,7 +94,7 @@ echo -n "."
# Third method
anastasis-reducer -a \
'{"authentication_method": {
- "method": "question",
+ "type": "question",
"instructions": "Where do you live?",
"challenge": "Mars"
}}' \
diff --git a/src/reducer/anastasis_api_backup_redux.c
b/src/reducer/anastasis_api_backup_redux.c
index 1b7f9e6..dc84b0e 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -143,13 +143,13 @@ add_authentication (json_t *state,
return NULL;
}
method_type = json_string_value (json_object_get (method,
- "method"));
+ "type"));
if (NULL == method_type)
{
ANASTASIS_redux_fail_ (cb,
cb_cls,
TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
- "'method' field must be a valid string");
+ "'type' field must be a valid string");
return NULL;
}
if (! json_object_get (method,
@@ -182,13 +182,13 @@ add_authentication (json_t *state,
}
json_array_foreach (methods, index, method)
{
- const char *name;
+ const char *type;
- name = json_string_value (json_object_get (method,
+ type = json_string_value (json_object_get (method,
"type"));
- GNUNET_break (NULL != name);
- if ( (NULL != name) &&
- (0 == strcmp (name,
+ GNUNET_break (NULL != type);
+ if ( (NULL != type) &&
+ (0 == strcmp (type,
method_type)) )
{
found = true;
@@ -410,8 +410,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
{
const json_t *method_obj = json_array_get (pb->methods,
pb->m_idx[i]);
- const char *method_name = json_string_value (json_object_get (method_obj,
- "method"));
+ const char *method_type = json_string_value (json_object_get (method_obj,
+ "type"));
const json_t *provider_cfg = json_object_get (pb->providers,
prov_sel[i]);
json_t *provider_methods = json_object_get (provider_cfg,
@@ -428,11 +428,11 @@ eval_provider_selection (struct PolicyBuilder *pb,
}
json_array_foreach (provider_methods, index, md)
{
- const char *name;
+ const char *type;
struct TALER_Amount method_cost;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_string ("name",
- &name),
+ GNUNET_JSON_spec_string ("type",
+ &type),
TALER_JSON_spec_amount ("usage_fee",
&method_cost),
GNUNET_JSON_spec_end ()
@@ -447,8 +447,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
pb->hint = "'methods' of provider";
return;
}
- if (0 == strcmp (name,
- method_name))
+ if (0 == strcmp (type,
+ method_type))
{
if ( (GNUNET_YES !=
TALER_amount_cmp_currency (&curr_cost,
@@ -925,7 +925,7 @@ add_policy (json_t *state,
return NULL;
}
method_type = json_string_value (json_object_get (auth_method,
- "method"));
+ "type"));
if (NULL == method_type)
{
json_decref (methods);
@@ -944,10 +944,10 @@ add_policy (json_t *state,
json_array_foreach (prov_methods, index, pm)
{
struct TALER_Amount method_cost;
- const char *name;
+ const char *type;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_string ("name",
- &name),
+ GNUNET_JSON_spec_string ("type",
+ &type),
TALER_JSON_spec_amount ("usage_fee",
&method_cost),
GNUNET_JSON_spec_end ()
@@ -965,7 +965,7 @@ add_policy (json_t *state,
"provider authentication method
specification invalid");
return NULL;
}
- if (0 != strcmp (name,
+ if (0 != strcmp (type,
method_type))
continue;
if (0 >
@@ -1861,15 +1861,15 @@ check_truth_upload (struct UploadContext *uc,
/* need new upload */
{
struct TruthUpload *tue = GNUNET_new (struct TruthUpload);
- const char *method;
+ const char *type;
const char *payment_request = NULL;
const char *mime_type = NULL;
const char *instructions = NULL;
void *truth_data;
size_t truth_data_size;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_string ("method",
- &method),
+ GNUNET_JSON_spec_string ("type",
+ &type),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("mime_type",
&mime_type)),
@@ -1914,7 +1914,7 @@ check_truth_upload (struct UploadContext *uc,
tue->tu = ANASTASIS_truth_upload (ANASTASIS_REDUX_ctx_,
&id,
provider_url,
- method,
+ type,
instructions,
mime_type,
&salt,
diff --git a/src/restclient/anastasis_api_truth_store.c
b/src/restclient/anastasis_api_truth_store.c
index 977c1c9..84af415 100644
--- a/src/restclient/anastasis_api_truth_store.c
+++ b/src/restclient/anastasis_api_truth_store.c
@@ -101,25 +101,20 @@ handle_truth_store_finished (void *cls,
{
struct ANASTASIS_TruthStoreOperation *tso = cls;
struct ANASTASIS_UploadDetails ud;
- struct ANASTASIS_UploadDetails *udp;
tso->job = NULL;
- udp = NULL;
memset (&ud, 0, sizeof (ud));
ud.http_status = response_code;
ud.ec = TALER_EC_NONE;
-
switch (response_code)
{
case 0:
break;
case MHD_HTTP_NO_CONTENT:
ud.us = ANASTASIS_US_SUCCESS;
- udp = &ud;
break;
case MHD_HTTP_NOT_MODIFIED:
ud.us = ANASTASIS_US_SUCCESS;
- udp = &ud;
break;
case MHD_HTTP_BAD_REQUEST:
GNUNET_break (0);
@@ -155,11 +150,9 @@ handle_truth_store_finished (void *cls,
}
ud.us = ANASTASIS_US_PAYMENT_REQUIRED;
ud.details.payment.payment_request = tso->pay_uri;
- udp = &ud;
break;
case MHD_HTTP_CONFLICT:
ud.us = ANASTASIS_US_CONFLICTING_TRUTH;
- udp = &ud;
break;
case MHD_HTTP_LENGTH_REQUIRED:
GNUNET_break (0);
@@ -176,7 +169,7 @@ handle_truth_store_finished (void *cls,
break;
}
tso->cb (tso->cb_cls,
- udp);
+ &ud);
tso->cb = NULL;
ANASTASIS_truth_store_cancel (tso);
}
diff --git a/src/testing/testing_api_cmd_truth_store.c
b/src/testing/testing_api_cmd_truth_store.c
index bc3297a..121619a 100644
--- a/src/testing/testing_api_cmd_truth_store.c
+++ b/src/testing/testing_api_cmd_truth_store.c
@@ -131,11 +131,12 @@ truth_store_cb (void *cls,
struct TruthStoreState *tss = cls;
tss->tso = NULL;
- if (ud->http_status != tss->http_status)
+ if ( (NULL == ud) ||
+ (ud->http_status != tss->http_status) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u to command %s in %s:%u\n",
- ud->http_status,
+ (NULL != ud) ? ud->http_status : 0,
tss->is->commands[tss->is->ip].label,
__FILE__,
__LINE__);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: use type instead of method/name,
gnunet <=