gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-challenger] branch master updated: -fix test


From: gnunet
Subject: [taler-challenger] branch master updated: -fix test
Date: Wed, 15 Nov 2023 23:18:47 +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 233a935  -fix test
233a935 is described below

commit 233a935497745df0c311c671557389a728164dd9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Nov 15 23:18:43 2023 +0100

    -fix test
---
 src/challenger/cat.sh                    |  2 +-
 src/challenger/challenger-httpd_info.c   |  7 +++----
 src/challenger/challenger-httpd_solve.c  |  9 +++++++++
 src/challenger/test-challenger.sh        | 12 +++++++-----
 src/challengerdb/pg_info_get_token.c     |  6 +++---
 src/challengerdb/pg_info_get_token.h     |  2 +-
 src/include/challenger_database_plugin.h |  2 +-
 7 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/src/challenger/cat.sh b/src/challenger/cat.sh
index a9fc7a4..0d57888 100755
--- a/src/challenger/cat.sh
+++ b/src/challenger/cat.sh
@@ -1,4 +1,4 @@
 #!/bin/bash
 # This file is in the public domain.
-cat - > "$1"
+cat - > "$(echo $1 | jq -r ".filename")"
 exit 0
diff --git a/src/challenger/challenger-httpd_info.c 
b/src/challenger/challenger-httpd_info.c
index 54aadee..6d687e2 100644
--- a/src/challenger/challenger-httpd_info.c
+++ b/src/challenger/challenger-httpd_info.c
@@ -80,7 +80,7 @@ CH_handler_info (struct CH_HandlerContext *hc,
   /* Check token is valid */
   {
     uint64_t id;
-    char *address;
+    json_t *address;
     enum GNUNET_DB_QueryStatus qs;
     struct GNUNET_TIME_Timestamp address_expiration;
     MHD_RESULT mret;
@@ -115,13 +115,12 @@ CH_handler_info (struct CH_HandlerContext *hc,
       MHD_HTTP_OK,
       GNUNET_JSON_pack_uint64 ("id",
                                id),
-      GNUNET_JSON_pack_string ("address",
-                               address),
+      GNUNET_JSON_pack_object_steal ("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/challenger/challenger-httpd_solve.c 
b/src/challenger/challenger-httpd_solve.c
index fd95da2..0d00ed9 100644
--- a/src/challenger/challenger-httpd_solve.c
+++ b/src/challenger/challenger-httpd_solve.c
@@ -175,6 +175,15 @@ CH_handler_solve (struct CH_HandlerContext *hc,
       return MHD_YES;
     return MHD_NO;
   }
+  if (NULL == bc->pin)
+  {
+    GNUNET_break_op (0);
+    return TALER_TEMPLATING_reply_error (hc->connection,
+                                         "invalid-request",
+                                         MHD_HTTP_BAD_REQUEST,
+                                         TALER_EC_GENERIC_PARAMETER_MISSING,
+                                         "pin");
+  }
   {
     unsigned int pin;
     char dummy;
diff --git a/src/challenger/test-challenger.sh 
b/src/challenger/test-challenger.sh
index 6a1e34d..6e18a95 100755
--- a/src/challenger/test-challenger.sh
+++ b/src/challenger/test-challenger.sh
@@ -61,7 +61,7 @@ echo " OK"
 CLIENT_ID=1
 
 echo -n "Start challenger-httpd ..."
-challenger-httpd -L INFO -c "${CONF}" &> httpd.log &
+valgrind challenger-httpd -L INFO -c "${CONF}" &> httpd.log &
 
 # Wait for challenger to be available
 for n in $(seq 1 50)
@@ -117,7 +117,7 @@ echo "OK"
 echo -n "Initiating address submission..."
 STATUS=$(curl "${BURL}/challenge/${NONCE}" \
     -X POST \
-    --data-urlencode "address=${FILENAME}" \
+    --data-urlencode "filename=${FILENAME}" \
     -w "%{http_code}" -s -o $LAST_RESPONSE)
 
 if [ "$STATUS" != "200" ]
@@ -169,7 +169,7 @@ if [ "$STATUS" != "200" ]
 then
     exit_fail "Expected 200 OK. Got: $STATUS" $(cat $LAST_RESPONSE)
 fi
-TOKEN_TYPE=$(cat $LAST_RESPONSE | jq -r .token_type)
+TOKEN_TYPE="$(cat $LAST_RESPONSE | jq -r .token_type)"
 if [ "$TOKEN_TYPE" != "Bearer" ]
 then
     exit_fail "Expected Bearer token. Got: $TOKEN_TYPE"
@@ -187,8 +187,10 @@ then
     exit_fail "Expected 200 OK. Got: $STATUS" $(cat $LAST_RESPONSE)
 fi
 
-TADDRESS=$(cat $LAST_RESPONSE | jq -r .address)
-TADDRESS_TYPE=$(cat $LAST_RESPONSE | jq -r .address_type)
+cat $LAST_RESPONSE | jq
+
+TADDRESS=$(cat "$LAST_RESPONSE" | jq -r .address.filename)
+TADDRESS_TYPE=$(cat "$LAST_RESPONSE" | jq -r .address_type)
 
 if [ "$TADDRESS" != "$FILENAME" ]
 then
diff --git a/src/challengerdb/pg_info_get_token.c 
b/src/challengerdb/pg_info_get_token.c
index 853c284..0cc7382 100644
--- a/src/challengerdb/pg_info_get_token.c
+++ b/src/challengerdb/pg_info_get_token.c
@@ -31,7 +31,7 @@ CH_PG_info_get_token (
   void *cls,
   const struct CHALLENGER_AccessTokenP *token,
   uint64_t *rowid,
-  char **address,
+  json_t **address,
   struct GNUNET_TIME_Timestamp *address_expiration)
 {
   struct PostgresClosure *pg = cls;
@@ -46,8 +46,8 @@ CH_PG_info_get_token (
   struct GNUNET_PQ_ResultSpec rs[] = {
     GNUNET_PQ_result_spec_uint64 ("rowid",
                                   rowid),
-    GNUNET_PQ_result_spec_string ("address",
-                                  address),
+    TALER_PQ_result_spec_json ("address",
+                               address),
     GNUNET_PQ_result_spec_absolute_time ("address_expiration_time",
                                          &at),
     GNUNET_PQ_result_spec_end
diff --git a/src/challengerdb/pg_info_get_token.h 
b/src/challengerdb/pg_info_get_token.h
index 96a0a80..6d98c3f 100644
--- a/src/challengerdb/pg_info_get_token.h
+++ b/src/challengerdb/pg_info_get_token.h
@@ -41,7 +41,7 @@ CH_PG_info_get_token (
   void *cls,
   const struct CHALLENGER_AccessTokenP *grant,
   uint64_t *rowid,
-  char **address,
+  json_t **address,
   struct GNUNET_TIME_Timestamp *address_expiration);
 
 
diff --git a/src/include/challenger_database_plugin.h 
b/src/include/challenger_database_plugin.h
index d4e1f88..ccceb7c 100644
--- a/src/include/challenger_database_plugin.h
+++ b/src/include/challenger_database_plugin.h
@@ -356,7 +356,7 @@ struct CHALLENGER_DatabasePlugin
   (*info_get_token)(void *cls,
                     const struct CHALLENGER_AccessTokenP *grant,
                     uint64_t *rowid,
-                    char **address,
+                    json_t **address,
                     struct GNUNET_TIME_Timestamp *address_expiration);
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]