diff options
Diffstat (limited to 'cgi-bin')
-rwxr-xr-x | cgi-bin/provisioning.cgi | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cgi-bin/provisioning.cgi b/cgi-bin/provisioning.cgi index ba8f9a6..5ac1684 100755 --- a/cgi-bin/provisioning.cgi +++ b/cgi-bin/provisioning.cgi @@ -80,16 +80,19 @@ local basename = posix.basename(path_info) local mac = string.match(basename, "%x%x%x%x%x%x%x%x%x%x%x%x") if ( request_method == "GET" ) then - -- If it's a Linksys and corresponding file exists in /Linksys/ then serve it up, replacing $SERV with SERVER_NAME - if string.match(user_agent, "Linksys") and posix.stat(root.."/Linksys/"..basename) then - local f = io.open(root.."/Linksys/"..basename, "r") - if f then - log:write("Translating local file\n") - io.stdout:write("Content-Type: \n\n") - io.stdout:write((string.gsub(f:read("*a"), "%$SERV", server))) - f:close() - log:close() - os.exit() + -- Hack to allow download of config files with firmare URL, replacing $SERV with SERVER_NAME + local firmwaretricks = {"Linksys", "snom"} + for i,n in ipairs(firmwaretricks) do + if string.match(user_agent, n) and posix.stat(root.."/"..n.."/"..basename) then + local f = io.open(root.."/"..n.."/"..basename, "r") + if f then + log:write("Translating local file\n") + io.stdout:write("Content-Type: \n\n") + io.stdout:write((string.gsub(f:read("*a"), "%$SERV", server))) + f:close() + log:close() + os.exit() + end end end |