summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rrdtool-model.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/rrdtool-model.lua b/rrdtool-model.lua
index 2163ec0..d6ab2fc 100644
--- a/rrdtool-model.lua
+++ b/rrdtool-model.lua
@@ -6,6 +6,7 @@ require("posix")
require("fs")
require("format")
require("date")
+require("validator")
-- Set variables
local configfile = "/etc/rrdtool/acf-rrdtool.conf"
@@ -146,6 +147,10 @@ function savenewrrd(self, configfile, userid)
local path = configfile.value.filename.value
if not string.find(path, "/") then
path = databases .. "/" .. path
+ elseif not validator.is_valid_filename(path,databases) then
+ configfile.value.filename.errtxt = "Not a valid path!\
+If you specify path, it should be " .. tostring(databases) .."/"
+ return configfile
end
if (posix.stat(path)) then
configfile.value.filename.errtxt = "File already exists"