[luci] How do you tell LuCI to not check for a non-existent directory?
Jo-Philipp Wich
xm at subsignal.org
Sat Jul 25 02:00:33 CEST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Kunal.
This is triggered by uci validation as specified in
/lib/uci/schema/default/fstab .
Below is a simple patch to relax this check:
- --- >8 ---
Index: modules/admin-core/root/lib/uci/schema/default/fstab
===================================================================
- --- modules/admin-core/root/lib/uci/schema/default/fstab (revision 5112)
+++ modules/admin-core/root/lib/uci/schema/default/fstab (working copy)
@@ -34,7 +34,7 @@
option name 'target'
option title 'Mount point'
option section 'fstab.mount'
- - option datatype 'directory'
+ option datatype 'string'
config section
- --- 8< ---
You could also edit the datatype check functions of the validator itself
by modifying the uvl/datatypes.lua class. Below is an oversimplified
example:
- --- >8 ---
Index: libs/uvl/luasrc/uvl/datatypes.lua
===================================================================
- --- libs/uvl/luasrc/uvl/datatypes.lua (revision 5112)
+++ libs/uvl/luasrc/uvl/datatypes.lua (working copy)
@@ -139,19 +139,10 @@
end
function directory( val, seen )
- - local s = fs.stat( val )
- - seen = seen or { }
- -
- - if s and not seen[s.ino] then
- - seen[s.ino] = true
- - if s.type == "dir" then
- - return true
- - elseif s.type == "lnk" then
- - return directory( fs.readlink(val), seen )
- - end
- - end
- -
- - return false
+ if val:match("[^/%w]") then -- deny everything that does not look
like a path
+ return false
+ else
+ return true
end
function file( val, seen )
- --- 8< ---
I hope this clears things up.
~ JoW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkpqSyEACgkQdputYINPTPP9SQCdGgw0CIAA4vdtsRs/2zU1lDdG
zBIAoJV8/Qo+xEgZrKupx44qBgP3npfD
=J2LH
-----END PGP SIGNATURE-----
More information about the luci
mailing list