aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/auditor_api_handle.c3
-rw-r--r--src/lib/exchange_api_handle.c50
-rw-r--r--src/testing/Makefile.am1
-rw-r--r--src/testing/test_auditor_api_version.c12
-rw-r--r--src/testing/testing_api_cmd_check_keys.c13
5 files changed, 49 insertions, 30 deletions
diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c
index c0555598f..85f42c3f6 100644
--- a/src/lib/auditor_api_handle.c
+++ b/src/lib/auditor_api_handle.c
@@ -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;
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 3b2a84b27..e2d0ea376 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -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))
- {
- denom1->key.rsa_public_key = tmp1;
- denom2->key.rsa_public_key = tmp2;
-
- return 1;
- }
-
+ ret = GNUNET_memcmp (denom1,
+ denom2);
+ denom1->revoked = r1;
+ denom2->revoked = r2;
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;
}
@@ -1291,7 +1297,7 @@ keys_completed_cb (void *cls,
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
kd.denom_keys[i].key.rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_dup (
- kd_old.denom_keys[i].key.rsa_public_key);
+ kd_old.denom_keys[i].key.rsa_public_key);
kd.num_auditors = kd_old.num_auditors;
kd.auditors = GNUNET_new_array (kd.num_auditors,
@@ -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,
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 73f9b9ec7..faad3f731 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -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 \
diff --git a/src/testing/test_auditor_api_version.c b/src/testing/test_auditor_api_version.c
index 62277e828..bf1094e38 100644
--- a/src/testing/test_auditor_api_version.c
+++ b/src/testing/test_auditor_api_version.c
@@ -151,8 +151,16 @@ main (int argc,
" is your PATH correct?\n");
return 77;
}
- GNUNET_SCHEDULER_run (&run,
- NULL);
+ 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);
diff --git a/src/testing/testing_api_cmd_check_keys.c b/src/testing/testing_api_cmd_check_keys.c
index 6e5c694cf..397ace562 100644
--- a/src/testing/testing_api_cmd_check_keys.c
+++ b/src/testing/testing_api_cmd_check_keys.c
@@ -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,11 +160,10 @@ 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",
- is->keys->num_denom_keys,
- cmd->label,
- cks->num_denom_keys);
+ TALER_LOG_ERROR ("Got %u keys in step %s, expected %u\n",
+ is->keys->num_denom_keys,
+ cmd->label,
+ cks->num_denom_keys);
TALER_TESTING_interpreter_fail (is);
return;
}