Add port and protocol validation

pull/1/head
Mark Veidemanis 7 years ago
parent 4f70cf69b3
commit c3aa3715c6

@ -1 +0,0 @@
{}

@ -187,6 +187,12 @@ class Helper(object):
incUsage("connect")
return
try:
int(spl[3])
except:
failure("Port must be an integer, not %s" % spl[3])
return
pool[spl[1]] = { "address": spl[2],
"port": spl[3],
"protocol": protocol,
@ -252,6 +258,16 @@ class Helper(object):
if not spl[2] in pool[spl[1]].keys():
failure("No such key: %s" % spl[2])
return
if spl[2] == "port":
try:
int(spl[3])
except:
failure("Port must be an integer, not %s" % spl[3])
return
if spl[2] == "protocol":
if not spl[3] in ["ssl", "plain"]:
failure("Protocol must be ssl or plain, not %s" % spl[3])
return
if spl[3] == pool[spl[1]][spl[2]]:
failure("Value already exists: %s" % spl[3])
return

Loading…
Cancel
Save