paivana

HTTP paywall reverse proxy
Log | Files | Refs | README | LICENSE

commit 5bf3e1ef50add1654ac0da42ca67412b4c6d39a9
parent 7fb53e1baba076529cbc79884a4b2057d49ece73
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 16 Apr 2026 09:02:57 +0200

use timestamp

Diffstat:
Mconfigure.ac | 38++++++++++++++++++++++++++++++++++++++
Msrc/backend/paivana-httpd.c | 21+++++++++++----------
2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -188,6 +188,44 @@ AS_IF([test $jansson = 0], *** ]])]) +# Check for Taler's libtalermerchant +libtalermerchant=0 +AC_MSG_CHECKING([for libtalermerchant]) +AC_ARG_WITH(merchant, + [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])], + [AC_MSG_RESULT([given as $with_merchant])], + [AC_MSG_RESULT(not given) + with_merchant=yes]) +AS_CASE([$with_merchant], + [yes], [], + [no], [AC_MSG_ERROR([--with-merchant is required])], + [LDFLAGS="-L$with_merchant/lib/$MULTIARCH -L$with_merchant/lib/ $LDFLAGS" + CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) + +AC_CHECK_HEADERS([taler/taler_merchant_service.h], + [AC_CHECK_LIB([talermerchant], [TALER_MERCHANT_poll_payment], libtalermerchant=1)], + [], []) + + +# Check for Taler's libtalerexchange +libtalerexchange=0 +AC_MSG_CHECKING([for libtalerexchange]) +AC_ARG_WITH(exchange, + [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], + [AC_MSG_RESULT([given as $with_exchange])], + [AC_MSG_RESULT(not given) + with_exchange=yes]) +AS_CASE([$with_exchange], + [yes], [], + [no], [AC_MSG_ERROR([--with-exchange is required])], + [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" + CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) + +AC_CHECK_HEADERS([taler/taler_exchange_service.h], + [AC_CHECK_LIB([talerexchange], [TALER_EXCHANGE_parse_451], libtalerexchange=1)], + [], []) + + TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" diff --git a/src/backend/paivana-httpd.c b/src/backend/paivana-httpd.c @@ -320,14 +320,14 @@ static struct GNUNET_HashCode paivana_secret; * @param[out] c set to the cookie hash */ static void -compute_cookie_hash (struct GNUNET_TIME_Absolute expiration, +compute_cookie_hash (struct GNUNET_TIME_Timestamp expiration, size_t ca_len, const void *ca, struct GNUNET_HashCode *c) { struct GNUNET_TIME_AbsoluteNBO e; - e = GNUNET_TIME_absolute_hton (expiration); + e = GNUNET_TIME_absolute_hton (expiration.abs_time); GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_hkdf_gnunet ( c, /* result */ @@ -358,7 +358,7 @@ check_cookie (const char *cookie, unsigned long long u; struct GNUNET_HashCode h; struct GNUNET_HashCode c; - struct GNUNET_TIME_Absolute a; + struct GNUNET_TIME_Timestamp a; dash = strchr (cookie, '-'); @@ -370,8 +370,8 @@ check_cookie (const char *cookie, "%llu-", &u)) return false; - a.abs_value_us = u; - if (GNUNET_TIME_absolute_is_past (a)) + a.abs_time.abs_value_us = u * 1000LLU * 1000LLU; + if (GNUNET_TIME_absolute_is_past (a.abs_time)) return false; if (GNUNET_OK != GNUNET_STRINGS_string_to_data (dash, @@ -398,7 +398,7 @@ check_cookie (const char *cookie, * @param[out] c set to the cookie hash */ static char * -compute_cookie (struct GNUNET_TIME_Absolute expiration, +compute_cookie (struct GNUNET_TIME_Timestamp expiration, size_t ca_len, const void *ca) { @@ -416,10 +416,11 @@ compute_cookie (struct GNUNET_TIME_Absolute expiration, cstr, sizeof (cstr)); *end = '\0'; - GNUNET_asprintf (&res, - "%llu-%s", - (unsigned long long) expiration.abs_value_us, - cstr); + GNUNET_asprintf ( + &res, + "%llu-%s", + (unsigned long long) (expiration.abs_time.abs_value_us / 1000LLU / 1000LLU), + cstr); return res; }