diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -228,14 +228,14 @@ int main(int argc, char* argv[]) { return 1; } user = argv[1]; - // Read the USERNAME variable + // Set the USERNAME environment variable setenv("USERNAME", user, 1); // Ensure a command was specified if(! getenv("SSH_ORIGINAL_COMMAND")) { sprintf(msg, "[%s] logged in without specifying a command", user); logmsg(msg); - printf("No soup for you!\n"); + fprintf(stderr, "No soup for you!\n"); return 1; } @@ -245,22 +245,20 @@ int main(int argc, char* argv[]) { if(is_git_cmd(cmd)) { // Read the repo path (command argument) if(!validate_git(user)) { - sprintf(msg, "[%s] attempted invalid git command \"%s\"", - user, getenv("SSH_ORIGINAL_COMMAND")); + sprintf(msg, "[%s] attempted invalid git command \"%s\"", user, cmd); logmsg(msg); return 1; } } else if(! is_allowed_cmd(cmd)) { - sprintf(msg, "[%s] attempted disallowed command \"%s\"", - user, getenv("SSH_ORIGINAL_COMMAND")); + sprintf(msg, "[%s] attempted disallowed command \"%s\"", user, cmd); logmsg(msg); fprintf(stderr, "Command '%s' is not allowed\n", cmd); return 1; } - sprintf(msg, "[%s] executed \"%s\"", user, getenv("SSH_ORIGINAL_COMMAND")); + sprintf(msg, "[%s] executed \"%s\"", user, cmd); logmsg(msg); - sprintf(gitsh, "/usr/bin/env git-shell -c \"%s\"", getenv("SSH_ORIGINAL_COMMAND")); + sprintf(gitsh, "/usr/bin/env git-shell -c \"%s\"", cmd); system(gitsh); return 0; |