summaryrefslogtreecommitdiff
path: root/src/authorization
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-31 22:50:16 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-31 22:50:21 +0200
commit1db139a7f3b74b2dc4135ab8b42d625415705d63 (patch)
treedbbd66f083001bdefc9b029c1f45a5c2cf93697e /src/authorization
parent812423c3872dce704ce9161127c7ebfbb7034fbe (diff)
downloadanastasis-1db139a7f3b74b2dc4135ab8b42d625415705d63.tar.gz
anastasis-1db139a7f3b74b2dc4135ab8b42d625415705d63.tar.bz2
anastasis-1db139a7f3b74b2dc4135ab8b42d625415705d63.zip
-eliminating some legacy json_pack calls from Anastasis
Diffstat (limited to 'src/authorization')
-rw-r--r--src/authorization/anastasis_authorization_plugin_email.c19
-rw-r--r--src/authorization/anastasis_authorization_plugin_file.c10
-rw-r--r--src/authorization/anastasis_authorization_plugin_post.c20
-rw-r--r--src/authorization/anastasis_authorization_plugin_sms.c20
4 files changed, 27 insertions, 42 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_email.c b/src/authorization/anastasis_authorization_plugin_email.c
index 33c400b..5448b7d 100644
--- a/src/authorization/anastasis_authorization_plugin_email.c
+++ b/src/authorization/anastasis_authorization_plugin_email.c
@@ -436,22 +436,19 @@ email_process (struct ANASTASIS_AUTHORIZATION_State *as,
if (TALER_MHD_xmime_matches (mime,
"application/json"))
{
- json_t *body;
char *user;
user = GNUNET_strndup (as->email,
len);
- body = json_pack ("{s:I, s:s, s:s}",
- "code",
- TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED,
- "hint",
- TALER_ErrorCode_get_hint (
- TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED),
- "detail",
- user);
+ resp = TALER_MHD_MAKE_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("code",
+ TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED),
+ GNUNET_JSON_pack_string ("hint",
+ TALER_ErrorCode_get_hint (
+ TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED)),
+ GNUNET_JSON_pack_string ("detail",
+ user));
GNUNET_free (user);
- GNUNET_break (NULL != body);
- resp = TALER_MHD_make_json (body);
}
else
{
diff --git a/src/authorization/anastasis_authorization_plugin_file.c b/src/authorization/anastasis_authorization_plugin_file.c
index 210ade7..15c22a1 100644
--- a/src/authorization/anastasis_authorization_plugin_file.c
+++ b/src/authorization/anastasis_authorization_plugin_file.c
@@ -209,13 +209,9 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
if (TALER_MHD_xmime_matches (mime,
"application/json"))
{
- json_t *body;
-
- body = json_pack ("{s:s}",
- "filename",
- as->filename);
- GNUNET_break (NULL != body);
- resp = TALER_MHD_make_json (body);
+ resp = TALER_MHD_MAKE_JSON_PACK (
+ GNUNET_JSON_pack_string ("filename",
+ as->filename));
}
else
{
diff --git a/src/authorization/anastasis_authorization_plugin_post.c b/src/authorization/anastasis_authorization_plugin_post.c
index 1f20ff3..1240316 100644
--- a/src/authorization/anastasis_authorization_plugin_post.c
+++ b/src/authorization/anastasis_authorization_plugin_post.c
@@ -500,18 +500,14 @@ post_process (struct ANASTASIS_AUTHORIZATION_State *as,
if (TALER_MHD_xmime_matches (mime,
"application/json"))
{
- json_t *body;
-
- body = json_pack ("{s:I, s:s, s:s}",
- "code",
- TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED,
- "hint",
- TALER_ErrorCode_get_hint (
- TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED),
- "detail",
- zip);
- GNUNET_break (NULL != body);
- resp = TALER_MHD_make_json (body);
+ resp = TALER_MHD_MAKE_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("code",
+ TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED),
+ GNUNET_JSON_pack_string ("hint",
+ TALER_ErrorCode_get_hint (
+ TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED)),
+ GNUNET_JSON_pack_string ("detail",
+ zip));
}
else
{
diff --git a/src/authorization/anastasis_authorization_plugin_sms.c b/src/authorization/anastasis_authorization_plugin_sms.c
index 01b5f73..0cd36c5 100644
--- a/src/authorization/anastasis_authorization_plugin_sms.c
+++ b/src/authorization/anastasis_authorization_plugin_sms.c
@@ -433,18 +433,14 @@ sms_process (struct ANASTASIS_AUTHORIZATION_State *as,
if (TALER_MHD_xmime_matches (mime,
"application/json"))
{
- json_t *body;
-
- body = json_pack ("{s:I, s:s, s:s}",
- "code",
- TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED,
- "hint",
- TALER_ErrorCode_get_hint (
- TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED),
- "detail",
- end);
- GNUNET_break (NULL != body);
- resp = TALER_MHD_make_json (body);
+ resp = TALER_MHD_MAKE_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("code",
+ TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED),
+ GNUNET_JSON_pack_string ("hint",
+ TALER_ErrorCode_get_hint (
+ TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED)),
+ GNUNET_JSON_pack_string ("detail",
+ end));
}
else
{