fix misc bugs

This commit is contained in:
Christian Grothoff 2020-12-12 22:42:04 +01:00
parent b81a5fb3aa
commit 7442744809
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 292 additions and 230 deletions

View File

@ -6,4 +6,4 @@
MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
# Where do we store the TOFU key material?
SECM_TOFU_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/secm_tofus.priv
SECM_TOFU_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/secm_tofus.pub

View File

@ -342,7 +342,7 @@ do_shutdown (void *cls)
while (NULL != (drr = drr_head))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete denomination revocation #%u\n",
(unsigned int) drr->idx);
TALER_EXCHANGE_management_revoke_denomination_key_cancel (drr->h);
@ -357,7 +357,7 @@ do_shutdown (void *cls)
while (NULL != (srr = srr_head))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete signkey revocation #%u\n",
(unsigned int) srr->idx);
TALER_EXCHANGE_management_revoke_signing_key_cancel (srr->h);
@ -373,7 +373,7 @@ do_shutdown (void *cls)
while (NULL != (war = war_head))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete wire add #%u\n",
(unsigned int) war->idx);
TALER_EXCHANGE_management_enable_wire_cancel (war->h);
@ -388,7 +388,7 @@ do_shutdown (void *cls)
while (NULL != (wdr = wdr_head))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete wire del #%u\n",
(unsigned int) wdr->idx);
TALER_EXCHANGE_management_disable_wire_cancel (wdr->h);
@ -403,7 +403,7 @@ do_shutdown (void *cls)
while (NULL != (wfr = wfr_head))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete wire fee #%u\n",
(unsigned int) wfr->idx);
TALER_EXCHANGE_management_set_wire_fees_cancel (wfr->h);
@ -418,7 +418,7 @@ do_shutdown (void *cls)
while (NULL != (ukr = ukr_head))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete key signature upload #%u\n",
(unsigned int) ukr->idx);
TALER_EXCHANGE_post_management_keys_cancel (ukr->h);
@ -438,8 +438,8 @@ do_shutdown (void *cls)
}
if (NULL != in)
{
fprintf (stderr,
"Warning: input not consumed!\n");
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Input not consumed!\n");
json_decref (in);
in = NULL;
}
@ -525,6 +525,7 @@ output_operation (const char *op_name,
{
json_t *action;
GNUNET_break (NULL != op_value);
if (NULL == out)
out = json_array ();
action = json_pack ("{ s:s, s:o }",
@ -532,6 +533,7 @@ output_operation (const char *op_name,
op_name,
"arguments",
op_value);
GNUNET_break (NULL != action);
GNUNET_break (0 ==
json_array_append_new (out,
action));
@ -578,12 +580,12 @@ load_offline_key (void)
return GNUNET_OK;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (kcfg,
"exchange",
"exchange-offline",
"MASTER_PRIV_FILE",
&fn))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
"exchange-offline",
"MASTER_PRIV_FILE");
test_shutdown ();
return GNUNET_SYSERR;
@ -629,12 +631,13 @@ denom_revocation_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) drr->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = 10;
}
GNUNET_CONTAINER_DLL_remove (drr_head,
drr_tail,
@ -675,11 +678,14 @@ upload_denom_revocation (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for denomination revocation: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -714,12 +720,13 @@ signkey_revocation_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) srr->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = 10;
}
GNUNET_CONTAINER_DLL_remove (srr_head,
srr_tail,
@ -760,11 +767,14 @@ upload_signkey_revocation (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for signkey revocation: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -799,12 +809,13 @@ wire_add_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) war->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = 10;
}
GNUNET_CONTAINER_DLL_remove (war_head,
war_tail,
@ -851,11 +862,14 @@ upload_wire_add (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for adding wire account: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -892,12 +906,13 @@ wire_del_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) wdr->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = 10;
}
GNUNET_CONTAINER_DLL_remove (wdr_head,
wdr_tail,
@ -941,11 +956,14 @@ upload_wire_del (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to disable wire account: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -981,12 +999,13 @@ wire_fee_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) wfr->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = 10;
}
GNUNET_CONTAINER_DLL_remove (wfr_head,
wfr_tail,
@ -1039,11 +1058,14 @@ upload_wire_fee (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to set wire fee: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -1082,12 +1104,13 @@ keys_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) ukr->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = 10;
}
GNUNET_CONTAINER_DLL_remove (ukr_head,
ukr_tail,
@ -1102,7 +1125,7 @@ keys_cb (
*
* @param exchange_url base URL of the exchange
* @param idx index of the operation we are performing (for logging)
* @param value argumets for POSTing keys
* @param value arguments for POSTing keys
*/
static void
upload_keys (const char *exchange_url,
@ -1125,21 +1148,28 @@ upload_keys (const char *exchange_url,
bool ok = true;
if (GNUNET_OK !=
GNUNET_JSON_parse (in,
GNUNET_JSON_parse (value,
spec,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to 'upload': %s#%u (skipping)\n",
err_name,
err_line);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
}
pkd.num_sign_sigs = json_array_size (signkey_sigs);
pkd.num_denom_sigs = json_array_size (denom_sigs);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Uploading %u denomination and %u signing key signatures\n",
pkd.num_denom_sigs,
pkd.num_sign_sigs);
pkd.sign_sigs = GNUNET_new_array (
pkd.num_sign_sigs,
struct TALER_EXCHANGE_SigningKeySignature);
@ -1165,11 +1195,14 @@ upload_keys (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for signkey validity: %s#%u at %u (aborting)\n",
err_name,
err_line,
i);
json_dumpf (val,
stderr,
JSON_INDENT (2));
ok = false;
}
}
@ -1192,11 +1225,14 @@ upload_keys (const char *exchange_url,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for denomination validity: %s#%u at %u (aborting)\n",
err_name,
err_line,
i);
json_dumpf (val,
stderr,
JSON_INDENT (2));
ok = false;
}
}
@ -1222,6 +1258,7 @@ upload_keys (const char *exchange_url,
}
GNUNET_free (pkd.sign_sigs);
GNUNET_free (pkd.denom_sigs);
GNUNET_JSON_parse_free (spec);
}
@ -1275,7 +1312,7 @@ trigger_upload (const char *exchange_url)
value = json_object_get (obj, "arguments");
if (NULL == key)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed JSON input\n");
global_ret = 3;
test_shutdown ();
@ -1296,7 +1333,7 @@ trigger_upload (const char *exchange_url)
}
if (! found)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload does not know how to handle `%s'\n",
key);
global_ret = 3;
@ -1319,7 +1356,7 @@ do_upload (char *const *args)
if (NULL != in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing upload\n");
test_shutdown ();
global_ret = 4;
@ -1334,7 +1371,7 @@ do_upload (char *const *args)
&err);
if (NULL == out)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to read JSON input: %s at %d:%s (offset: %d)\n",
err.text,
err.line,
@ -1347,7 +1384,7 @@ do_upload (char *const *args)
}
if (! json_is_array (out))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error: expected JSON array for `upload` command\n");
test_shutdown ();
global_ret = 2;
@ -1387,7 +1424,7 @@ do_revoke_denomination_key (char *const *args)
if (NULL != in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing revocation\n");
test_shutdown ();
global_ret = 4;
@ -1400,7 +1437,7 @@ do_revoke_denomination_key (char *const *args)
&h_denom_pub,
sizeof (h_denom_pub))) )
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a denomination key with this subcommand\n");
test_shutdown ();
global_ret = 5;
@ -1436,7 +1473,7 @@ do_revoke_signkey (char *const *args)
if (NULL != in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, refusing revocation\n");
test_shutdown ();
global_ret = 4;
@ -1449,7 +1486,7 @@ do_revoke_signkey (char *const *args)
&exchange_pub,
sizeof (exchange_pub))) )
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify an exchange signing key with this subcommand\n");
test_shutdown ();
global_ret = 5;
@ -1486,7 +1523,7 @@ do_add_wire (char *const *args)
if (NULL != in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not adding wire account\n");
test_shutdown ();
global_ret = 4;
@ -1494,7 +1531,7 @@ do_add_wire (char *const *args)
}
if (NULL == args[0])
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a payto://-URI with this subcommand\n");
test_shutdown ();
global_ret = 5;
@ -1541,7 +1578,7 @@ do_del_wire (char *const *args)
if (NULL != in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not deleting wire account\n");
test_shutdown ();
global_ret = 4;
@ -1549,7 +1586,7 @@ do_del_wire (char *const *args)
}
if (NULL == args[0])
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify a payto://-URI with this subcommand\n");
test_shutdown ();
global_ret = 5;
@ -1597,7 +1634,7 @@ do_set_wire_fee (char *const *args)
if (NULL != in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not setting wire fee\n");
test_shutdown ();
global_ret = 4;
@ -1620,7 +1657,7 @@ do_set_wire_fee (char *const *args)
TALER_string_to_amount (args[3],
&closing_fee)) )
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must use YEAR, METHOD, WIRE-FEE and CLOSING-FEE as arguments for this subcommand\n");
test_shutdown ();
global_ret = 5;
@ -1683,7 +1720,7 @@ download_cb (void *cls,
case MHD_HTTP_OK:
break;
default:
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to download keys: %s (HTTP status: %u/%u)\n",
hr->hint,
hr->http_status,
@ -1777,12 +1814,18 @@ tofu_check (const struct TALER_SecurityModulePublicKeyP secm[2])
GNUNET_free (fn);
return GNUNET_SYSERR;
}
GNUNET_free (fn);
/* TOFU check */
if (0 != memcmp (old,
secm,
sizeof (old)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: security module keys changed (file `%s')!\n",
fn);
GNUNET_free (fn);
return GNUNET_SYSERR;
}
GNUNET_free (fn);
return GNUNET_OK;
}
/* persist keys for future runs */
@ -1845,11 +1888,14 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for signing key to 'show': %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) index);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return GNUNET_SYSERR;
@ -1863,8 +1909,8 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
secm_pub,
&secm_sig))
{
fprintf (stderr,
"Invalid security module signature for key %s (aborting)\n",
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for signing key %s (aborting)\n",
TALER_B2S (&exchange_pub));
global_ret = 9;
test_shutdown ();
@ -1953,11 +1999,14 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for denomination key to 'show': %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) index);
json_dumpf (value,
stderr,
JSON_INDENT (2));
GNUNET_JSON_parse_free (spec);
global_ret = 7;
test_shutdown ();
@ -1975,9 +2024,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
secm_pub,
&secm_sig))
{
fprintf (stderr,
"Invalid security module signature for key %s (aborting)\n",
TALER_B2S (&h_denom_pub));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for denomination key %s (aborting)\n",
GNUNET_h2s (&h_denom_pub));
global_ret = 9;
test_shutdown ();
return GNUNET_SYSERR;
@ -2041,12 +2090,12 @@ do_show (char *const *args)
{
json_error_t err;
out = json_loadf (stdin,
in = json_loadf (stdin,
JSON_REJECT_DUPLICATES,
&err);
if (NULL == in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to read JSON input: %s at %d:%s (offset: %d)\n",
err.text,
err.line,
@ -2057,6 +2106,9 @@ do_show (char *const *args)
return;
}
}
if (GNUNET_OK !=
load_offline_key ())
return;
{
const char *err_name;
@ -2085,10 +2137,13 @@ do_show (char *const *args)
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to 'show': %s#%u (skipping)\n",
err_name,
err_line);
json_dumpf (in,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -2097,7 +2152,7 @@ do_show (char *const *args)
GNUNET_memcmp (&master_pub,
&mpub))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: exchange uses different master key!\n");
global_ret = 6;
test_shutdown ();
@ -2107,18 +2162,16 @@ do_show (char *const *args)
if (GNUNET_SYSERR ==
tofu_check (secm))
{
fprintf (stderr,
"Fatal: security module keys changed!\n");
global_ret = 8;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
return;
}
if ( (GNUNET_OK !=
show_signkeys (&secm[0],
show_signkeys (&secm[1],
signkeys)) ||
(GNUNET_OK !=
show_denomkeys (&secm[1],
show_denomkeys (&secm[0],
denomkeys)) )
{
global_ret = 8;
@ -2187,11 +2240,14 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for signing key to 'show': %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) index);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return GNUNET_SYSERR;
@ -2206,11 +2262,12 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
secm_pub,
&secm_sig))
{
fprintf (stderr,
"Invalid security module signature for key %s (aborting)\n",
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for signing key %s (aborting)\n",
TALER_B2S (&exchange_pub));
global_ret = 9;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
{
@ -2225,12 +2282,13 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_assert (0 ==
json_array_append_new (
result,
json_pack ("{s:o,s:o}",
json_pack ("{s:o, s:o}",
"exchange_pub",
GNUNET_JSON_from_data_auto (&exchange_pub),
"master_sig",
GNUNET_JSON_from_data_auto (&master_sig))));
}
GNUNET_JSON_parse_free (spec);
}
return GNUNET_OK;
}
@ -2303,11 +2361,14 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input for denomination key to 'sign': %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) index);
json_dumpf (value,
stderr,
JSON_INDENT (2));
GNUNET_JSON_parse_free (spec);
global_ret = 7;
test_shutdown ();
@ -2325,11 +2386,12 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
secm_pub,
&secm_sig))
{
fprintf (stderr,
"Invalid security module signature for key %s (aborting)\n",
TALER_B2S (&h_denom_pub));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid security module signature for denomination key %s (aborting)\n",
GNUNET_h2s (&h_denom_pub));
global_ret = 9;
test_shutdown ();
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
@ -2351,8 +2413,8 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_assert (0 ==
json_array_append_new (
result,
json_pack ("{s:o,s:o}",
"h_denomn_pub",
json_pack ("{s:o, s:o}",
"h_denom_pub",
GNUNET_JSON_from_data_auto (&h_denom_pub),
"master_sig",
GNUNET_JSON_from_data_auto (&master_sig))));
@ -2375,12 +2437,12 @@ do_sign (char *const *args)
{
json_error_t err;
out = json_loadf (stdin,
in = json_loadf (stdin,
JSON_REJECT_DUPLICATES,
&err);
if (NULL == in)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to read JSON input: %s at %d:%s (offset: %d)\n",
err.text,
err.line,
@ -2422,10 +2484,13 @@ do_sign (char *const *args)
&err_name,
&err_line))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to 'sign': %s#%u (skipping)\n",
err_name,
err_line);
json_dumpf (in,
stderr,
JSON_INDENT (2));
global_ret = 7;
test_shutdown ();
return;
@ -2434,7 +2499,7 @@ do_sign (char *const *args)
GNUNET_memcmp (&master_pub,
&mpub))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: exchange uses different master key!\n");
global_ret = 6;
test_shutdown ();
@ -2444,7 +2509,7 @@ do_sign (char *const *args)
if (GNUNET_SYSERR ==
tofu_check (secm))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatal: security module keys changed!\n");
global_ret = 8;
test_shutdown ();
@ -2458,11 +2523,11 @@ do_sign (char *const *args)
GNUNET_assert (NULL != signkey_sig_array);
GNUNET_assert (NULL != denomkey_sig_array);
if ( (GNUNET_OK !=
sign_signkeys (&secm[0],
sign_signkeys (&secm[1],
signkeys,
signkey_sig_array)) ||
(GNUNET_OK !=
sign_denomkeys (&secm[1],
sign_denomkeys (&secm[0],
denomkeys,
denomkey_sig_array)) )
{
@ -2569,16 +2634,17 @@ work (void *cls)
if (0 != strcasecmp ("help",
args[0]))
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Unexpected command `%s'\n",
args[0]);
global_ret = 3;
}
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Supported subcommands:\n");
for (unsigned int i = 0; NULL != cmds[i].name; i++)
{
fprintf (stderr,
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"\t%s - %s\n",
cmds[i].name,
cmds[i].help);
@ -2634,10 +2700,6 @@ main (int argc,
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
(void) TALER_project_data_default ();
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("taler-exchange-offline",
"WARNING",
NULL));
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-offline",

View File

@ -8054,8 +8054,8 @@ postgres_insert_auditor (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (auditor_pub),
GNUNET_PQ_query_param_string (auditor_url),
GNUNET_PQ_query_param_string (auditor_name),
GNUNET_PQ_query_param_string (auditor_url),
GNUNET_PQ_query_param_absolute_time (&start_date),
GNUNET_PQ_query_param_end
};
@ -8545,7 +8545,7 @@ postgres_add_denomination_key (
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam iparams[] = {
GNUNET_PQ_query_param_auto_from_type (&h_denom_pub),
GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key),
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (master_sig),
@ -8604,7 +8604,7 @@ postgres_activate_signing_key (
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam iparams[] = {
GNUNET_PQ_query_param_auto_from_type (&exchange_pub),
GNUNET_PQ_query_param_auto_from_type (exchange_pub),
TALER_PQ_query_param_absolute_time (&meta->start),
TALER_PQ_query_param_absolute_time (&meta->expire_sign),
TALER_PQ_query_param_absolute_time (&meta->expire_legal),