diff options
author | Ted Trask <ttrask01@yahoo.com> | 2011-10-11 15:45:29 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2011-10-11 15:45:29 +0000 |
commit | e0681a6e6a04f45898734b70f937905769e64d75 (patch) | |
tree | 7c50f5964eee1ff2bc467b0c37e58371d0d2b320 /cgi-bin | |
parent | fe1e3e76b8174f3aa0c5adeb9abc10821b8f2013 (diff) | |
download | acf-provisioning-e0681a6e6a04f45898734b70f937905769e64d75.tar.bz2 acf-provisioning-e0681a6e6a04f45898734b70f937905769e64d75.tar.xz |
Redirect missing Polycom -phone and -web files to blanks to clear out existing settings
Diffstat (limited to 'cgi-bin')
-rwxr-xr-x | cgi-bin/provisioning.cgi | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cgi-bin/provisioning.cgi b/cgi-bin/provisioning.cgi index f0de432..640294a 100755 --- a/cgi-bin/provisioning.cgi +++ b/cgi-bin/provisioning.cgi @@ -43,6 +43,11 @@ function http_code (code) elseif code == 204 then io.stdout:write("Status: 204 No Content\n") io.stdout:write("Content-Type: \n\n") + elseif code == 302 then + -- redirect to same file with empty mac + io.stdout:write("Location: " .. string.gsub(path_info, "%x%x%x%x%x%x%x%x%x%x%x%x", "000000000000") .. "\n") + io.stdout:write("Content-Type: \n\n") + io.stdout:write("<a href=\"".. string.gsub(path_info, "%x%x%x%x%x%x%x%x%x%x%x%x", "000000000000") .."\">New Link</a>") elseif code == 404 then io.stdout:write("Status: 404 Not Found\n") io.stdout:write("Content-Type: \n\n") @@ -81,12 +86,16 @@ if ( request_method == "GET" ) then os.exit() end - -- If it's a Polycom, 404 the MAC.cfg, MAC-directory.xml, MAC-license, MAC-phone.cfg, and MAC-web.cfg files + -- If it's a Polycom, 404 the MAC.cfg, MAC-directory.xml, and MAC-license files and redirect the MAC-phone.cfg and MAC-web.cfg files to blanks local f = string.match(basename, mac.."(.*)") - if string.match(user_agent, "Polycom") and (f==".cfg" or f=="-directory.xml" or f=="-license.cfg" or f=="-phone.cfg" or f=="-web.cfg" or mac=="000000000000") then + if string.match(user_agent, "Polycom") and (f==".cfg" or f=="-directory.xml" or f=="-license.cfg" or mac=="000000000000") then http_code(404) log:close() os.exit() + elseif string.match(user_agent, "Polycom") and (f=="-phone.cfg" or f=="-web.cfg") then + http_code(302) + log:close() + os.exit() end log:write("Checking PROV Table for results\n") |