Fix hosts parameter for cgi
This commit is contained in:
parent
1a70ef7247
commit
0699084ac9
10
nc-api
10
nc-api
|
@ -136,12 +136,20 @@ def args_parse_cgi():
|
||||||
if not allowed:
|
if not allowed:
|
||||||
raise RuntimeError('Access denied')
|
raise RuntimeError('Access denied')
|
||||||
|
|
||||||
for k in ['cmd', 'domain', 'hosts']:
|
for k in ['cmd', 'domain']:
|
||||||
arg = values.get(k, [])
|
arg = values.get(k, [])
|
||||||
if len(arg) != 1:
|
if len(arg) != 1:
|
||||||
raise RuntimeError("Bad parameter %s" % (k))
|
raise RuntimeError("Bad parameter %s" % (k))
|
||||||
argv.append(arg[0])
|
argv.append(arg[0])
|
||||||
del values[k]
|
del values[k]
|
||||||
|
arg = values.get('hosts', [])
|
||||||
|
if argv[0] == 'get-hosts':
|
||||||
|
if arg:
|
||||||
|
raise RuntimeError("Unexpected hosts")
|
||||||
|
else:
|
||||||
|
if len(arg) != 1:
|
||||||
|
raise RuntimeError("Bad parameter hosts")
|
||||||
|
argv.append(arg[0])
|
||||||
for k in values:
|
for k in values:
|
||||||
if not k in opt_longflags:
|
if not k in opt_longflags:
|
||||||
raise RuntimeError("Unknown option %s" % (k))
|
raise RuntimeError("Unknown option %s" % (k))
|
||||||
|
|
Loading…
Reference in New Issue