summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-05 17:16:04 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-05 17:16:04 +0200
commit71f889186973ef26e8ae684ec47fd570138bc4e5 (patch)
tree02898d03575384c26b5399d28d702d97f4683403 /src
parent452aa5391b75ab6637b62398f9b0627593570d5d (diff)
downloadanastasis-71f889186973ef26e8ae684ec47fd570138bc4e5.tar.gz
anastasis-71f889186973ef26e8ae684ec47fd570138bc4e5.tar.bz2
anastasis-71f889186973ef26e8ae684ec47fd570138bc4e5.zip
adapt to latest GNUnet API: GNUNET_JSON_spec_mark_optional() changed
Diffstat (limited to 'src')
-rw-r--r--src/backend/anastasis-httpd_truth-challenge.c15
-rw-r--r--src/backend/anastasis-httpd_truth-solve.c13
-rw-r--r--src/backend/anastasis-httpd_truth-upload.c3
-rw-r--r--src/lib/anastasis_backup.c3
-rw-r--r--src/lib/anastasis_recovery.c26
-rw-r--r--src/reducer/anastasis_api_backup_redux.c81
-rw-r--r--src/reducer/anastasis_api_discovery.c6
-rw-r--r--src/reducer/anastasis_api_recovery_redux.c9
-rw-r--r--src/reducer/anastasis_api_redux.c27
-rw-r--r--src/restclient/anastasis_api_policy_meta_lookup.c3
-rw-r--r--src/restclient/anastasis_api_truth_challenge.c9
11 files changed, 117 insertions, 78 deletions
diff --git a/src/backend/anastasis-httpd_truth-challenge.c b/src/backend/anastasis-httpd_truth-challenge.c
index 3a3688e..b03c883 100644
--- a/src/backend/anastasis-httpd_truth-challenge.c
+++ b/src/backend/anastasis-httpd_truth-challenge.c
@@ -156,9 +156,9 @@ struct ChallengeContext
unsigned int response_code;
/**
- * true if client provided a payment secret / order ID?
+ * true if client did not provide a payment secret / order ID.
*/
- bool payment_identifier_provided;
+ bool no_payment_identifier_provided;
/**
* True if this entry is in the #gc_head DLL.
@@ -921,7 +921,7 @@ run_authorization_process (struct MHD_Connection *connection,
gc->as = NULL;
return MHD_YES;
case ANASTASIS_AUTHORIZATION_CRES_FAILED:
- if (gc->payment_identifier_provided)
+ if (! gc->no_payment_identifier_provided)
{
begin_refund (gc);
}
@@ -1042,7 +1042,8 @@ AH_handler_truth_challenge (
&gc->truth_key),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("payment_secret",
- &gc->payment_identifier)),
+ &gc->payment_identifier),
+ &gc->no_payment_identifier_provided),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
@@ -1060,9 +1061,7 @@ AH_handler_truth_challenge (
GNUNET_break_op (0);
return MHD_YES; /* failure */
}
- gc->payment_identifier_provided
- = ! GNUNET_is_zero (&gc->payment_identifier);
- if (gc->payment_identifier_provided)
+ if (! gc->no_payment_identifier_provided)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Client provided payment identifier `%s'\n",
TALER_B2S (&gc->payment_identifier));
@@ -1156,7 +1155,7 @@ AH_handler_truth_challenge (
enum GNUNET_DB_QueryStatus qs;
bool paid;
- if (! gc->payment_identifier_provided)
+ if (gc->no_payment_identifier_provided)
{
GNUNET_free (truth_mime);
GNUNET_free (encrypted_truth);
diff --git a/src/backend/anastasis-httpd_truth-solve.c b/src/backend/anastasis-httpd_truth-solve.c
index 9142ad2..5e72e42 100644
--- a/src/backend/anastasis-httpd_truth-solve.c
+++ b/src/backend/anastasis-httpd_truth-solve.c
@@ -156,9 +156,9 @@ struct SolveContext
unsigned int response_code;
/**
- * true if client provided a payment secret / order ID?
+ * true if client did not provide a payment secret / order ID.
*/
- bool payment_identifier_provided;
+ bool no_payment_identifier_provided;
/**
* True if this entry is in the #gc_head DLL.
@@ -1158,7 +1158,8 @@ AH_handler_truth_solve (
&gc->challenge_response),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("payment_secret",
- &gc->payment_identifier)),
+ &gc->payment_identifier),
+ &gc->no_payment_identifier_provided),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
@@ -1176,9 +1177,7 @@ AH_handler_truth_solve (
GNUNET_break_op (0);
return MHD_YES; /* failure */
}
- gc->payment_identifier_provided
- = ! GNUNET_is_zero (&gc->payment_identifier);
- if (gc->payment_identifier_provided)
+ if (! gc->no_payment_identifier_provided)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Client provided payment identifier `%s'\n",
TALER_B2S (&gc->payment_identifier));
@@ -1256,7 +1255,7 @@ AH_handler_truth_solve (
enum GNUNET_DB_QueryStatus qs;
bool paid;
- if (! gc->payment_identifier_provided)
+ if (gc->no_payment_identifier_provided)
{
GNUNET_free (truth_mime);
GNUNET_free (encrypted_truth);
diff --git a/src/backend/anastasis-httpd_truth-upload.c b/src/backend/anastasis-httpd_truth-upload.c
index b87ccf0..642f523 100644
--- a/src/backend/anastasis-httpd_truth-upload.c
+++ b/src/backend/anastasis-httpd_truth-upload.c
@@ -538,7 +538,8 @@ AH_handler_truth_post (
&encrypted_truth_size),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("truth_mime",
- &truth_mime)),
+ &truth_mime),
+ NULL),
GNUNET_JSON_spec_uint32 ("storage_duration_years",
&storage_years),
GNUNET_JSON_spec_end ()
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c
index 0cb60dc..466dbe8 100644
--- a/src/lib/anastasis_backup.c
+++ b/src/lib/anastasis_backup.c
@@ -97,7 +97,8 @@ ANASTASIS_truth_from_json (const json_t *json)
&instructions),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("mime_type",
- &mime_type)),
+ &mime_type),
+ NULL),
GNUNET_JSON_spec_fixed_auto ("uuid",
&t->uuid),
GNUNET_JSON_spec_fixed_auto ("nonce",
diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c
index a450392..b70061d 100644
--- a/src/lib/anastasis_recovery.c
+++ b/src/lib/anastasis_recovery.c
@@ -758,7 +758,8 @@ policy_lookup_cb (void *cls,
&esc_methods),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("secret_name",
- &secret_name)),
+ &secret_name),
+ NULL),
GNUNET_JSON_spec_varsize ("encrypted_core_secret",
&r->enc_core_secret,
&r->enc_core_secret_size),
@@ -1145,6 +1146,7 @@ parse_cs_array (struct ANASTASIS_Recovery *r,
const char *instructions;
const char *url;
const char *escrow_type;
+ bool no_key_share;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("uuid",
&c->ci.uuid),
@@ -1162,10 +1164,12 @@ parse_cs_array (struct ANASTASIS_Recovery *r,
&escrow_type),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("async",
- &c->ci.async)),
+ &c->ci.async),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("key_share",
- &c->key_share)),
+ &c->key_share),
+ &no_key_share),
GNUNET_JSON_spec_end ()
};
@@ -1185,17 +1189,10 @@ parse_cs_array (struct ANASTASIS_Recovery *r,
c->instructions = GNUNET_strdup (instructions);
c->ci.instructions = c->instructions;
c->ci.provider_url = c->url;
+ if (! no_key_share)
{
- json_t *ks;
-
- ks = json_object_get (cs,
- "key_share");
- if ( (NULL != ks) &&
- (! json_is_null (ks)) )
- {
- c->ci.solved = true;
- r->solved_challenges[r->solved_challenge_pos++] = c;
- }
+ c->ci.solved = true;
+ r->solved_challenges[r->solved_challenge_pos++] = c;
}
}
return GNUNET_OK;
@@ -1368,7 +1365,8 @@ ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx,
&provider_url),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("secret_name",
- &secret_name)),
+ &secret_name),
+ NULL),
GNUNET_JSON_spec_uint32 ("version",
&version),
GNUNET_JSON_spec_json ("dps",
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c
index b3ee9dd..4d14479 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -357,16 +357,20 @@ add_authentication (json_t *state,
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
- &size_limit_in_mb)),
+ &size_limit_in_mb),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("methods",
- &methods)),
+ &methods),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -1165,10 +1169,12 @@ provider_candidate (struct PolicyBuilder *pb,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -1967,10 +1973,12 @@ add_policy (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
&limit),
GNUNET_JSON_spec_json ("methods",
@@ -2447,10 +2455,12 @@ update_expiration_cost (json_t *state,
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
TALER_JSON_spec_amount_any ("annual_fee",
&annual_fee),
GNUNET_JSON_spec_end ()
@@ -2554,10 +2564,12 @@ update_expiration_cost (json_t *state,
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
TALER_JSON_spec_amount_any ("truth_upload_fee",
&upload_cost),
GNUNET_JSON_spec_end ()
@@ -2682,7 +2694,8 @@ done_policy_review (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("expiration",
- &exp)),
+ &exp),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -3137,7 +3150,8 @@ share_secret (struct UploadContext *uc)
&core_secret),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("secret_name",
- &secret_name)),
+ &secret_name),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -3159,7 +3173,8 @@ share_secret (struct UploadContext *uc)
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -3259,7 +3274,8 @@ share_secret (struct UploadContext *uc)
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("truth",
- &jtruth)),
+ &jtruth),
+ NULL),
GNUNET_JSON_spec_string ("provider",
&provider_url),
GNUNET_JSON_spec_uint32 ("authentication_method",
@@ -3362,7 +3378,8 @@ share_secret (struct UploadContext *uc)
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("payment_secret",
- &pds[i].payment_secret)),
+ &pds[i].payment_secret),
+ NULL),
GNUNET_JSON_spec_string ("provider_url",
&pds[i].provider_url),
GNUNET_JSON_spec_end ()
@@ -3609,7 +3626,8 @@ add_truth_object (struct UploadContext *uc,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("upload_status",
- &status)),
+ &status),
+ NULL),
GNUNET_JSON_spec_end ()
};
if (GNUNET_OK !=
@@ -3793,10 +3811,12 @@ check_truth_upload (struct UploadContext *uc,
&type),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("mime_type",
- &mime_type)),
+ &mime_type),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("instructions",
- &instructions)),
+ &instructions),
+ NULL),
GNUNET_JSON_spec_varsize ("challenge",
&truth_data,
&truth_data_size),
@@ -3984,7 +4004,8 @@ upload (json_t *state,
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &uc->timeout)),
+ &uc->timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -4043,7 +4064,8 @@ upload (json_t *state,
&am_idx),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("truth",
- &truth)),
+ &truth),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -4206,13 +4228,16 @@ check_upload_size_limit (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
- &limit)),
+ &limit),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -4265,7 +4290,8 @@ enter_secret (json_t *state,
&jsecret),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("expiration",
- &expiration)),
+ &expiration),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -5037,7 +5063,8 @@ ANASTASIS_REDUX_backup_begin_ (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/reducer/anastasis_api_discovery.c b/src/reducer/anastasis_api_discovery.c
index 727f00b..76731ad 100644
--- a/src/reducer/anastasis_api_discovery.c
+++ b/src/reducer/anastasis_api_discovery.c
@@ -318,7 +318,8 @@ ANASTASIS_policy_discovery_start (const json_t *state,
&name),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_boolean ("optional",
- &optional)),
+ &optional),
+ NULL),
GNUNET_JSON_spec_end ()
};
bool present;
@@ -464,7 +465,8 @@ ANASTASIS_mask_id_data (const json_t *state,
&name),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_boolean ("optional",
- &optional)),
+ &optional),
+ NULL),
GNUNET_JSON_spec_end ()
};
bool present;
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c
index 6026fc0..e08c7e7 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -1057,7 +1057,8 @@ solve_challenge_cb (void *cls,
struct GNUNET_JSON_Specification tspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
struct GNUNET_JSON_Specification pspec[] = {
@@ -1648,7 +1649,8 @@ pay_challenge (json_t *state,
struct GNUNET_JSON_Specification aspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_fixed_auto ("payment_secret",
&sctx->ps),
GNUNET_JSON_spec_end ()
@@ -1746,7 +1748,8 @@ select_challenge_cb (void *cls,
struct GNUNET_JSON_Specification tspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
struct GNUNET_JSON_Specification pspec[] = {
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c
index bcc0e77..bc2cb5e 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1254,19 +1254,22 @@ enter_user_attributes (json_t *state,
const char *attribute_value;
const char *regexp = NULL;
const char *reglog = NULL;
- int optional = false;
+ bool optional = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("name",
&name),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("validation-regex",
- &regexp)),
+ &regexp),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("validation-logic",
- &reglog)),
+ &reglog),
+ NULL),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_boolean ("optional",
- &optional)),
+ GNUNET_JSON_spec_bool ("optional",
+ &optional),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -2024,16 +2027,20 @@ ANASTASIS_reducer_lookup_salt (const json_t *state,
const json_t *cfg;
uint32_t http_status = 0;
bool disabled = false;
+ bool no_salt;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("salt",
- salt)),
+ salt),
+ &no_salt),
GNUNET_JSON_spec_end ()
};
@@ -2062,9 +2069,7 @@ ANASTASIS_reducer_lookup_salt (const json_t *state,
}
if (disabled)
return GNUNET_NO;
- if (NULL ==
- json_object_get (cfg,
- "salt"))
+ if (no_salt)
return GNUNET_NO;
return GNUNET_OK;
}
diff --git a/src/restclient/anastasis_api_policy_meta_lookup.c b/src/restclient/anastasis_api_policy_meta_lookup.c
index 8ea6436..06a959c 100644
--- a/src/restclient/anastasis_api_policy_meta_lookup.c
+++ b/src/restclient/anastasis_api_policy_meta_lookup.c
@@ -137,7 +137,8 @@ handle_policy_meta_lookup_finished (void *cls,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_varsize ("meta",
&md[off],
- &metas[off].meta_data_size)),
+ &metas[off].meta_data_size),
+ NULL),
GNUNET_JSON_spec_timestamp ("upload_time",
&metas[off].server_time),
GNUNET_JSON_spec_end ()
diff --git a/src/restclient/anastasis_api_truth_challenge.c b/src/restclient/anastasis_api_truth_challenge.c
index 911eba6..76e9ec5 100644
--- a/src/restclient/anastasis_api_truth_challenge.c
+++ b/src/restclient/anastasis_api_truth_challenge.c
@@ -131,13 +131,16 @@ handle_truth_challenge_finished (void *cls,
&ct),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("tan_address_hint",
- &tan_hint)),
+ &tan_hint),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("filename",
- &filename)),
+ &filename),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("wire_details",
- &wire_details)),
+ &wire_details),
+ NULL),
GNUNET_JSON_spec_end ()
};