summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-instances.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-instances.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c
index c8f443cd..97b096d6 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -101,15 +101,15 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
{
struct TALER_MERCHANTDB_InstanceSettings is;
struct TALER_MERCHANTDB_InstanceAuthSettings ias;
- json_t *accounts;
+ const json_t *accounts;
const char *auth_token = NULL;
const char *uts = "business";
struct TMH_WireMethod *wm_head = NULL;
struct TMH_WireMethod *wm_tail = NULL;
- json_t *jauth;
+ const json_t *jauth;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("accounts",
- &accounts),
+ GNUNET_JSON_spec_array_const ("accounts",
+ &accounts),
GNUNET_JSON_spec_string ("id",
(const char **) &is.id),
GNUNET_JSON_spec_string ("name",
@@ -130,8 +130,8 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
GNUNET_JSON_spec_string ("logo",
(const char **) &is.logo),
NULL),
- GNUNET_JSON_spec_json ("auth",
- &jauth),
+ GNUNET_JSON_spec_object_const ("auth",
+ &jauth),
GNUNET_JSON_spec_json ("address",
&is.address),
GNUNET_JSON_spec_json ("jurisdiction",
@@ -169,7 +169,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
&is.ut))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -222,7 +221,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
if (! TMH_location_object_valid (is.address))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -232,7 +230,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
if (! TMH_location_object_valid (is.jurisdiction))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -243,7 +240,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
(! TMH_image_data_url_valid (is.logo)) )
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -259,7 +255,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
{
if (mi->deleted)
{
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_CONFLICT,
TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED,
@@ -317,7 +312,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
(accounts_equal (mi,
accounts)) )
{
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_static (connection,
MHD_HTTP_NO_CONTENT,
NULL,
@@ -326,7 +320,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
}
else
{
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_CONFLICT,
TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS,
@@ -344,7 +337,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
json_t *account = json_array_get (accounts,
i);
const char *credit_facade_url = NULL;
- json_t *credit_facade_credentials = NULL;
+ const json_t *credit_facade_credentials = NULL;
const char *uri;
struct TMH_WireMethod *wm;
struct GNUNET_JSON_Specification ispec[] = {
@@ -355,8 +348,8 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
&credit_facade_url),
NULL),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("credit_facade_credentials",
- &credit_facade_credentials),
+ GNUNET_JSON_spec_object_const ("credit_facade_credentials",
+ &credit_facade_credentials),
NULL),
GNUNET_JSON_spec_end ()
};
@@ -376,7 +369,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
GNUNET_CONTAINER_DLL_insert (wm_head,
wm_tail,
wm);
- GNUNET_JSON_parse_free (ispec);
}
}
@@ -428,7 +420,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
TMH_db->start (TMH_db->cls,
"post /instances"))
{
- GNUNET_JSON_parse_free (spec);
mi->rc = 1;
TMH_instance_decref (mi);
return TALER_MHD_reply_with_error (connection,
@@ -452,7 +443,6 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
MHD_HTTP_CONFLICT,
TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS,
is.id);
- GNUNET_JSON_parse_free (spec);
mi->rc = 1;
TMH_instance_decref (mi);
return ret;
@@ -504,7 +494,6 @@ retry:
} /* for .. MAX_RETRIES */
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
- GNUNET_JSON_parse_free (spec);
mi->rc = 1;
TMH_instance_decref (mi);
return TALER_MHD_reply_with_error (connection,
@@ -517,7 +506,6 @@ retry:
TMH_add_instance (mi));
TMH_reload_instances (mi->settings.id);
}
- GNUNET_JSON_parse_free (spec);
if (0 == strcmp (is.id,
"default"))
{