diff options
author | Mika Havela <mika.havela@gmail.com> | 2009-07-03 09:50:07 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2009-07-03 09:50:07 +0000 |
commit | 24cf85a37d7d8be5d17b16c2d674ea595ca6991c (patch) | |
tree | 11f135f85b8c8b3483bcb36494396e683e144311 | |
parent | d2a7cb6b8761a7dc83e208ab7094f52e03ebed89 (diff) | |
download | acf-rrdtool-24cf85a37d7d8be5d17b16c2d674ea595ca6991c.tar.bz2 acf-rrdtool-24cf85a37d7d8be5d17b16c2d674ea595ca6991c.tar.xz |
Validating filename/filepath
-rw-r--r-- | rrdtool-model.lua | 5 |
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" |