summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_validation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-11 02:37:56 +0200
committerChristian Grothoff <christian@grothoff.org>2016-04-11 02:37:56 +0200
commitb018d4d5b0798bdad6002cb7bbd246247b3ebd4f (patch)
treedebd0b6432d7bdfb67cde6c5bbba27efd9c884b5 /src/exchange/taler-exchange-httpd_validation.c
parent30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd (diff)
downloadexchange-b018d4d5b0798bdad6002cb7bbd246247b3ebd4f.tar.gz
exchange-b018d4d5b0798bdad6002cb7bbd246247b3ebd4f.tar.bz2
exchange-b018d4d5b0798bdad6002cb7bbd246247b3ebd4f.zip
implementing #4357, but test missing
Diffstat (limited to 'src/exchange/taler-exchange-httpd_validation.c')
-rw-r--r--src/exchange/taler-exchange-httpd_validation.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_validation.c b/src/exchange/taler-exchange-httpd_validation.c
index 61599fe1f..12244c518 100644
--- a/src/exchange/taler-exchange-httpd_validation.c
+++ b/src/exchange/taler-exchange-httpd_validation.c
@@ -153,10 +153,12 @@ TMH_VALIDATION_done ()
* a wire address.
*
* @param wire the JSON wire format object
+ * @param ours #GNUNET_YES if the signature should match our master key
* @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not
*/
int
-TMH_json_validate_wireformat (const json_t *wire)
+TMH_json_validate_wireformat (const json_t *wire,
+ int ours)
{
const char *stype;
json_error_t error;
@@ -175,7 +177,9 @@ TMH_json_validate_wireformat (const json_t *wire)
stype))
return p->plugin->wire_validate (p->plugin->cls,
wire,
- &TMH_master_public_key);
+ (GNUNET_YES == ours)
+ ? &TMH_master_public_key
+ : NULL);
return GNUNET_NO;
}
@@ -227,6 +231,16 @@ TMH_VALIDATION_get_wire_methods (const char *prefix)
method = plugin->get_wire_details (plugin->cls,
cfg,
account_name);
+ if (GNUNET_YES !=
+ TMH_json_validate_wireformat (method,
+ GNUNET_YES))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Account details for method `%s' ill-formed. Disabling method\n",
+ p->type);
+ json_decref (method);
+ method = NULL;
+ }
if (NULL != method)
json_object_set_new (methods,
p->type,