diff options
Diffstat (limited to 'src/exchange-tools/taler-auditor-offline.c')
-rw-r--r-- | src/exchange-tools/taler-auditor-offline.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/src/exchange-tools/taler-auditor-offline.c b/src/exchange-tools/taler-auditor-offline.c index cc7278e54..0fbd82baa 100644 --- a/src/exchange-tools/taler-auditor-offline.c +++ b/src/exchange-tools/taler-auditor-offline.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2020 Taler Systems SA | 3 | Copyright (C) 2020-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -295,11 +295,11 @@ output_operation (const char *op_name, | |||
295 | json_t *action; | 295 | json_t *action; |
296 | 296 | ||
297 | GNUNET_assert (NULL != out); | 297 | GNUNET_assert (NULL != out); |
298 | action = json_pack ("{ s:s, s:o }", | 298 | action = GNUNET_JSON_PACK ( |
299 | "operation", | 299 | GNUNET_JSON_pack_string ("operation", |
300 | op_name, | 300 | op_name), |
301 | "arguments", | 301 | GNUNET_JSON_pack_object_steal ("arguments", |
302 | op_value); | 302 | op_value)); |
303 | GNUNET_break (0 == | 303 | GNUNET_break (0 == |
304 | json_array_append_new (out, | 304 | json_array_append_new (out, |
305 | action)); | 305 | action)); |
@@ -660,6 +660,15 @@ keys_cb ( | |||
660 | switch (hr->http_status) | 660 | switch (hr->http_status) |
661 | { | 661 | { |
662 | case MHD_HTTP_OK: | 662 | case MHD_HTTP_OK: |
663 | if (! json_is_object (hr->reply)) | ||
664 | { | ||
665 | GNUNET_break (0); | ||
666 | TALER_EXCHANGE_disconnect (exchange); | ||
667 | exchange = NULL; | ||
668 | test_shutdown (); | ||
669 | global_ret = EXIT_FAILURE; | ||
670 | return; | ||
671 | } | ||
663 | break; | 672 | break; |
664 | default: | 673 | default: |
665 | fprintf (stderr, | 674 | fprintf (stderr, |
@@ -673,11 +682,11 @@ keys_cb ( | |||
673 | global_ret = EXIT_FAILURE; | 682 | global_ret = EXIT_FAILURE; |
674 | return; | 683 | return; |
675 | } | 684 | } |
676 | in = json_pack ("{s:s,s:O}", | 685 | in = GNUNET_JSON_PACK ( |
677 | "operation", | 686 | GNUNET_JSON_pack_string ("operation", |
678 | OP_INPUT_KEYS, | 687 | OP_INPUT_KEYS), |
679 | "arguments", | 688 | GNUNET_JSON_pack_object_incref ("arguments", |
680 | hr->reply); | 689 | (json_t *) hr->reply)); |
681 | if (NULL == args[0]) | 690 | if (NULL == args[0]) |
682 | { | 691 | { |
683 | json_dumpf (in, | 692 | json_dumpf (in, |
@@ -1141,11 +1150,11 @@ sign_denomkeys (const json_t *denomkeys) | |||
1141 | &auditor_priv, | 1150 | &auditor_priv, |
1142 | &auditor_sig); | 1151 | &auditor_sig); |
1143 | output_operation (OP_SIGN_DENOMINATION, | 1152 | output_operation (OP_SIGN_DENOMINATION, |
1144 | json_pack ("{s:o, s:o}", | 1153 | GNUNET_JSON_PACK ( |
1145 | "h_denom_pub", | 1154 | GNUNET_JSON_pack_data_auto ("h_denom_pub", |
1146 | GNUNET_JSON_from_data_auto (&h_denom_pub), | 1155 | &h_denom_pub), |
1147 | "auditor_sig", | 1156 | GNUNET_JSON_pack_data_auto ("auditor_sig", |
1148 | GNUNET_JSON_from_data_auto (&auditor_sig))); | 1157 | &auditor_sig))); |
1149 | } | 1158 | } |
1150 | GNUNET_JSON_parse_free (spec); | 1159 | GNUNET_JSON_parse_free (spec); |
1151 | } | 1160 | } |
@@ -1214,7 +1223,10 @@ do_sign (char *const *args) | |||
1214 | return; | 1223 | return; |
1215 | } | 1224 | } |
1216 | if (NULL == out) | 1225 | if (NULL == out) |
1226 | { | ||
1217 | out = json_array (); | 1227 | out = json_array (); |
1228 | GNUNET_assert (NULL != out); | ||
1229 | } | ||
1218 | if (GNUNET_OK != | 1230 | if (GNUNET_OK != |
1219 | sign_denomkeys (denomkeys)) | 1231 | sign_denomkeys (denomkeys)) |
1220 | { | 1232 | { |
@@ -1247,11 +1259,14 @@ do_setup (char *const *args) | |||
1247 | if (NULL != *args) | 1259 | if (NULL != *args) |
1248 | { | 1260 | { |
1249 | if (NULL == out) | 1261 | if (NULL == out) |
1262 | { | ||
1250 | out = json_array (); | 1263 | out = json_array (); |
1264 | GNUNET_assert (NULL != out); | ||
1265 | } | ||
1251 | output_operation (OP_SETUP, | 1266 | output_operation (OP_SETUP, |
1252 | json_pack ("{s:o}", | 1267 | GNUNET_JSON_PACK ( |
1253 | "auditor_pub", | 1268 | GNUNET_JSON_pack_data_auto ("auditor_pub", |
1254 | GNUNET_JSON_from_data_auto (&auditor_pub))); | 1269 | &auditor_pub))); |
1255 | } | 1270 | } |
1256 | 1271 | ||
1257 | else | 1272 | else |