| 533 | } |
| 534 | |
| 535 | static struct command_result *param_restrictions(struct command *cmd, |
| 536 | const char *name, |
| 537 | const char *buffer, |
| 538 | const jsmntok_t *tok, |
| 539 | struct rune_restr ***restrs) |
| 540 | { |
| 541 | if (json_tok_streq(buffer, tok, "readonly")) |
| 542 | *restrs = readonly_restrictions(cmd); |
| 543 | else if (tok->type == JSMN_ARRAY) { |
| 544 | size_t i; |
| 545 | const jsmntok_t *t; |
| 546 | |
| 547 | *restrs = tal_arr(cmd, struct rune_restr *, tok->size); |
| 548 | json_for_each_arr(i, t, tok) { |
| 549 | (*restrs)[i] = rune_restr_from_json(cmd, *restrs, buffer, t); |
| 550 | if (!(*restrs)[i]) { |
| 551 | return command_fail_badparam(cmd, name, buffer, t, |
| 552 | "not a valid restriction (should be array)"); |
| 553 | } |
| 554 | } |
| 555 | } else { |
| 556 | *restrs = tal_arr(cmd, struct rune_restr *, 1); |
| 557 | (*restrs)[0] = rune_restr_from_json(cmd, *restrs, buffer, tok); |
| 558 | if (!(*restrs)[0]) |
| 559 | return command_fail_badparam(cmd, name, buffer, tok, |
| 560 | "not a valid restriction (should be array)"); |
| 561 | } |
| 562 | return NULL; |
| 563 | } |
| 564 | |
| 565 | static struct command_result *reply_with_rune(struct command *cmd, |
| 566 | const char *buf UNUSED, |
nothing calls this directly
no test coverage detected