Browse Source

lightning-cli: Be more discerning about literals.

Fixes: #574

The issue states that we should follow the standard when
parsing the port for IPv6 [addr]:port syntax, but this is
actually already supported by the daemon. The issue arises
due to the `lightning-cli` misinterpreting [addr]:port as
an array. This modification makes [addr]:port interpreted
as a string.
ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Rusty Russell
parent
commit
cabeef2d88
  1. 9
      cli/lightning-cli.c

9
cli/lightning-cli.c

@ -131,13 +131,14 @@ static char *opt_set_ordered(enum input *input)
static bool is_literal(const char *arg)
{
return strspn(arg, "0123456789") == strlen(arg)
size_t arglen = strlen(arg);
return strspn(arg, "0123456789") == arglen
|| streq(arg, "true")
|| streq(arg, "false")
|| streq(arg, "null")
|| arg[0] == '{'
|| arg[0] == '['
|| arg[0] == '"';
|| (arg[0] == '{' && arg[arglen - 1] == '}')
|| (arg[0] == '[' && arg[arglen - 1] == ']')
|| (arg[0] == '"' && arg[arglen - 1] == '"');
}
static void add_input(char **cmd, const char *input,

Loading…
Cancel
Save