Fix exit codes for allowed ssh commands

gitolite specific ssh commands ("getperms", "setperms", "info" etc.)
should exit with non-error code in case of success.

Also "get/setperms" should print to STDOUT instead of STDERR.

This change is specially needed for the gitolite-tools
(http://github.com/tmatilai/gitolite-tools) to work.

Signed-off-by: Teemu Matilainen <teemu.matilainen@reaktor.fi>
This commit is contained in:
Teemu Matilainen 2010-01-08 14:05:11 +02:00 committed by Sitaram Chamarty
parent 5ad2056a9c
commit 15475f666c
2 changed files with 5 additions and 5 deletions

View file

@ -137,11 +137,11 @@ sub get_set_perms
wrap_chdir("$repo_base_abs");
wrap_chdir("$repo.git");
if ($verb eq 'getperms') {
print STDERR `cat gl-perms 2>/dev/null`;
system("cat", "gl-perms") if -f "gl-perms";
} else {
system("cat > gl-perms");
print STDERR "New perms are:\n";
print STDERR `cat gl-perms`;
print "New perms are:\n";
system("cat", "gl-perms");
}
}

View file

@ -105,14 +105,14 @@ if ($cmd =~ $CUSTOM_COMMANDS) {
} else {
die "$cmd doesn't make sense to me\n";
}
exit 1;
exit 0;
}
# people allowed to get a shell can get basic access info by asking nicely
if ($cmd eq 'info') {
&report_basic($GL_ADMINDIR, $GL_CONF_COMPILED, $user);
print "you also have shell access\n\r" if $shell_allowed;
exit 1;
exit 0;
}
# ----------------------------------------------------------------------------