summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-08 09:27:39 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-08 09:27:43 +0100
commitae18c202557cebfba21f2193e2d5df1a267c1b96 (patch)
tree58a45eb210d0a82872b74f40723dae1acac94054 /src/backend
parent3015d13f6e6d11faa8348772756b1a56931de4fd (diff)
downloadmerchant-ae18c202557cebfba21f2193e2d5df1a267c1b96.tar.gz
merchant-ae18c202557cebfba21f2193e2d5df1a267c1b96.tar.bz2
merchant-ae18c202557cebfba21f2193e2d5df1a267c1b96.zip
auto-prefix -a password overrides with RFC 8959 prefix
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index e7f4dc2f..7bd99de3 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -164,6 +164,10 @@ TMH_check_auth (const char *token,
dec_len = GNUNET_STRINGS_urldecode (token,
strlen (token),
&dec);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Checking against token %s with salt %s\n",
+ dec,
+ TALER_B2S (salt));
GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (&val,
sizeof (val),
@@ -191,6 +195,10 @@ TMH_compute_auth (const char *token,
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
salt,
sizeof (*salt));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Computing initial auth using token %s with salt %s\n",
+ token,
+ TALER_B2S (salt));
GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (hash,
sizeof (*hash),
@@ -1174,6 +1182,8 @@ url_handler (void *cls,
(NULL != hc->instance) )
{
/* Override default instance access control */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Overriding access control\n");
TMH_compute_auth (TMH_default_auth,
&hc->instance->auth.auth_salt,
&hc->instance->auth.auth_hash);
@@ -1681,6 +1691,20 @@ run (void *cls,
if ( (NULL != tok) &&
(NULL == TMH_default_auth) )
TMH_default_auth = GNUNET_strdup (tok);
+ if ( (NULL != TMH_default_auth) &&
+ (0 != strcasecmp (TMH_default_auth,
+ RFC_8959_PREFIX,
+ strlen (RFC_8959_PREFIX))) )
+ {
+ char *tmp;
+
+ GNUNET_asprintf (&tmp,
+ "%s%s",
+ RFC_8959_PREFIX,
+ TMH_default_auth);
+ GNUNET_free (TMH_default_auth);
+ TMH_default_auth = tmp;
+ }
cfg = config;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Starting taler-merchant-httpd\n");