diff options
Diffstat (limited to 'src/exchange')
-rw-r--r-- | src/exchange/taler-exchange-httpd_admin.c | 3 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_deposit.c | 3 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_validation.c | 18 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_validation.h | 4 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_aggregator.c | 4 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_httpd.conf | 9 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_httpd_home/.config/taler/test.json | 8 |
7 files changed, 33 insertions, 16 deletions
diff --git a/src/exchange/taler-exchange-httpd_admin.c b/src/exchange/taler-exchange-httpd_admin.c index cc0245cd6..29da2d441 100644 --- a/src/exchange/taler-exchange-httpd_admin.c +++ b/src/exchange/taler-exchange-httpd_admin.c @@ -145,7 +145,8 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; } if (GNUNET_YES != - TMH_json_validate_wireformat (wire)) + TMH_json_validate_wireformat (wire, + GNUNET_NO)) { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 73e6463df..efef3d04e 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -165,7 +165,8 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection, return MHD_YES; /* failure */ if (GNUNET_YES != - TMH_json_validate_wireformat (wire)) + TMH_json_validate_wireformat (wire, + GNUNET_NO)) { GNUNET_JSON_parse_free (spec); return TMH_RESPONSE_reply_arg_unknown (connection, 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, diff --git a/src/exchange/taler-exchange-httpd_validation.h b/src/exchange/taler-exchange-httpd_validation.h index a5403edd4..bd04994ef 100644 --- a/src/exchange/taler-exchange-httpd_validation.h +++ b/src/exchange/taler-exchange-httpd_validation.h @@ -47,10 +47,12 @@ TMH_VALIDATION_done (void); * 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); /** * Check if we support the given wire method. diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c index 594f972c1..a799316f3 100644 --- a/src/exchange/test_taler_exchange_aggregator.c +++ b/src/exchange/test_taler_exchange_aggregator.c @@ -481,9 +481,7 @@ do_deposit (struct Command *cmd) return GNUNET_SYSERR; } fake_coin (&deposit.coin); - /* Build JSON for wire details; - note that this simple method may fail in the future if we implement - and enforce signature checking on test-wire account details */ + /* Build JSON for wire details */ deposit.wire = json_pack ("{s:s, s:s, s:I}", "type", "test", "bank_uri", "http://localhost:8082/", diff --git a/src/exchange/test_taler_exchange_httpd.conf b/src/exchange/test_taler_exchange_httpd.conf index 0ce9dadd2..5b49c0824 100644 --- a/src/exchange/test_taler_exchange_httpd.conf +++ b/src/exchange/test_taler_exchange_httpd.conf @@ -31,20 +31,13 @@ TESTRUN = YES DB_CONN_STR = "postgres:///talercheck" -[wire-incoming-test] -# What is the main website of the bank? -BANK_URI = "http://localhost:8082/" -# Into which account at the 'bank' should incoming -# wire transfers be made? -BANK_ACCOUNT_NUMBER = 2 - [wire-outgoing-test] # What is the main website of the bank? BANK_URI = "http://localhost:8082/" # From which account at the 'bank' should outgoing # wire transfers be made? -BANK_ACCOUNT_NUMBER = 3 +EXCHANGE_ACCOUNT_NUMBER = 3 # Coins for the tests. diff --git a/src/exchange/test_taler_exchange_httpd_home/.config/taler/test.json b/src/exchange/test_taler_exchange_httpd_home/.config/taler/test.json new file mode 100644 index 000000000..be5e92c11 --- /dev/null +++ b/src/exchange/test_taler_exchange_httpd_home/.config/taler/test.json @@ -0,0 +1,8 @@ +{ + "salt": "AZPRFVJ58NM6M7J5CZQPJAH3EW5DYM52AEZ9Y1C1ER3W94QV8D8TQKF6CK8MYQRA9QMSKDQTGZ306ZS9GQ0M6R01CJ20KPP49WFDZK8", + "name": "The exchange", + "account_number": 3, + "bank_uri": "http://localhost:8082/", + "type": "test", + "sig": "RPQXP9S4P8PQP7HEZQNRSZCT0ATNEP8GW0P5TPM34V5RX86FCD670V44R9NETSYDDKB8SZV7TKY9PAJYTY51D3VDWY9XXQ5BPFRXR28" +}
\ No newline at end of file |