fix #6786: do not die on bogus URL
This commit is contained in:
parent
5985f73d42
commit
ca5f0c4d6f
@ -1 +1 @@
|
|||||||
Subproject commit 7e88ff128eb71fd85419855eb1a91c9c94eaf022
|
Subproject commit 80b3182db5a5b13a765b2ab8846cb1d0f3281990
|
@ -360,6 +360,11 @@ TALER_AUDITOR_deposit_confirmation (
|
|||||||
dh->cb_cls = cb_cls;
|
dh->cb_cls = cb_cls;
|
||||||
dh->url = TALER_AUDITOR_path_to_url_ (auditor,
|
dh->url = TALER_AUDITOR_path_to_url_ (auditor,
|
||||||
"/deposit-confirmation");
|
"/deposit-confirmation");
|
||||||
|
if (NULL == dh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (dh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_AUDITOR_curl_easy_get_ (dh->url);
|
eh = TALER_AUDITOR_curl_easy_get_ (dh->url);
|
||||||
|
|
||||||
if ( (NULL == eh) ||
|
if ( (NULL == eh) ||
|
||||||
|
@ -221,7 +221,11 @@ TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor,
|
|||||||
leh->cb = cb;
|
leh->cb = cb;
|
||||||
leh->cb_cls = cb_cls;
|
leh->cb_cls = cb_cls;
|
||||||
leh->url = TALER_AUDITOR_path_to_url_ (auditor, "/exchanges");
|
leh->url = TALER_AUDITOR_path_to_url_ (auditor, "/exchanges");
|
||||||
|
if (NULL == leh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (leh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"URL for list-exchanges: `%s'\n",
|
"URL for list-exchanges: `%s'\n",
|
||||||
leh->url);
|
leh->url);
|
||||||
|
@ -407,13 +407,10 @@ char *
|
|||||||
TALER_AUDITOR_path_to_url_ (struct TALER_AUDITOR_Handle *h,
|
TALER_AUDITOR_path_to_url_ (struct TALER_AUDITOR_Handle *h,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
char *ret;
|
|
||||||
GNUNET_assert ('/' == path[0]);
|
GNUNET_assert ('/' == path[0]);
|
||||||
ret = TALER_url_join (h->url,
|
return TALER_url_join (h->url,
|
||||||
path + 1,
|
path + 1,
|
||||||
NULL);
|
NULL);
|
||||||
GNUNET_assert (NULL != ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -481,6 +478,18 @@ request_version (void *cls)
|
|||||||
vr->auditor = auditor;
|
vr->auditor = auditor;
|
||||||
vr->url = TALER_AUDITOR_path_to_url_ (auditor,
|
vr->url = TALER_AUDITOR_path_to_url_ (auditor,
|
||||||
"/version");
|
"/version");
|
||||||
|
if (NULL == vr->url)
|
||||||
|
{
|
||||||
|
struct TALER_AUDITOR_HttpResponse hr = {
|
||||||
|
.ec = TALER_EC_GENERIC_CONFIGURATION_INVALID
|
||||||
|
};
|
||||||
|
|
||||||
|
auditor->version_cb (auditor->version_cb_cls,
|
||||||
|
&hr,
|
||||||
|
NULL,
|
||||||
|
TALER_AUDITOR_VC_PROTOCOL_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Requesting auditor version with URL `%s'.\n",
|
"Requesting auditor version with URL `%s'.\n",
|
||||||
vr->url);
|
vr->url);
|
||||||
|
@ -741,6 +741,12 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
dh->cb_cls = cb_cls;
|
dh->cb_cls = cb_cls;
|
||||||
dh->url = TEAH_path_to_url (exchange,
|
dh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == dh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (dh);
|
||||||
|
json_decref (deposit_obj);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
dh->depconf.purpose.size = htonl (sizeof (struct
|
dh->depconf.purpose.size = htonl (sizeof (struct
|
||||||
TALER_DepositConfirmationPS));
|
TALER_DepositConfirmationPS));
|
||||||
dh->depconf.purpose.purpose = htonl (
|
dh->depconf.purpose.purpose = htonl (
|
||||||
|
@ -373,6 +373,11 @@ TALER_EXCHANGE_deposits_get (
|
|||||||
dwh->cb_cls = cb_cls;
|
dwh->cb_cls = cb_cls;
|
||||||
dwh->url = TEAH_path_to_url (exchange,
|
dwh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == dwh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (dwh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
dwh->depconf.purpose.size = htonl (sizeof (struct TALER_ConfirmWirePS));
|
dwh->depconf.purpose.size = htonl (sizeof (struct TALER_ConfirmWirePS));
|
||||||
dwh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE);
|
dwh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE);
|
||||||
dwh->depconf.h_wire = *h_wire;
|
dwh->depconf.h_wire = *h_wire;
|
||||||
|
@ -1293,14 +1293,10 @@ char *
|
|||||||
TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
|
TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
char *ret;
|
|
||||||
|
|
||||||
GNUNET_assert ('/' == path[0]);
|
GNUNET_assert ('/' == path[0]);
|
||||||
ret = TALER_url_join (h->url,
|
return TALER_url_join (h->url,
|
||||||
path + 1,
|
path + 1,
|
||||||
NULL);
|
NULL);
|
||||||
GNUNET_assert (NULL != ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1904,6 +1900,21 @@ request_keys (void *cls)
|
|||||||
url[strlen (url) - 1] = '\0';
|
url[strlen (url) - 1] = '\0';
|
||||||
kr->url = TEAH_path_to_url (exchange,
|
kr->url = TEAH_path_to_url (exchange,
|
||||||
url);
|
url);
|
||||||
|
if (NULL == kr->url)
|
||||||
|
{
|
||||||
|
struct TALER_EXCHANGE_HttpResponse hr = {
|
||||||
|
.ec = TALER_EC_GENERIC_CONFIGURATION_INVALID
|
||||||
|
};
|
||||||
|
|
||||||
|
GNUNET_free (kr);
|
||||||
|
exchange->keys_error_count++;
|
||||||
|
exchange->state = MHS_FAILED;
|
||||||
|
exchange->cert_cb (exchange->cert_cb_cls,
|
||||||
|
&hr,
|
||||||
|
NULL,
|
||||||
|
TALER_EXCHANGE_VC_PROTOCOL_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Requesting keys with URL `%s'.\n",
|
"Requesting keys with URL `%s'.\n",
|
||||||
@ -1911,6 +1922,8 @@ request_keys (void *cls)
|
|||||||
eh = TALER_EXCHANGE_curl_easy_get_ (kr->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (kr->url);
|
||||||
if (NULL == eh)
|
if (NULL == eh)
|
||||||
{
|
{
|
||||||
|
GNUNET_free (kr->url);
|
||||||
|
GNUNET_free (kr);
|
||||||
exchange->retry_delay = EXCHANGE_LIB_BACKOFF (exchange->retry_delay);
|
exchange->retry_delay = EXCHANGE_LIB_BACKOFF (exchange->retry_delay);
|
||||||
exchange->retry_task = GNUNET_SCHEDULER_add_delayed (exchange->retry_delay,
|
exchange->retry_task = GNUNET_SCHEDULER_add_delayed (exchange->retry_delay,
|
||||||
&request_keys,
|
&request_keys,
|
||||||
|
@ -468,6 +468,11 @@ TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
lh->coin_priv = *coin_priv;
|
lh->coin_priv = *coin_priv;
|
||||||
lh->url = TEAH_path_to_url (exchange,
|
lh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == lh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (lh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (lh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (lh->url);
|
||||||
if (NULL == eh)
|
if (NULL == eh)
|
||||||
{
|
{
|
||||||
|
@ -564,6 +564,12 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
mh->md = md;
|
mh->md = md;
|
||||||
mh->url = TEAH_path_to_url (exchange,
|
mh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == mh->url)
|
||||||
|
{
|
||||||
|
json_decref (melt_obj);
|
||||||
|
GNUNET_free (mh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (mh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (mh->url);
|
||||||
if ( (NULL == eh) ||
|
if ( (NULL == eh) ||
|
||||||
(GNUNET_OK !=
|
(GNUNET_OK !=
|
||||||
|
@ -390,6 +390,12 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
ph->cb_cls = recoup_cb_cls;
|
ph->cb_cls = recoup_cb_cls;
|
||||||
ph->url = TEAH_path_to_url (exchange,
|
ph->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == ph->url)
|
||||||
|
{
|
||||||
|
json_decref (recoup_obj);
|
||||||
|
GNUNET_free (ph);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
ph->was_refreshed = was_refreshed;
|
ph->was_refreshed = was_refreshed;
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
|
||||||
if ( (NULL == eh) ||
|
if ( (NULL == eh) ||
|
||||||
|
@ -466,7 +466,12 @@ TALER_EXCHANGE_refreshes_reveal (
|
|||||||
rrh->md = md;
|
rrh->md = md;
|
||||||
rrh->url = TEAH_path_to_url (rrh->exchange,
|
rrh->url = TEAH_path_to_url (rrh->exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == rrh->url)
|
||||||
|
{
|
||||||
|
json_decref (reveal_obj);
|
||||||
|
GNUNET_free (rrh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (rrh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (rrh->url);
|
||||||
if ( (NULL == eh) ||
|
if ( (NULL == eh) ||
|
||||||
(GNUNET_OK !=
|
(GNUNET_OK !=
|
||||||
|
@ -739,6 +739,12 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
rh->cb_cls = cb_cls;
|
rh->cb_cls = cb_cls;
|
||||||
rh->url = TEAH_path_to_url (exchange,
|
rh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == rh->url)
|
||||||
|
{
|
||||||
|
json_decref (refund_obj);
|
||||||
|
GNUNET_free (rh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
rh->depconf.purpose.size = htonl (sizeof (struct TALER_RefundConfirmationPS));
|
rh->depconf.purpose.size = htonl (sizeof (struct TALER_RefundConfirmationPS));
|
||||||
rh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND);
|
rh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND);
|
||||||
rh->depconf.h_contract_terms = *h_contract_terms;
|
rh->depconf.h_contract_terms = *h_contract_terms;
|
||||||
|
@ -290,6 +290,11 @@ TALER_EXCHANGE_reserves_get (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
rgh->reserve_pub = *reserve_pub;
|
rgh->reserve_pub = *reserve_pub;
|
||||||
rgh->url = TEAH_path_to_url (exchange,
|
rgh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == rgh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (rgh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (rgh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (rgh->url);
|
||||||
if (NULL == eh)
|
if (NULL == eh)
|
||||||
{
|
{
|
||||||
|
@ -381,6 +381,11 @@ TALER_EXCHANGE_transfers_get (
|
|||||||
}
|
}
|
||||||
wdh->url = TEAH_path_to_url (wdh->exchange,
|
wdh->url = TEAH_path_to_url (wdh->exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == wdh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (wdh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (wdh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (wdh->url);
|
||||||
if (NULL == eh)
|
if (NULL == eh)
|
||||||
{
|
{
|
||||||
|
@ -435,6 +435,11 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
wh->cb_cls = wire_cb_cls;
|
wh->cb_cls = wire_cb_cls;
|
||||||
wh->url = TEAH_path_to_url (exchange,
|
wh->url = TEAH_path_to_url (exchange,
|
||||||
"/wire");
|
"/wire");
|
||||||
|
if (NULL == wh->url)
|
||||||
|
{
|
||||||
|
GNUNET_free (wh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||||
GNUNET_break (CURLE_OK ==
|
GNUNET_break (CURLE_OK ==
|
||||||
curl_easy_setopt (eh,
|
curl_easy_setopt (eh,
|
||||||
|
@ -464,6 +464,12 @@ TALER_EXCHANGE_withdraw2 (
|
|||||||
TALER_B2S (&wh->reserve_pub));
|
TALER_B2S (&wh->reserve_pub));
|
||||||
wh->url = TEAH_path_to_url (exchange,
|
wh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
if (NULL == wh->url)
|
||||||
|
{
|
||||||
|
json_decref (withdraw_obj);
|
||||||
|
GNUNET_free (wh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
CURL *eh;
|
CURL *eh;
|
||||||
struct GNUNET_CURL_Context *ctx;
|
struct GNUNET_CURL_Context *ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user