Commit 3c88c2d1 authored by Ted Trask's avatar Ted Trask
Browse files

Changed minimumscore to score and added validation

parent 999bb888
......@@ -1037,6 +1037,10 @@ local validateweblogparameters = function(params)
params.value.clientip.errtxt = "Invalid IP Address"
success = false
if not validator.is_integer(params.value.score.value) then
params.value.score.errtxt = "Must be a number"
success = false
local res, err = pcall(function()
local s
......@@ -1072,7 +1076,7 @@ function getweblogparameters()
result.clientuserid = cfe({ value="", label="User ID", seq=4 })
result.clientip = cfe({ value="", label="Client IP", seq=5 })
result.urisearch = cfe({ value="", label="URI Contains", descr="Retrieve records where the URI contains this word", seq=6 })
result.score = cfe({ value=c.value.minimumscore.value, label="Minimum Score", descr="Minimum score to search on", seq=7 })
result.score = cfe({ value=c.value.score.value, label="Minimum Score", descr="Minimum score to search on", seq=7 })
result.sortby = cfe({ type="select", value=c.value.sortby.value, option=c.value.sortby.option, label="Sort By field", descr="Sort by this field when displaying records", seq=8 })
result.badyesno = cfe({ type="boolean", value=c.value.badyesno.value, label="Show Suspect Records", descr="Limit search to records marked as suspect", seq=9 })
result.deniedyesno = cfe({ type="boolean", value=c.value.deniedyesno.value, label="Show Denied Records", descr="Limit search to Denied URIs", seq=10 })
......@@ -1151,7 +1155,7 @@ function getconfig()
result.auditstart = cfe({ value=config.auditstart or "", label="Audit Start Time", seq=1 })
result.auditend = cfe({ value=config.auditend or "", label="Audit End Time", seq=2 })
result.groupby = cfe({ type="select", value=config.groupby or "clientuserid", label="Group results by", option={"clientuserid", "clientip"}, descr="Display audit results based on user ID or IP", seq=3 })
result.minimumscore = cfe({ value=config.minimumscore or "0", label="Minimum Score", descr="Default minimum Score to search for", seq=4 })
result.score = cfe({ value=config.score or "0", label="Minimum Score", descr="Default minimum Score to search for", seq=4 })
result.sortby = cfe({ type="select", value=config.sortby or "logdatetime", label="Sort By field", option={"logdatetime", "logdatetime DESC", "clientuserid", "clientuserid DESC", "clientip", "clientip DESC", "bytes", "bytes DESC", "score", "score DESC", "reason"}, descr="Default sort order", seq=5 })
result.badyesno = cfe({ type="boolean", value=(config.badyesno == "true"), label="Display Suspect Records", descr="By default, only show records flagged as suspect", seq=6 })
result.deniedyesno = cfe({ type="boolean", value=(config.deniedyesno == "true"), label="Display Denied Records", descr="By default, only show records with denied URI", seq=7 })
......@@ -1167,6 +1171,10 @@ end
local function validateconfig(newconfig)
local success = modelfunctions.validateselect(newconfig.value.groupby)
success = modelfunctions.validateselect(newconfig.value.sortby) and success
if not validator.is_integer(newconfig.value.score.value) then
newconfig.value.score.errtxt = "Must be a number"
success = false
if newconfig.value.window.value == "" then
newconfig.value.window.errtxt = "Cannot be blank"
success = false
......@@ -1213,7 +1221,7 @@ function updateconfig(newconfig)
configcontent = format.update_ini_file(configcontent, "", "badyesno", tostring(newconfig.value.badyesno.value))
configcontent = format.update_ini_file(configcontent, "", "deniedyesno", tostring(newconfig.value.deniedyesno.value))
configcontent = format.update_ini_file(configcontent, "", "bypassyesno", tostring(newconfig.value.bypassyesno.value))
configcontent = format.update_ini_file(configcontent, "", "minimumscore", tostring(newconfig.value.minimumscore.value))
configcontent = format.update_ini_file(configcontent, "", "score", tostring(newconfig.value.score.value))
configcontent = format.update_ini_file(configcontent, "", "sortby", tostring(newconfig.value.sortby.value))
fs.write_file(configfile, configcontent)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment