summaryrefslogtreecommitdiff
path: root/bin/gitano-command.cgi.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gitano-command.cgi.in')
-rwxr-xr-xbin/gitano-command.cgi.in24
1 files changed, 2 insertions, 22 deletions
diff --git a/bin/gitano-command.cgi.in b/bin/gitano-command.cgi.in
index 1954635..2fa1db2 100755
--- a/bin/gitano-command.cgi.in
+++ b/bin/gitano-command.cgi.in
@@ -29,26 +29,6 @@ function url_decode(str)
return str
end
-function run_command(cmd, cmdline, parsed_cmdline, user, config, env, repo)
- gitano.log.debug("Welcome to " .. config.global.site_name)
- gitano.log.debug("Running:")
- for i = 1, #parsed_cmdline do
- gitano.log.debug(" => " .. parsed_cmdline[i])
- end
- gitano.log.debug("")
- gitano.log.debug("On behalf of " .. user .. " using key " .. env["GITANO_KEYTAG"])
-
- local how, why = cmd.run(config, repo, parsed_cmdline, env)
-
- if how ~= "exit" or why ~= 0 then
- gitano.log.critical("Error running " .. parsed_cmdline[1] .. ": " .. how)
- return why
- else
- gitano.log.syslog.info(cmdline, "completed successfully")
- return 0
- end
-end
-
if os.getenv("QUERY_STRING") then
local query_string = url_decode(os.getenv("QUERY_STRING"))
local cmdline = query_string
@@ -74,10 +54,10 @@ if os.getenv("QUERY_STRING") then
gitano.log.buffer_output()
local authorized, cmd, parsed_cmdline, config, env, repo =
- gitano.auth.is_authorized(user, "http", cmdline)
+ gitano.auth.is_authorized(user, "http", cmdline, os.getenv("GITANO_ROOT"))
if authorized then
- local exit = run_command(cmd, cmdline, parsed_cmdline,
+ local exit = gitano.util.run_command(cmd, cmdline, parsed_cmdline,
user, config, env, repo)
stdout:write("Status: " .. (exit == 0 and "200 OK" or "400 Bad request")