aboutsummaryrefslogtreecommitdiff
path: root/src/mint-tools
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-06-11 13:38:47 +0200
committerChristian Grothoff <christian@grothoff.org>2015-06-11 13:38:47 +0200
commitdc23f290eed04f22545e3146ab6a2fd56b02738f (patch)
treed6af1e021d72a304353ad9e622c854ffba36a251 /src/mint-tools
parentedc6d380824a2076f7f095a71b8cb5d53f32f6ce (diff)
fixing #3817
Diffstat (limited to 'src/mint-tools')
-rw-r--r--src/mint-tools/Makefile.am2
-rw-r--r--src/mint-tools/taler-mint-reservemod.c18
2 files changed, 18 insertions, 2 deletions
diff --git a/src/mint-tools/Makefile.am b/src/mint-tools/Makefile.am
index e22df1ed7..9849bbc54 100644
--- a/src/mint-tools/Makefile.am
+++ b/src/mint-tools/Makefile.am
@@ -41,7 +41,7 @@ taler_mint_reservemod_LDADD = \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/mintdb/libtalermintdb.la \
- -lgnunetutil $(XLIB)
+ -lgnunetutil -ljansson $(XLIB)
taler_mint_reservemod_LDFLAGS = \
$(POSTGRESQL_LDFLAGS)
taler_mint_reservemod_CPPFLAGS = \
diff --git a/src/mint-tools/taler-mint-reservemod.c b/src/mint-tools/taler-mint-reservemod.c
index 75093fc75..888b34baa 100644
--- a/src/mint-tools/taler-mint-reservemod.c
+++ b/src/mint-tools/taler-mint-reservemod.c
@@ -22,6 +22,7 @@
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <libpq-fe.h>
+#include <jansson.h>
#include "taler_mintdb_plugin.h"
/**
@@ -54,6 +55,8 @@ main (int argc, char *const *argv)
char *add_str = NULL;
struct TALER_Amount add_value;
char *details = NULL;
+ json_t *jdetails;
+ json_error_t error;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_MINTDB_Session *session;
const struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -157,11 +160,24 @@ main (int argc, char *const *argv)
"Failed to initialize DB session\n");
goto cleanup;
}
+ jdetails = json_loads (details,
+ JSON_REJECT_DUPLICATES,
+ &error);
+ if (NULL == jdetails)
+ {
+ fprintf (stderr,
+ "Failed to parse JSON transaction details `%s': %s (%s)\n",
+ details,
+ error.text,
+ error.source);
+ goto cleanup;
+ }
ret = plugin->reserves_in_insert (plugin->cls,
session,
&reserve_pub,
&add_value,
- details);
+ jdetails);
+ json_decref (jdetails);
if (GNUNET_SYSERR == ret)
{
fprintf (stderr,