diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-instances.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-instances.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c index e760d8e5..58a93b27 100644 --- a/src/backend/taler-merchant-httpd_private-post-instances.c +++ b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -123,6 +123,9 @@ free_mi (struct TMH_MerchantInstance *mi) } GNUNET_free (mi->settings.id); GNUNET_free (mi->settings.name); + GNUNET_free (mi->settings.website); + GNUNET_free (mi->settings.email); + GNUNET_free (mi->settings.logo); json_decref (mi->settings.address); json_decref (mi->settings.jurisdiction); GNUNET_free (mi); @@ -156,6 +159,18 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, (const char **) &is.id), GNUNET_JSON_spec_string ("name", (const char **) &is.name), + GNUNET_JSON_spec_mark_optional( + GNUNET_JSON_spec_string ("email", + (const char **) &is.email), + NULL), + GNUNET_JSON_spec_mark_optional( + GNUNET_JSON_spec_string ("website", + (const char **) &is.website), + NULL), + GNUNET_JSON_spec_mark_optional( + GNUNET_JSON_spec_string ("logo", + (const char **) &is.logo), + NULL), GNUNET_JSON_spec_json ("auth", &jauth), GNUNET_JSON_spec_json ("address", @@ -251,6 +266,17 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, "jurisdiction"); } + if ( (NULL != is.logo) && + (! 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, + "logo"); + } + { /* Test if an instance of this id is known */ struct TMH_MerchantInstance *mi; @@ -271,6 +297,18 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, is.id)) && (0 == strcmp (mi->settings.name, is.name)) && + ((mi->settings.email == is.email) || + (NULL != is.email && NULL != mi->settings.email && + 0 == strcmp (mi->settings.email, + is.email))) && + ((mi->settings.website == is.website) || + (NULL != is.website && NULL != mi->settings.website && + 0 == strcmp (mi->settings.website, + is.website))) && + ((mi->settings.logo == is.logo) || + (NULL != is.logo && NULL != mi->settings.logo && + 0 == strcmp (mi->settings.logo, + is.logo))) && ( ( (NULL != auth_token) && (GNUNET_OK == TMH_check_auth (auth_token, @@ -370,6 +408,12 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, mi->settings.jurisdiction = json_incref (mi->settings.jurisdiction); mi->settings.id = GNUNET_strdup (is.id); mi->settings.name = GNUNET_strdup (is.name); + if (NULL != is.email) + mi->settings.email = GNUNET_strdup (is.email); + if (NULL != is.website) + mi->settings.website = GNUNET_strdup (is.website); + if (NULL != is.logo) + mi->settings.logo = GNUNET_strdup (is.logo); mi->auth = ias; GNUNET_CRYPTO_eddsa_key_create (&mi->merchant_priv.eddsa_priv); GNUNET_CRYPTO_eddsa_key_get_public (&mi->merchant_priv.eddsa_priv, |