[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-challenger] branch master updated: return id from /info endpoint,
From: |
gnunet |
Subject: |
[taler-challenger] branch master updated: return id from /info endpoint, fix argument misordering bug |
Date: |
Thu, 02 Nov 2023 23:18:21 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository challenger.
The following commit(s) were added to refs/heads/master by this push:
new 428d444 return id from /info endpoint, fix argument misordering bug
428d444 is described below
commit 428d44407d6e504afd43cff30c80679ef2cf4de0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Nov 2 23:18:17 2023 +0100
return id from /info endpoint, fix argument misordering bug
---
src/challenger/challenger-httpd_common.c | 2 +-
src/challenger/challenger-httpd_info.c | 21 ++++++++++-----------
src/challengerdb/pg_info_get_token.c | 6 +++++-
src/challengerdb/pg_info_get_token.h | 2 ++
src/include/challenger_database_plugin.h | 2 ++
5 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/src/challenger/challenger-httpd_common.c
b/src/challenger/challenger-httpd_common.c
index e9bb937..7b463bc 100644
--- a/src/challenger/challenger-httpd_common.c
+++ b/src/challenger/challenger-httpd_common.c
@@ -74,11 +74,11 @@ CH_compute_code (const struct CHALLENGER_ValidationNonceP
*nonce,
sizeof (nonce),
client_secret,
strlen (client_secret),
- client_scope,
address,
strlen (address),
client_redirect_uri,
strlen (client_redirect_uri),
+ client_scope,
NULL != client_scope
? strlen (client_scope)
: 0,
diff --git a/src/challenger/challenger-httpd_info.c
b/src/challenger/challenger-httpd_info.c
index d5b812d..54aadee 100644
--- a/src/challenger/challenger-httpd_info.c
+++ b/src/challenger/challenger-httpd_info.c
@@ -79,6 +79,7 @@ CH_handler_info (struct CH_HandlerContext *hc,
/* Check token is valid */
{
+ uint64_t id;
char *address;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Timestamp address_expiration;
@@ -86,6 +87,7 @@ CH_handler_info (struct CH_HandlerContext *hc,
qs = CH_db->info_get_token (CH_db->cls,
&grant,
+ &id,
&address,
&address_expiration);
switch (qs)
@@ -111,17 +113,14 @@ CH_handler_info (struct CH_HandlerContext *hc,
mret = TALER_MHD_REPLY_JSON_PACK (
hc->connection,
MHD_HTTP_OK,
- GNUNET_JSON_pack_string ("status",
- "success"),
- GNUNET_JSON_pack_object_steal (
- "data",
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("address",
- address),
- GNUNET_JSON_pack_string ("address_type",
- CH_address_type),
- GNUNET_JSON_pack_timestamp ("expires",
- address_expiration))));
+ GNUNET_JSON_pack_uint64 ("id",
+ id),
+ GNUNET_JSON_pack_string ("address",
+ address),
+ GNUNET_JSON_pack_string ("address_type",
+ CH_address_type),
+ GNUNET_JSON_pack_timestamp ("expires",
+ address_expiration));
GNUNET_free (address);
return mret;
}
diff --git a/src/challengerdb/pg_info_get_token.c
b/src/challengerdb/pg_info_get_token.c
index 01e94e4..853c284 100644
--- a/src/challengerdb/pg_info_get_token.c
+++ b/src/challengerdb/pg_info_get_token.c
@@ -30,6 +30,7 @@ enum GNUNET_DB_QueryStatus
CH_PG_info_get_token (
void *cls,
const struct CHALLENGER_AccessTokenP *token,
+ uint64_t *rowid,
char **address,
struct GNUNET_TIME_Timestamp *address_expiration)
{
@@ -43,6 +44,8 @@ CH_PG_info_get_token (
};
struct GNUNET_TIME_Absolute at;
struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint64 ("rowid",
+ rowid),
GNUNET_PQ_result_spec_string ("address",
address),
GNUNET_PQ_result_spec_absolute_time ("address_expiration_time",
@@ -54,7 +57,8 @@ CH_PG_info_get_token (
PREPARE (pg,
"info_get_token",
"SELECT "
- " address"
+ " grant_serial_id AS rowid"
+ " ,address"
" ,address_expiration_time"
" FROM tokens"
" WHERE access_token=$1"
diff --git a/src/challengerdb/pg_info_get_token.h
b/src/challengerdb/pg_info_get_token.h
index 2d41a28..96a0a80 100644
--- a/src/challengerdb/pg_info_get_token.h
+++ b/src/challengerdb/pg_info_get_token.h
@@ -31,6 +31,7 @@
*
* @param cls closure
* @param grant grant token that grants access
+ * @param[out] rowid account identifier within challenger
* @param[out] address set to the address under @a grant
* @param[out] address_expiration set to how long we consider @a address to be
valid
* @return transaction status
@@ -39,6 +40,7 @@ enum GNUNET_DB_QueryStatus
CH_PG_info_get_token (
void *cls,
const struct CHALLENGER_AccessTokenP *grant,
+ uint64_t *rowid,
char **address,
struct GNUNET_TIME_Timestamp *address_expiration);
diff --git a/src/include/challenger_database_plugin.h
b/src/include/challenger_database_plugin.h
index a513428..7c86e49 100644
--- a/src/include/challenger_database_plugin.h
+++ b/src/include/challenger_database_plugin.h
@@ -347,6 +347,7 @@ struct CHALLENGER_DatabasePlugin
*
* @param cls closure
* @param grant grant token that grants access
+ * @param[out] rowid account identifier within challenger
* @param[out] address set to the address under @a grant
* @param[out] address_expiration set to how long we consider @a address to
be valid
* @return transaction status
@@ -354,6 +355,7 @@ struct CHALLENGER_DatabasePlugin
enum GNUNET_DB_QueryStatus
(*info_get_token)(void *cls,
const struct CHALLENGER_AccessTokenP *grant,
+ uint64_t *rowid,
char **address,
struct GNUNET_TIME_Timestamp *address_expiration);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-challenger] branch master updated: return id from /info endpoint, fix argument misordering bug,
gnunet <=