diff --git a/package/gluon-autoupdater/check_site.lua b/package/gluon-autoupdater/check_site.lua index 9f443fec..3eb2e721 100644 --- a/package/gluon-autoupdater/check_site.lua +++ b/package/gluon-autoupdater/check_site.lua @@ -8,7 +8,7 @@ local function check_branch(k, _) need_string(prefix .. 'name') need_string_array(prefix .. 'mirrors') need_number(prefix .. 'good_signatures') - need_string_array(prefix .. 'pubkeys') + need_string_array_match(prefix .. 'pubkeys', '^%x+$') end need_table('autoupdater.branches', check_branch) diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua index 61938ce5..d26b1671 100644 --- a/package/gluon-core/check_site.lua +++ b/package/gluon-core/check_site.lua @@ -41,7 +41,7 @@ end need_boolean('poe_passthrough', false) if need_table('dns', nil, false) then need_number('dns.cacheentries', false) - need_string_array('dns.servers', false) + need_string_array_match('dns.servers', '^[%x:]+$', false) end if need_table('next_node', nil, false) then diff --git a/scripts/check_site_lib.lua b/scripts/check_site_lib.lua index ff6e1ca0..9e2bd135 100644 --- a/scripts/check_site_lib.lua +++ b/scripts/check_site_lib.lua @@ -138,6 +138,12 @@ function need_string_array(varname, required) return var end +function need_string_array_match(varname, pat, required) + local ok, var = pcall(need_array, varname, function(e) assert(e:match(pat)) end, required) + assert(ok, "site.conf error: expected `" .. varname .. "' to be a string array matching pattern `" .. pat .. "'") + return var +end + function need_array_of(varname, array, required) local ok, var = pcall(need_array, varname, function(e) assert_one_of(e, array) end,required) assert(ok, "site.conf error: expected `" .. varname .. "' to be a subset of given array: " .. array_to_string(array))