limit redirects
This commit is contained in:
parent
0a2b049864
commit
cdc8c5b57b
@ -30,7 +30,7 @@
|
|||||||
* @param url URL to query
|
* @param url URL to query
|
||||||
*/
|
*/
|
||||||
CURL *
|
CURL *
|
||||||
TEL_curl_easy_get (const char *url)
|
TALER_EXCHANGE_curl_easy_get_ (const char *url)
|
||||||
{
|
{
|
||||||
CURL *eh;
|
CURL *eh;
|
||||||
|
|
||||||
@ -43,6 +43,12 @@ TEL_curl_easy_get (const char *url)
|
|||||||
curl_easy_setopt (eh,
|
curl_easy_setopt (eh,
|
||||||
CURLOPT_FOLLOWLOCATION,
|
CURLOPT_FOLLOWLOCATION,
|
||||||
1L));
|
1L));
|
||||||
|
/* limit MAXREDIRS to 5 as a simple security measure against
|
||||||
|
a potential infinite loop caused by a malicious target */
|
||||||
|
GNUNET_assert (CURLE_OK ==
|
||||||
|
curl_easy_setopt (eh,
|
||||||
|
CURLOPT_MAXREDIRS,
|
||||||
|
5L));
|
||||||
GNUNET_assert (CURLE_OK ==
|
GNUNET_assert (CURLE_OK ==
|
||||||
curl_easy_setopt (eh,
|
curl_easy_setopt (eh,
|
||||||
CURLOPT_TCP_FASTOPEN,
|
CURLOPT_TCP_FASTOPEN,
|
||||||
|
@ -36,6 +36,6 @@
|
|||||||
* @param url URL to query
|
* @param url URL to query
|
||||||
*/
|
*/
|
||||||
CURL *
|
CURL *
|
||||||
TEL_curl_easy_get (const char *url);
|
TALER_EXCHANGE_curl_easy_get_ (const char *url);
|
||||||
|
|
||||||
#endif /* _TALER_CURL_DEFAULTS_H */
|
#endif /* _TALER_CURL_DEFAULTS_H */
|
||||||
|
@ -626,7 +626,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
dh->dki.key.rsa_public_key = NULL; /* lifetime not warranted, so better
|
dh->dki.key.rsa_public_key = NULL; /* lifetime not warranted, so better
|
||||||
not copy the pointer */
|
not copy the pointer */
|
||||||
|
|
||||||
eh = TEL_curl_easy_get (dh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_curl_easy_post (&dh->ctx,
|
TALER_curl_easy_post (&dh->ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -366,7 +366,7 @@ TALER_EXCHANGE_deposits_get (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
dwh->depconf.h_contract_terms = *h_contract_terms;
|
dwh->depconf.h_contract_terms = *h_contract_terms;
|
||||||
dwh->depconf.coin_pub = *coin_pub;
|
dwh->depconf.coin_pub = *coin_pub;
|
||||||
|
|
||||||
eh = TEL_curl_easy_get (dwh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (dwh->url);
|
||||||
ctx = TEAH_handle_to_context (exchange);
|
ctx = TEAH_handle_to_context (exchange);
|
||||||
dwh->job = GNUNET_CURL_job_add (ctx,
|
dwh->job = GNUNET_CURL_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -1953,7 +1953,7 @@ request_keys (void *cls)
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Requesting keys with URL `%s'.\n",
|
"Requesting keys with URL `%s'.\n",
|
||||||
kr->url);
|
kr->url);
|
||||||
eh = TEL_curl_easy_get (kr->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (kr->url);
|
||||||
GNUNET_assert (CURLE_OK ==
|
GNUNET_assert (CURLE_OK ==
|
||||||
curl_easy_setopt (eh,
|
curl_easy_setopt (eh,
|
||||||
CURLOPT_VERBOSE,
|
CURLOPT_VERBOSE,
|
||||||
|
@ -455,7 +455,7 @@ 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);
|
||||||
eh = TEL_curl_easy_get (lh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (lh->url);
|
||||||
ctx = TEAH_handle_to_context (exchange);
|
ctx = TEAH_handle_to_context (exchange);
|
||||||
lh->job = GNUNET_CURL_job_add (ctx,
|
lh->job = GNUNET_CURL_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -456,7 +456,7 @@ 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);
|
||||||
eh = TEL_curl_easy_get (mh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (mh->url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_curl_easy_post (&mh->ctx,
|
TALER_curl_easy_post (&mh->ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -389,7 +389,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
ph->url = TEAH_path_to_url (exchange,
|
ph->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
ph->was_refreshed = was_refreshed;
|
ph->was_refreshed = was_refreshed;
|
||||||
eh = TEL_curl_easy_get (ph->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_curl_easy_post (&ph->ctx,
|
TALER_curl_easy_post (&ph->ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -461,7 +461,7 @@ TALER_EXCHANGE_refreshes_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
rrh->url = TEAH_path_to_url (rrh->exchange,
|
rrh->url = TEAH_path_to_url (rrh->exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
|
|
||||||
eh = TEL_curl_easy_get (rrh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (rrh->url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_curl_easy_post (&rrh->ctx,
|
TALER_curl_easy_post (&rrh->ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -387,7 +387,7 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
TALER_amount_hton (&rh->depconf.refund_fee,
|
TALER_amount_hton (&rh->depconf.refund_fee,
|
||||||
refund_fee);
|
refund_fee);
|
||||||
|
|
||||||
eh = TEL_curl_easy_get (rh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_curl_easy_post (&rh->ctx,
|
TALER_curl_easy_post (&rh->ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -274,7 +274,7 @@ 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);
|
||||||
eh = TEL_curl_easy_get (rgh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (rgh->url);
|
||||||
ctx = TEAH_handle_to_context (exchange);
|
ctx = TEAH_handle_to_context (exchange);
|
||||||
rgh->job = GNUNET_CURL_job_add (ctx,
|
rgh->job = GNUNET_CURL_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -366,7 +366,7 @@ TALER_EXCHANGE_transfers_get (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
}
|
}
|
||||||
wdh->url = TEAH_path_to_url (wdh->exchange,
|
wdh->url = TEAH_path_to_url (wdh->exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
eh = TEL_curl_easy_get (wdh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (wdh->url);
|
||||||
ctx = TEAH_handle_to_context (exchange);
|
ctx = TEAH_handle_to_context (exchange);
|
||||||
wdh->job = GNUNET_CURL_job_add (ctx,
|
wdh->job = GNUNET_CURL_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -407,7 +407,7 @@ 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, "/wire");
|
wh->url = TEAH_path_to_url (exchange, "/wire");
|
||||||
|
|
||||||
eh = TEL_curl_easy_get (wh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||||
ctx = TEAH_handle_to_context (exchange);
|
ctx = TEAH_handle_to_context (exchange);
|
||||||
wh->job = GNUNET_CURL_job_add (ctx,
|
wh->job = GNUNET_CURL_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
|
@ -426,7 +426,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
wh->ps = *ps;
|
wh->ps = *ps;
|
||||||
wh->url = TEAH_path_to_url (exchange,
|
wh->url = TEAH_path_to_url (exchange,
|
||||||
arg_str);
|
arg_str);
|
||||||
eh = TEL_curl_easy_get (wh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_curl_easy_post (&wh->ctx,
|
TALER_curl_easy_post (&wh->ctx,
|
||||||
eh,
|
eh,
|
||||||
|
Loading…
Reference in New Issue
Block a user