summaryrefslogtreecommitdiff
path: root/bin/gitano-command.cgi.in
diff options
context:
space:
mode:
authorRichard Ipsum <richardipsum@fastmail.co.uk>2015-07-10 22:13:29 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-10-30 18:54:37 +0100
commit25ba9b74ee5eeddf7cbc6a9c3d3770bbf9653d7f (patch)
tree4d1fcbaafa743bf4bef15867f9cabae571ac5c06 /bin/gitano-command.cgi.in
parent8e29fb9c131a7e77eb15423d76acbc2df2c4c907 (diff)
downloadgitano-25ba9b74ee5eeddf7cbc6a9c3d3770bbf9653d7f.tar.gz
Fix empty command bug
This fixes a bug that causes gitano to crash when it's given an empty command list Opening and closing of the log should be done in the application, so it can log before checking for authorization, log after, and clean up at the end
Diffstat (limited to 'bin/gitano-command.cgi.in')
-rwxr-xr-xbin/gitano-command.cgi.in8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/gitano-command.cgi.in b/bin/gitano-command.cgi.in
index 2fa1db2..94c5dd5 100755
--- a/bin/gitano-command.cgi.in
+++ b/bin/gitano-command.cgi.in
@@ -52,9 +52,13 @@ if os.getenv("QUERY_STRING") then
local user = os.getenv("REMOTE_USER") or "gitano/anonymous"
gitano.log.buffer_output()
+ local start_log_level = gitano.log.get_level()
+ gitano.log.cap_level(gitano.log.level.INFO)
+ local transactionid = gitano.log.syslog.open()
local authorized, cmd, parsed_cmdline, config, env, repo =
- gitano.auth.is_authorized(user, "http", cmdline, os.getenv("GITANO_ROOT"))
+ gitano.auth.is_authorized(user, "http", cmdline, os.getenv("GITANO_ROOT"),
+ transactionid, start_log_level)
if authorized then
local exit = gitano.util.run_command(cmd, cmdline, parsed_cmdline,
@@ -67,6 +71,8 @@ if os.getenv("QUERY_STRING") then
stdout:write("Status: 403 Forbidden\r\n\r\n")
stdout:write(gitano.log.get_buffered_output() or "")
end
+
+ gitano.log.syslog.close()
else
stdout:write("Status: 400 Bad request\r\n\r\n")
stdout:write("Malformed command line, format: ?cmd=arg0 arg1 ... argn\n")