(adc) clean up and extend logging

This commit is contained in:
Sitaram Chamarty 2010-04-25 05:49:00 +05:30
parent 0b1d31fad4
commit 30bfeb8810
2 changed files with 5 additions and 2 deletions

View file

@ -434,6 +434,7 @@ sub special_cmd
&ext_cmd_rsync($GL_CONF_COMPILED, $RSYNC_BASE, $cmd);
} else {
# if the user is allowed a shell, just run the command
&log_it("$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$ENV{GL_USER}\n");
exec $ENV{SHELL}, "-c", $cmd if $shell_allowed;
die "bad command: $cmd\n";
@ -496,7 +497,7 @@ sub ext_cmd_rsync
# that should "die" if there's a problem
wrap_chdir($RSYNC_BASE);
&log_it("$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$ENV{USER}\n");
&log_it("$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$ENV{GL_USER}\n");
exec $ENV{SHELL}, "-c", $ENV{SSH_ORIGINAL_COMMAND};
}

View file

@ -94,6 +94,7 @@ unless ($ENV{SSH_ORIGINAL_COMMAND}) {
if ($shell_allowed) {
my $shell = $ENV{SHELL};
$shell =~ s/.*\//-/; # change "/bin/bash" to "-bash"
&log_it("$ENV{GL_TS}\t$shell\t$user\n");
exec { $ENV{SHELL} } $shell;
}
# otherwise, pretend he typed in "info" and carry on...
@ -110,6 +111,7 @@ if ($GL_ADC_PATH and -d $GL_ADC_PATH) {
if (-x "$GL_ADC_PATH/$cmd") {
# yes this is rather strict, sorry.
do { die "I don't like $_\n" unless $_ =~ $REPOPATT_PATT } for ($cmd, @args);
&log_it("$ENV{GL_TS}\t$GL_ADC_PATH/$ENV{SSH_ORIGINAL_COMMAND}\t$ENV{GL_USER}\n");
exec("$GL_ADC_PATH/$cmd", @args);
}
}
@ -199,7 +201,7 @@ die "$aa access for $repo DENIED to $user\n" unless $perm =~ /$aa/;
# over to git now
# ----------------------------------------------------------------------------
&log_it("$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$user\n");
&log_it("$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$ENV{GL_USER}\n");
$repo = "'$REPO_BASE/$repo.git'";
exec("git", "shell", "-c", "$verb $repo") unless $verb eq 'git-init';