The CSV is written in our (network) directory, next to the node's own * files, so only allow a plain *.csv filename there: no directory, no * hidden name, nothing which could name one of those files. */
| 471 | * files, so only allow a plain *.csv filename there: no directory, no |
| 472 | * hidden name, nothing which could name one of those files. */ |
| 473 | static struct command_result *param_csv_filename(struct command *cmd, |
| 474 | const char *name, |
| 475 | const char *buffer, |
| 476 | const jsmntok_t *tok, |
| 477 | const char **filename) |
| 478 | { |
| 479 | struct command_result *ret; |
| 480 | const char *f; |
| 481 | |
| 482 | ret = param_string(cmd, name, buffer, tok, &f); |
| 483 | if (ret) |
| 484 | return ret; |
| 485 | |
| 486 | if (strchr(f, '/') || f[0] == '.' || !strends(f, ".csv")) |
| 487 | return command_fail_badparam(cmd, name, buffer, tok, |
| 488 | "must be a filename ending in .csv," |
| 489 | " without a directory"); |
| 490 | *filename = f; |
| 491 | return NULL; |
| 492 | } |
| 493 | |
| 494 | static struct command_result *json_dump_income(struct command *cmd, |
| 495 | const char *buf, |
nothing calls this directly
no test coverage detected