From 24cf85a37d7d8be5d17b16c2d674ea595ca6991c Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Fri, 3 Jul 2009 09:50:07 +0000 Subject: Validating filename/filepath --- rrdtool-model.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rrdtool-model.lua') 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" -- cgit v1.2.3