libs/core: Add recursion detection to dumptable, serialize_data
[project/luci.git] / libs / cbi / luasrc / cbi.lua
index 0a406c43e5eba84665ddb922c5198add491c55eb..411aa23870bbc0c4b0efd2d8e871ab3869b7d653 100644 (file)
@@ -616,6 +616,13 @@ function NamedSection.parse(self)
                AbstractSection.parse_dynamic(self, s)
                if luci.http.formvalue("cbi.submit") then
                        Node.parse(self, s)
+                       
+                       if not self.override_scheme and self.map.scheme then
+                               local co = self.map:get()
+                               local stat, err = self.map.validator:validate_section(self.config, s, co)
+                               luci.http.prepare_content("text/html")
+                               luci.util.dumptable(err)
+                       end
                end
                AbstractSection.parse_optionals(self, s)
        end
@@ -705,10 +712,17 @@ function TypedSection.parse(self)
                end
        end
 
+       local co
        for i, k in ipairs(self:cfgsections()) do
                AbstractSection.parse_dynamic(self, k)
                if luci.http.formvalue("cbi.submit") then
                        Node.parse(self, k)
+                       
+                       if not self.override_scheme and self.map.scheme then
+                               co = co or self.map:get()
+                               local stat, err = self.map.uvl:validate_section(self.config, k, co)
+                               luci.util.perror(err)
+                       end
                end
                AbstractSection.parse_optionals(self, k)
        end