diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-16 15:04:47 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-16 15:04:47 +0100 |
commit | 7fe250407c440e59bece248747ffe8b29a8833b3 (patch) | |
tree | a662277cbce80249ddf8b3fef9e129d5dff7e8fd | |
parent | 4bd515191b6db342ff465e0595cfeafe6da8a680 (diff) | |
download | exchange-7fe250407c440e59bece248747ffe8b29a8833b3.tar.gz exchange-7fe250407c440e59bece248747ffe8b29a8833b3.zip |
clean up (and rename) request_json_require_nav to properly report parsing errors
-rw-r--r-- | src/mint/taler-mint-httpd_deposit.c | 7 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_parsing.c | 156 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_parsing.h | 80 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_refresh.c | 36 |
4 files changed, 151 insertions, 128 deletions
diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c index d92dd5ef7..eaced51c2 100644 --- a/src/mint/taler-mint-httpd_deposit.c +++ b/src/mint/taler-mint-httpd_deposit.c | |||
@@ -131,9 +131,10 @@ TALER_MINT_handler_deposit (struct RequestHandler *rh, | |||
131 | if (cond) { GNUNET_break (0); goto EXITIF_exit; } \ | 131 | if (cond) { GNUNET_break (0); goto EXITIF_exit; } \ |
132 | } while (0) | 132 | } while (0) |
133 | #define PARSE_DATA(field, addr) \ | 133 | #define PARSE_DATA(field, addr) \ |
134 | EXITIF (GNUNET_OK != request_json_require_nav \ | 134 | EXITIF (GNUNET_OK != \ |
135 | (connection, json, \ | 135 | GNUNET_MINT_parse_navigate_json \ |
136 | JNAV_FIELD, field, JNAV_RET_DATA, addr, sizeof (*addr))) | 136 | (connection, json, \ |
137 | JNAV_FIELD, field, JNAV_RET_DATA, addr, sizeof (*addr))) | ||
137 | PARSE_DATA ("coin_pub", &deposit->coin_pub); | 138 | PARSE_DATA ("coin_pub", &deposit->coin_pub); |
138 | PARSE_DATA ("denom_pub", &deposit->denom_pub); | 139 | PARSE_DATA ("denom_pub", &deposit->denom_pub); |
139 | PARSE_DATA ("ubsig", &ubsig); | 140 | PARSE_DATA ("ubsig", &ubsig); |
diff --git a/src/mint/taler-mint-httpd_parsing.c b/src/mint/taler-mint-httpd_parsing.c index 19c88d456..7d3f3b5e6 100644 --- a/src/mint/taler-mint-httpd_parsing.c +++ b/src/mint/taler-mint-httpd_parsing.c | |||
@@ -271,44 +271,48 @@ TALER_MINT_parse_post_cleanup_callback (void *con_cls) | |||
271 | * @param ... navigation specification (see JNAV_*) | 271 | * @param ... navigation specification (see JNAV_*) |
272 | * @return GNUNET_YES if navigation was successful | 272 | * @return GNUNET_YES if navigation was successful |
273 | * GNUNET_NO if json is malformed, error response was generated | 273 | * GNUNET_NO if json is malformed, error response was generated |
274 | * GNUNET_SYSERR on internal error | 274 | * GNUNET_SYSERR on internal error (no response was generated, |
275 | * connection must be closed) | ||
275 | */ | 276 | */ |
276 | int | 277 | int |
277 | request_json_require_nav (struct MHD_Connection *connection, | 278 | GNUNET_MINT_parse_navigate_json (struct MHD_Connection *connection, |
278 | const json_t *root, ...) | 279 | const json_t *root, |
280 | ...) | ||
279 | { | 281 | { |
280 | va_list argp; | 282 | va_list argp; |
281 | int ignore = GNUNET_NO; | 283 | int ret; |
282 | // what's our current path from 'root'? | 284 | json_t *path; /* what's our current path from 'root'? */ |
283 | json_t *path; | ||
284 | 285 | ||
285 | path = json_array (); | 286 | path = json_array (); |
286 | 287 | va_start (argp, root); | |
287 | va_start(argp, root); | 288 | ret = 2; |
288 | 289 | while (2 == ret) | |
289 | while (1) | ||
290 | { | 290 | { |
291 | int command = va_arg(argp, int); | 291 | enum TALER_MINT_JsonNavigationCommand command |
292 | = va_arg (argp, | ||
293 | enum TALER_MINT_JsonNavigationCommand); | ||
294 | |||
292 | switch (command) | 295 | switch (command) |
293 | { | 296 | { |
294 | case JNAV_FIELD: | 297 | case JNAV_FIELD: |
295 | { | 298 | { |
296 | const char *fname = va_arg(argp, const char *); | 299 | const char *fname = va_arg(argp, const char *); |
297 | if (GNUNET_YES == ignore) | 300 | |
298 | break; | 301 | json_array_append_new (path, |
299 | json_array_append_new (path, json_string (fname)); | 302 | json_string (fname)); |
300 | root = json_object_get (root, fname); | 303 | root = json_object_get (root, |
304 | fname); | ||
301 | if (NULL == root) | 305 | if (NULL == root) |
302 | { | 306 | { |
303 | /* FIXME: can't IGNORE this return value! */ | 307 | ret = (MHD_YES == |
304 | (void) TALER_MINT_reply_json_pack (connection, | 308 | TALER_MINT_reply_json_pack (connection, |
305 | MHD_HTTP_BAD_REQUEST, | 309 | MHD_HTTP_BAD_REQUEST, |
306 | "{s:s,s:o}", | 310 | "{s:s,s:o}", |
307 | "error", | 311 | "error", |
308 | "missing field in JSON", | 312 | "missing field in JSON", |
309 | "path", | 313 | "path", |
310 | path); | 314 | path)) |
311 | ignore = GNUNET_YES; | 315 | ? GNUNET_NO : GNUNET_SYSERR; |
312 | break; | 316 | break; |
313 | } | 317 | } |
314 | } | 318 | } |
@@ -316,19 +320,21 @@ request_json_require_nav (struct MHD_Connection *connection, | |||
316 | case JNAV_INDEX: | 320 | case JNAV_INDEX: |
317 | { | 321 | { |
318 | int fnum = va_arg(argp, int); | 322 | int fnum = va_arg(argp, int); |
319 | if (GNUNET_YES == ignore) | 323 | |
320 | break; | 324 | json_array_append_new (path, |
321 | json_array_append_new (path, json_integer (fnum)); | 325 | json_integer (fnum)); |
322 | root = json_array_get (root, fnum); | 326 | root = json_array_get (root, |
327 | fnum); | ||
323 | if (NULL == root) | 328 | if (NULL == root) |
324 | { | 329 | { |
325 | /* FIXME: can't IGNORE this return value! */ | 330 | ret = (MHD_YES == |
326 | (void) TALER_MINT_reply_json_pack (connection, | 331 | TALER_MINT_reply_json_pack (connection, |
327 | MHD_HTTP_BAD_REQUEST, | 332 | MHD_HTTP_BAD_REQUEST, |
328 | "{s:s, s:o}", | 333 | "{s:s, s:o}", |
329 | "error", "missing index in JSON", | 334 | "error", |
330 | "path", path); | 335 | "missing index in JSON", |
331 | ignore = GNUNET_YES; | 336 | "path", path)) |
337 | ? GNUNET_NO : GNUNET_SYSERR; | ||
332 | break; | 338 | break; |
333 | } | 339 | } |
334 | } | 340 | } |
@@ -340,36 +346,36 @@ request_json_require_nav (struct MHD_Connection *connection, | |||
340 | const char *str; | 346 | const char *str; |
341 | int res; | 347 | int res; |
342 | 348 | ||
343 | va_end(argp); | ||
344 | if (GNUNET_YES == ignore) | ||
345 | return GNUNET_NO; | ||
346 | str = json_string_value (root); | 349 | str = json_string_value (root); |
347 | if (NULL == str) | 350 | if (NULL == str) |
348 | { | 351 | { |
349 | /* FIXME: can't IGNORE this return value! */ | 352 | ret = (MHD_YES == |
350 | (void) TALER_MINT_reply_json_pack (connection, | 353 | TALER_MINT_reply_json_pack (connection, |
351 | MHD_HTTP_BAD_REQUEST, | 354 | MHD_HTTP_BAD_REQUEST, |
352 | "{s:s, s:o}", | 355 | "{s:s, s:o}", |
353 | "error", | 356 | "error", |
354 | "string expected", | 357 | "string expected", |
355 | "path", | 358 | "path", |
356 | path); | 359 | path)) |
357 | return GNUNET_NO; | 360 | ? GNUNET_NO : GNUNET_SYSERR; |
361 | break; | ||
358 | } | 362 | } |
359 | res = GNUNET_STRINGS_string_to_data (str, strlen (str), | 363 | res = GNUNET_STRINGS_string_to_data (str, strlen (str), |
360 | where, len); | 364 | where, len); |
361 | if (GNUNET_OK != res) | 365 | if (GNUNET_OK != res) |
362 | { | 366 | { |
363 | /* FIXME: can't IGNORE this return value! */ | 367 | ret = (MHD_YES == |
364 | (void) TALER_MINT_reply_json_pack (connection, | 368 | TALER_MINT_reply_json_pack (connection, |
365 | MHD_HTTP_BAD_REQUEST, | 369 | MHD_HTTP_BAD_REQUEST, |
366 | "{s:s,s:o}", | 370 | "{s:s,s:o}", |
367 | "error", | 371 | "error", |
368 | "malformed binary data in JSON", | 372 | "malformed binary data in JSON", |
369 | "path", path); | 373 | "path", |
370 | return GNUNET_NO; | 374 | path)) |
375 | ? GNUNET_NO : GNUNET_SYSERR; | ||
376 | break; | ||
371 | } | 377 | } |
372 | return GNUNET_YES; | 378 | ret = GNUNET_OK; |
373 | } | 379 | } |
374 | break; | 380 | break; |
375 | case JNAV_RET_DATA_VAR: | 381 | case JNAV_RET_DATA_VAR: |
@@ -378,35 +384,42 @@ request_json_require_nav (struct MHD_Connection *connection, | |||
378 | size_t *len = va_arg (argp, size_t *); | 384 | size_t *len = va_arg (argp, size_t *); |
379 | const char *str; | 385 | const char *str; |
380 | 386 | ||
381 | va_end(argp); | ||
382 | if (GNUNET_YES == ignore) | ||
383 | return GNUNET_NO; | ||
384 | str = json_string_value (root); | 387 | str = json_string_value (root); |
385 | if (NULL == str) | 388 | if (NULL == str) |
386 | { | 389 | { |
387 | GNUNET_break (0); | 390 | ret = (MHD_YES == |
388 | return GNUNET_SYSERR; | 391 | TALER_MINT_reply_internal_error (connection, |
392 | "json_string_value() failed")) | ||
393 | ? GNUNET_NO : GNUNET_SYSERR; | ||
394 | break; | ||
389 | } | 395 | } |
390 | *len = (strlen (str) * 5) / 8; | 396 | *len = (strlen (str) * 5) / 8; |
391 | if (where != NULL) | 397 | if (NULL != where) |
392 | { | 398 | { |
393 | int res; | 399 | int res; |
400 | |||
394 | *where = GNUNET_malloc (*len); | 401 | *where = GNUNET_malloc (*len); |
395 | res = GNUNET_STRINGS_string_to_data (str, strlen (str), | 402 | res = GNUNET_STRINGS_string_to_data (str, |
396 | *where, *len); | 403 | strlen (str), |
404 | *where, | ||
405 | *len); | ||
397 | if (GNUNET_OK != res) | 406 | if (GNUNET_OK != res) |
398 | { | 407 | { |
399 | /* FIXME: can't IGNORE this return value! */ | 408 | GNUNET_free (*where); |
400 | (void) TALER_MINT_reply_json_pack (connection, | 409 | *where = NULL; |
410 | *len = 0; | ||
411 | ret = (MHD_YES == | ||
412 | TALER_MINT_reply_json_pack (connection, | ||
401 | MHD_HTTP_BAD_REQUEST, | 413 | MHD_HTTP_BAD_REQUEST, |
402 | "{s:s, s:o}", | 414 | "{s:s, s:o}", |
403 | "error", | 415 | "error", |
404 | "malformed binary data in JSON", | 416 | "malformed binary data in JSON", |
405 | "path", path); | 417 | "path", path)) |
406 | return GNUNET_NO; | 418 | ? GNUNET_NO : GNUNET_SYSERR; |
419 | break; | ||
407 | } | 420 | } |
408 | } | 421 | } |
409 | return GNUNET_OK; | 422 | ret = GNUNET_OK; |
410 | } | 423 | } |
411 | break; | 424 | break; |
412 | case JNAV_RET_TYPED_JSON: | 425 | case JNAV_RET_TYPED_JSON: |
@@ -414,30 +427,35 @@ request_json_require_nav (struct MHD_Connection *connection, | |||
414 | int typ = va_arg (argp, int); | 427 | int typ = va_arg (argp, int); |
415 | const json_t **r_json = va_arg (argp, const json_t **); | 428 | const json_t **r_json = va_arg (argp, const json_t **); |
416 | 429 | ||
417 | va_end(argp); | 430 | if ( (-1 != typ) && (json_typeof (root) != typ)) |
418 | if (GNUNET_YES == ignore) | ||
419 | return GNUNET_NO; | ||
420 | if (typ != -1 && json_typeof (root) != typ) | ||
421 | { | 431 | { |
422 | /* FIXME: can't IGNORE this return value! */ | 432 | ret = (MHD_YES == |
423 | (void) TALER_MINT_reply_json_pack (connection, | 433 | TALER_MINT_reply_json_pack (connection, |
424 | MHD_HTTP_BAD_REQUEST, | 434 | MHD_HTTP_BAD_REQUEST, |
425 | "{s:s, s:i, s:i s:o}", | 435 | "{s:s, s:i, s:i s:o}", |
426 | "error", "wrong JSON field type", | 436 | "error", "wrong JSON field type", |
427 | "type_expected", typ, | 437 | "type_expected", typ, |
428 | "type_actual", json_typeof (root), | 438 | "type_actual", json_typeof (root), |
429 | "path", path); | 439 | "path", path)) |
430 | return GNUNET_NO; | 440 | ? GNUNET_NO : GNUNET_SYSERR; |
441 | break; | ||
431 | } | 442 | } |
432 | *r_json = root; | 443 | *r_json = root; |
433 | return GNUNET_OK; | 444 | ret = GNUNET_OK; |
434 | } | 445 | } |
435 | break; | 446 | break; |
436 | default: | 447 | default: |
437 | GNUNET_assert (0); | 448 | GNUNET_break (0); |
449 | ret = (MHD_YES == | ||
450 | TALER_MINT_reply_internal_error (connection, | ||
451 | "unhandled value in switch")) | ||
452 | ? GNUNET_NO : GNUNET_SYSERR; | ||
453 | break; | ||
438 | } | 454 | } |
439 | } | 455 | } |
440 | GNUNET_assert (0); | 456 | va_end (argp); |
457 | json_decref (path); | ||
458 | return ret; | ||
441 | } | 459 | } |
442 | 460 | ||
443 | 461 | ||
diff --git a/src/mint/taler-mint-httpd_parsing.h b/src/mint/taler-mint-httpd_parsing.h index c725187c5..a03f2b62d 100644 --- a/src/mint/taler-mint-httpd_parsing.h +++ b/src/mint/taler-mint-httpd_parsing.h | |||
@@ -31,43 +31,6 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Constants for JSON navigation description. | ||
35 | */ | ||
36 | enum | ||
37 | { | ||
38 | /** | ||
39 | * Access a field. | ||
40 | * Param: const char * | ||
41 | */ | ||
42 | JNAV_FIELD, | ||
43 | /** | ||
44 | * Access an array index. | ||
45 | * Param: int | ||
46 | */ | ||
47 | JNAV_INDEX, | ||
48 | /** | ||
49 | * Return base32crockford encoded data of | ||
50 | * constant size. | ||
51 | * Params: (void *, size_t) | ||
52 | */ | ||
53 | JNAV_RET_DATA, | ||
54 | /** | ||
55 | * Return base32crockford encoded data of | ||
56 | * variable size. | ||
57 | * Params: (void **, size_t *) | ||
58 | */ | ||
59 | JNAV_RET_DATA_VAR, | ||
60 | /** | ||
61 | * Return a json object, which must be | ||
62 | * of the given type (JSON_* type constants, | ||
63 | * or -1 for any type). | ||
64 | * Params: (int, json_t **) | ||
65 | */ | ||
66 | JNAV_RET_TYPED_JSON | ||
67 | }; | ||
68 | |||
69 | |||
70 | /** | ||
71 | * Process a POST request containing a JSON object. This | 34 | * Process a POST request containing a JSON object. This |
72 | * function realizes an MHD POST processor that will | 35 | * function realizes an MHD POST processor that will |
73 | * (incrementally) process JSON data uploaded to the HTTP | 36 | * (incrementally) process JSON data uploaded to the HTTP |
@@ -111,6 +74,47 @@ TALER_MINT_parse_post_cleanup_callback (void *con_cls); | |||
111 | 74 | ||
112 | 75 | ||
113 | /** | 76 | /** |
77 | * Constants for JSON navigation description. | ||
78 | */ | ||
79 | enum TALER_MINT_JsonNavigationCommand | ||
80 | { | ||
81 | /** | ||
82 | * Access a field. | ||
83 | * Param: const char * | ||
84 | */ | ||
85 | JNAV_FIELD, | ||
86 | |||
87 | /** | ||
88 | * Access an array index. | ||
89 | * Param: int | ||
90 | */ | ||
91 | JNAV_INDEX, | ||
92 | |||
93 | /** | ||
94 | * Return base32crockford encoded data of | ||
95 | * constant size. | ||
96 | * Params: (void *, size_t) | ||
97 | */ | ||
98 | JNAV_RET_DATA, | ||
99 | |||
100 | /** | ||
101 | * Return base32crockford encoded data of | ||
102 | * variable size. | ||
103 | * Params: (void **, size_t *) | ||
104 | */ | ||
105 | JNAV_RET_DATA_VAR, | ||
106 | |||
107 | /** | ||
108 | * Return a json object, which must be | ||
109 | * of the given type (JSON_* type constants, | ||
110 | * or -1 for any type). | ||
111 | * Params: (int, json_t **) | ||
112 | */ | ||
113 | JNAV_RET_TYPED_JSON | ||
114 | }; | ||
115 | |||
116 | |||
117 | /** | ||
114 | * Navigate through a JSON tree. | 118 | * Navigate through a JSON tree. |
115 | * | 119 | * |
116 | * Sends an error response if navigation is impossible (i.e. | 120 | * Sends an error response if navigation is impossible (i.e. |
@@ -124,7 +128,7 @@ TALER_MINT_parse_post_cleanup_callback (void *con_cls); | |||
124 | * GNUNET_SYSERR on internal error | 128 | * GNUNET_SYSERR on internal error |
125 | */ | 129 | */ |
126 | int | 130 | int |
127 | request_json_require_nav (struct MHD_Connection *connection, | 131 | GNUNET_MINT_parse_navigate_json (struct MHD_Connection *connection, |
128 | const json_t *root, ...); | 132 | const json_t *root, ...); |
129 | 133 | ||
130 | 134 | ||
diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c index 1f19aedb2..ab21e814c 100644 --- a/src/mint/taler-mint-httpd_refresh.c +++ b/src/mint/taler-mint-httpd_refresh.c | |||
@@ -125,7 +125,7 @@ refresh_accept_denoms (struct MHD_Connection *connection, | |||
125 | int res; | 125 | int res; |
126 | json_t *new_denoms; | 126 | json_t *new_denoms; |
127 | 127 | ||
128 | res = request_json_require_nav (connection, root, | 128 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
129 | JNAV_FIELD, "new_denoms", | 129 | JNAV_FIELD, "new_denoms", |
130 | JNAV_RET_TYPED_JSON, | 130 | JNAV_RET_TYPED_JSON, |
131 | JSON_ARRAY, | 131 | JSON_ARRAY, |
@@ -142,7 +142,7 @@ refresh_accept_denoms (struct MHD_Connection *connection, | |||
142 | struct TALER_MINT_DenomKeyIssue *dki; | 142 | struct TALER_MINT_DenomKeyIssue *dki; |
143 | struct TALER_Amount cost; | 143 | struct TALER_Amount cost; |
144 | 144 | ||
145 | res = request_json_require_nav (connection, root, | 145 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
146 | JNAV_FIELD, "new_denoms", | 146 | JNAV_FIELD, "new_denoms", |
147 | JNAV_INDEX, (int) i, | 147 | JNAV_INDEX, (int) i, |
148 | JNAV_RET_DATA, | 148 | JNAV_RET_DATA, |
@@ -210,7 +210,7 @@ check_confirm_signature (struct MHD_Connection *connection, | |||
210 | body.purpose.purpose = htonl (TALER_SIGNATURE_REFRESH_MELT_CONFIRM); | 210 | body.purpose.purpose = htonl (TALER_SIGNATURE_REFRESH_MELT_CONFIRM); |
211 | body.session_pub = *session_pub; | 211 | body.session_pub = *session_pub; |
212 | 212 | ||
213 | res = request_json_require_nav (connection, coin_info, | 213 | res = GNUNET_MINT_parse_navigate_json (connection, coin_info, |
214 | JNAV_FIELD, "confirm_sig", | 214 | JNAV_FIELD, "confirm_sig", |
215 | JNAV_RET_DATA, | 215 | JNAV_RET_DATA, |
216 | &sig, | 216 | &sig, |
@@ -259,7 +259,7 @@ request_json_require_coin_public_info (struct MHD_Connection *connection, | |||
259 | 259 | ||
260 | GNUNET_assert (NULL != root); | 260 | GNUNET_assert (NULL != root); |
261 | 261 | ||
262 | ret = request_json_require_nav (connection, root, | 262 | ret = GNUNET_MINT_parse_navigate_json (connection, root, |
263 | JNAV_FIELD, "coin_pub", | 263 | JNAV_FIELD, "coin_pub", |
264 | JNAV_RET_DATA, | 264 | JNAV_RET_DATA, |
265 | &r_public_info->coin_pub, | 265 | &r_public_info->coin_pub, |
@@ -267,7 +267,7 @@ request_json_require_coin_public_info (struct MHD_Connection *connection, | |||
267 | if (GNUNET_OK != ret) | 267 | if (GNUNET_OK != ret) |
268 | return ret; | 268 | return ret; |
269 | 269 | ||
270 | ret = request_json_require_nav (connection, root, | 270 | ret = GNUNET_MINT_parse_navigate_json (connection, root, |
271 | JNAV_FIELD, "denom_sig", | 271 | JNAV_FIELD, "denom_sig", |
272 | JNAV_RET_DATA, | 272 | JNAV_RET_DATA, |
273 | &r_public_info->denom_sig, | 273 | &r_public_info->denom_sig, |
@@ -275,7 +275,7 @@ request_json_require_coin_public_info (struct MHD_Connection *connection, | |||
275 | if (GNUNET_OK != ret) | 275 | if (GNUNET_OK != ret) |
276 | return ret; | 276 | return ret; |
277 | 277 | ||
278 | ret = request_json_require_nav (connection, root, | 278 | ret = GNUNET_MINT_parse_navigate_json (connection, root, |
279 | JNAV_FIELD, "denom_pub", | 279 | JNAV_FIELD, "denom_pub", |
280 | JNAV_RET_DATA, | 280 | JNAV_RET_DATA, |
281 | &r_public_info->denom_pub, | 281 | &r_public_info->denom_pub, |
@@ -315,7 +315,7 @@ refresh_accept_melts (struct MHD_Connection *connection, | |||
315 | int res; | 315 | int res; |
316 | json_t *melt_coins; | 316 | json_t *melt_coins; |
317 | 317 | ||
318 | res = request_json_require_nav (connection, root, | 318 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
319 | JNAV_FIELD, "melt_coins", | 319 | JNAV_FIELD, "melt_coins", |
320 | JNAV_RET_TYPED_JSON, | 320 | JNAV_RET_TYPED_JSON, |
321 | JSON_ARRAY, | 321 | JSON_ARRAY, |
@@ -512,7 +512,7 @@ request_json_check_signature (struct MHD_Connection *connection, | |||
512 | int res; | 512 | int res; |
513 | json_t *el; | 513 | json_t *el; |
514 | 514 | ||
515 | res = request_json_require_nav (connection, root, | 515 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
516 | JNAV_FIELD, "sig", | 516 | JNAV_FIELD, "sig", |
517 | JNAV_RET_DATA, | 517 | JNAV_RET_DATA, |
518 | &signature, | 518 | &signature, |
@@ -521,7 +521,7 @@ request_json_check_signature (struct MHD_Connection *connection, | |||
521 | if (GNUNET_OK != res) | 521 | if (GNUNET_OK != res) |
522 | return res; | 522 | return res; |
523 | 523 | ||
524 | res = request_json_require_nav (connection, root, | 524 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
525 | JNAV_FIELD, "purpose", | 525 | JNAV_FIELD, "purpose", |
526 | JNAV_RET_TYPED_JSON, | 526 | JNAV_RET_TYPED_JSON, |
527 | JSON_INTEGER, | 527 | JSON_INTEGER, |
@@ -541,7 +541,7 @@ request_json_check_signature (struct MHD_Connection *connection, | |||
541 | "error", "signature invalid (purpose)"); | 541 | "error", "signature invalid (purpose)"); |
542 | } | 542 | } |
543 | 543 | ||
544 | res = request_json_require_nav (connection, root, | 544 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
545 | JNAV_FIELD, "size", | 545 | JNAV_FIELD, "size", |
546 | JNAV_RET_TYPED_JSON, | 546 | JNAV_RET_TYPED_JSON, |
547 | JSON_INTEGER, | 547 | JSON_INTEGER, |
@@ -623,7 +623,7 @@ TALER_MINT_handler_refresh_melt (struct RequestHandler *rh, | |||
623 | } | 623 | } |
624 | 624 | ||
625 | /* session_pub field must always be present */ | 625 | /* session_pub field must always be present */ |
626 | res = request_json_require_nav (connection, root, | 626 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
627 | JNAV_FIELD, "session_pub", | 627 | JNAV_FIELD, "session_pub", |
628 | JNAV_RET_DATA, | 628 | JNAV_RET_DATA, |
629 | &refresh_session_pub, | 629 | &refresh_session_pub, |
@@ -833,7 +833,7 @@ TALER_MINT_handler_refresh_commit (struct RequestHandler *rh, | |||
833 | if ( (GNUNET_NO == res) || (NULL == root) ) | 833 | if ( (GNUNET_NO == res) || (NULL == root) ) |
834 | return MHD_YES; | 834 | return MHD_YES; |
835 | 835 | ||
836 | res = request_json_require_nav (connection, root, | 836 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
837 | JNAV_FIELD, "session_pub", | 837 | JNAV_FIELD, "session_pub", |
838 | JNAV_RET_DATA, | 838 | JNAV_RET_DATA, |
839 | &refresh_session_pub, | 839 | &refresh_session_pub, |
@@ -906,7 +906,7 @@ TALER_MINT_handler_refresh_commit (struct RequestHandler *rh, | |||
906 | { | 906 | { |
907 | struct RefreshCommitCoin commit_coin; | 907 | struct RefreshCommitCoin commit_coin; |
908 | 908 | ||
909 | res = request_json_require_nav (connection, root, | 909 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
910 | JNAV_FIELD, "coin_evs", | 910 | JNAV_FIELD, "coin_evs", |
911 | JNAV_INDEX, (int) i, | 911 | JNAV_INDEX, (int) i, |
912 | JNAV_INDEX, (int) j, | 912 | JNAV_INDEX, (int) j, |
@@ -927,7 +927,7 @@ TALER_MINT_handler_refresh_commit (struct RequestHandler *rh, | |||
927 | &commit_coin.coin_ev, | 927 | &commit_coin.coin_ev, |
928 | sizeof (struct TALER_RSA_BlindedSignaturePurpose)); | 928 | sizeof (struct TALER_RSA_BlindedSignaturePurpose)); |
929 | 929 | ||
930 | res = request_json_require_nav (connection, root, | 930 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
931 | JNAV_FIELD, "link_encs", | 931 | JNAV_FIELD, "link_encs", |
932 | JNAV_INDEX, (int) i, | 932 | JNAV_INDEX, (int) i, |
933 | JNAV_INDEX, (int) j, | 933 | JNAV_INDEX, (int) j, |
@@ -971,7 +971,7 @@ TALER_MINT_handler_refresh_commit (struct RequestHandler *rh, | |||
971 | { | 971 | { |
972 | struct RefreshCommitLink commit_link; | 972 | struct RefreshCommitLink commit_link; |
973 | 973 | ||
974 | res = request_json_require_nav (connection, root, | 974 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
975 | JNAV_FIELD, "transfer_pubs", | 975 | JNAV_FIELD, "transfer_pubs", |
976 | JNAV_INDEX, (int) i, | 976 | JNAV_INDEX, (int) i, |
977 | JNAV_INDEX, (int) j, | 977 | JNAV_INDEX, (int) j, |
@@ -991,7 +991,7 @@ TALER_MINT_handler_refresh_commit (struct RequestHandler *rh, | |||
991 | &commit_link.transfer_pub, | 991 | &commit_link.transfer_pub, |
992 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 992 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
993 | 993 | ||
994 | res = request_json_require_nav (connection, root, | 994 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
995 | JNAV_FIELD, "secret_encs", | 995 | JNAV_FIELD, "secret_encs", |
996 | JNAV_INDEX, (int) i, | 996 | JNAV_INDEX, (int) i, |
997 | JNAV_INDEX, (int) j, | 997 | JNAV_INDEX, (int) j, |
@@ -1165,7 +1165,7 @@ TALER_MINT_handler_refresh_reveal (struct RequestHandler *rh, | |||
1165 | if ( (GNUNET_NO == res) || (NULL == root) ) | 1165 | if ( (GNUNET_NO == res) || (NULL == root) ) |
1166 | return MHD_YES; | 1166 | return MHD_YES; |
1167 | 1167 | ||
1168 | res = request_json_require_nav (connection, root, | 1168 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
1169 | JNAV_FIELD, "session_pub", | 1169 | JNAV_FIELD, "session_pub", |
1170 | JNAV_RET_DATA, | 1170 | JNAV_RET_DATA, |
1171 | &refresh_session_pub, | 1171 | &refresh_session_pub, |
@@ -1216,7 +1216,7 @@ TALER_MINT_handler_refresh_reveal (struct RequestHandler *rh, | |||
1216 | struct GNUNET_HashCode transfer_secret; | 1216 | struct GNUNET_HashCode transfer_secret; |
1217 | struct GNUNET_HashCode shared_secret; | 1217 | struct GNUNET_HashCode shared_secret; |
1218 | 1218 | ||
1219 | res = request_json_require_nav (connection, root, | 1219 | res = GNUNET_MINT_parse_navigate_json (connection, root, |
1220 | JNAV_FIELD, "transfer_privs", | 1220 | JNAV_FIELD, "transfer_privs", |
1221 | JNAV_INDEX, (int) i, | 1221 | JNAV_INDEX, (int) i, |
1222 | JNAV_INDEX, (int) j, | 1222 | JNAV_INDEX, (int) j, |