summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-08-11 16:00:26 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-08-11 16:00:26 +0000
commitf72c9704aeb762a6b51fc73ddf428c16872405ea (patch)
tree6ed709f23e662d672a64d0f3fdcded11f3927881 /applications
parent59d70787b46bcff4e2032f5b82bd68c0b62f3e7c (diff)
applications/openvpn: properly handle invalid names when defining new instances
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-openvpn/luasrc/model/cbi/openvpn.lua20
1 files changed, 12 insertions, 8 deletions
diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua
index c220b10a5..1d055a683 100644
--- a/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua
+++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua
@@ -53,16 +53,20 @@ function s.create(self, name)
self.sectiontype .. ".select"
)
- uci:section(
- "openvpn", "openvpn", name,
- uci:get_all( "openvpn_recipes", recipe )
- )
+ if name and not name:match("[^a-zA-Z0-9_]") then
+ uci:section(
+ "openvpn", "openvpn", name,
+ uci:get_all( "openvpn_recipes", recipe )
+ )
- uci:delete("openvpn", name, "_role")
- uci:delete("openvpn", name, "_description")
- uci:save("openvpn")
+ uci:delete("openvpn", name, "_role")
+ uci:delete("openvpn", name, "_description")
+ uci:save("openvpn")
- luci.http.redirect( self.extedit:format(name) )
+ luci.http.redirect( self.extedit:format(name) )
+ else
+ self.invalid_cts = true
+ end
end