-- @@SHEBANG -- -*- Lua -*- -- gitano-auth -- -- Git (with) Augmented network operations -- User authentication wrapper -- -- Copyright 2012 Daniel Silverstone -- -- -- @@GITANO_LUA_PATH local gitano = require "gitano" local gall = require "gall" local luxio = require "luxio" local sio = require "luxio.simple" local sp = require "luxio.subprocess" -- @@GITANO_BIN_PATH -- @@GITANO_SHARE_PATH -- @@GITANO_PLUGIN_PATH local repo_root, user, keytag = ... gitano.config.repo_path(repo_root) local cmdline = luxio.getenv "SSH_ORIGINAL_COMMAND" or "" if cmdline:match("^[ \t\n]*$") then gitano.log.fatal("No command provided, cannot continue") end local authorized, cmd, parsed_cmdline, config, env, repo = gitano.auth.is_authorized(user, "ssh", cmdline, repo_root) if authorized then local exit = gitano.util.run_command(cmd, cmdline, parsed_cmdline, user, config, env, repo) if exit ~= 0 then gitano.log.fatal("Error running command, exiting") end else gitano.log.fatal("Not authorized") end gitano.log.syslog.close() return 0