From 15475f666c07e66d91fd00added2a50544d9221b Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Fri, 8 Jan 2010 14:05:11 +0200 Subject: [PATCH] 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 --- src/gitolite.pm | 6 +++--- src/gl-auth-command | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index 4cfa8e1..74e1bbc 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -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"); } } diff --git a/src/gl-auth-command b/src/gl-auth-command index 6be5bde..1d6a33a 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -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; } # ----------------------------------------------------------------------------