fix regression introduced by addition of 'revoke' field

This commit is contained in:
Christian Grothoff 2020-03-13 19:13:36 +01:00
parent e05ce36f30
commit dc02821d8f
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 49 additions and 30 deletions

View File

@ -318,7 +318,7 @@ version_completed_cb (void *cls,
response_code = 0;
break;
}
auditor->retry_delay = GNUNET_TIME_UNIT_ZERO;
auditor->retry_delay = GNUNET_TIME_UNIT_ZERO; /* restart quickly */
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -443,6 +443,7 @@ TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx,
GNUNET_CURL_append_header (ctx,
"Expect:"));
auditor = GNUNET_new (struct TALER_AUDITOR_Handle);
auditor->retry_delay = GNUNET_TIME_UNIT_SECONDS; /* start slowly */
auditor->ctx = ctx;
auditor->url = GNUNET_strdup (url);
auditor->version_cb = version_cb;

View File

@ -756,7 +756,7 @@ update_auditors (struct TALER_EXCHANGE_Handle *exchange)
/**
* Compare two denomination keys.
* Compare two denomination keys. Ignores revocation data.
*
* @param denom1 first denomination key
* @param denom2 second denomination key
@ -769,6 +769,9 @@ denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1,
{
struct GNUNET_CRYPTO_RsaPublicKey *tmp1;
struct GNUNET_CRYPTO_RsaPublicKey *tmp2;
int r1;
int r2;
int ret;
/* First check if pub is the same. */
if (0 != GNUNET_CRYPTO_rsa_public_key_cmp
@ -778,24 +781,19 @@ denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1,
tmp1 = denom1->key.rsa_public_key;
tmp2 = denom2->key.rsa_public_key;
r1 = denom1->revoked;
r2 = denom2->revoked;
denom1->key.rsa_public_key = NULL;
denom2->key.rsa_public_key = NULL;
/* Then procede with the rest of the object. */
if (0 != GNUNET_memcmp (denom1,
denom2))
{
ret = GNUNET_memcmp (denom1,
denom2);
denom1->revoked = r1;
denom2->revoked = r2;
denom1->key.rsa_public_key = tmp1;
denom2->key.rsa_public_key = tmp2;
return 1;
}
denom1->key.rsa_public_key = tmp1;
denom2->key.rsa_public_key = tmp2;
return 0;
return ret;
}
@ -935,6 +933,9 @@ decode_keys_json (const json_t *resp_obj,
struct TALER_EXCHANGE_DenomPublicKey dk;
int found = GNUNET_NO;
memset (&dk,
0,
sizeof (dk));
EXITIF (GNUNET_SYSERR ==
parse_json_denomkey (&dk,
check_sig,
@ -956,7 +957,7 @@ decode_keys_json (const json_t *resp_obj,
if (GNUNET_YES == found)
{
/* 0:0:0 did not support /keys cherry picking */
TALER_LOG_DEBUG ("Skipping denomination key: already know it\n");
/* Okay, but why breaking here? It could be that the
* user redownloaded all the keys in a forced way. */
GNUNET_break_op (0 == current);
@ -970,7 +971,7 @@ decode_keys_json (const json_t *resp_obj,
key_data->denom_keys[key_data->num_denom_keys++] = dk;
/* Update "last_denom_issue_date" */
TALER_LOG_DEBUG ("Crawling DK 'valid_from': %s\n",
TALER_LOG_DEBUG ("Adding denomination key that is valid_from %s\n",
GNUNET_STRINGS_absolute_time_to_string (dk.valid_from));
key_data->last_denom_issue_date
= GNUNET_TIME_absolute_max (key_data->last_denom_issue_date,
@ -1012,6 +1013,11 @@ decode_keys_json (const json_t *resp_obj,
found = GNUNET_YES;
/* Merge denomination key signatures of downloaded /keys into existing
auditor information 'aix'. */
TALER_LOG_DEBUG (
"Merging %u new audited keys with %u known audited keys\n",
aix->num_denom_keys,
ai.num_denom_keys);
GNUNET_array_grow (aix->denom_keys,
aix->num_denom_keys,
aix->num_denom_keys + ai.num_denom_keys);
@ -1212,8 +1218,8 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
if (GNUNET_YES == pull_all_keys)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Forcing re-download of all keys\n");
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Forcing re-download of all exchange keys\n");
GNUNET_break (GNUNET_YES == force_download);
exchange->state = MHS_INIT;
}
@ -1365,8 +1371,8 @@ keys_completed_cb (void *cls,
exchange->kr = NULL;
free_keys_request (kr);
exchange->state = MHS_FAILED;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"/keys download failed\n");
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Exchange keys download failed\n");
if (NULL != exchange->key_data_raw)
{
json_decref (exchange->key_data_raw);
@ -1384,6 +1390,8 @@ keys_completed_cb (void *cls,
exchange->key_data_expiration = kr->expire;
free_keys_request (kr);
exchange->state = MHS_CERT;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Successfully downloaded exchange's keys\n");
update_auditors (exchange);
/* notify application about the key information */
exchange->cert_cb (exchange->cert_cb_cls,
@ -1604,6 +1612,8 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
exchange->key_data = key_data;
exchange->key_data_expiration = expire;
exchange->state = MHS_CERT;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Successfully loaded exchange's keys via deserialization\n");
update_auditors (exchange);
/* notify application about the key information */
exchange->cert_cb (exchange->cert_cb_cls,

View File

@ -148,6 +148,7 @@ test_auditor_api_LDADD = \
test_auditor_api_version_SOURCES = \
test_auditor_api_version.c
test_auditor_api_version_LDADD = \
libtalertesting.la \
$(top_builddir)/src/lib/libtalerauditor.la \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \

View File

@ -151,8 +151,16 @@ main (int argc,
" is your PATH correct?\n");
return 77;
}
if (0 != TALER_TESTING_wait_auditor_ready ("http://localhost:8083/"))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to launch `taler-auditor-httpd`\n");
}
else
{
GNUNET_SCHEDULER_run (&run,
NULL);
}
GNUNET_OS_process_kill (proc, SIGTERM);
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);

View File

@ -69,12 +69,12 @@ struct CheckKeysState
/**
* Value X to set as the URL parameter:
* "/keys?last_denom_issue=X" is used only when `set_last_denom'
* equals GNUNET_YES.
* equals #GNUNET_YES.
*/
struct GNUNET_TIME_Absolute last_denom_date;
/**
* If GNUNET_YES, then we'll provide the "/keys" request.
* If #GNUNET_YES, then we'll provide the "/keys" request.
* with the "now" argument.
*/
int with_now;
@ -160,8 +160,7 @@ check_keys_run (void *cls,
{
/* Did not get the expected number of denomination keys! */
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Got %u keys in step %s, expected %u\n",
TALER_LOG_ERROR ("Got %u keys in step %s, expected %u\n",
is->keys->num_denom_keys,
cmd->label,
cks->num_denom_keys);