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:
parent
5ad2056a9c
commit
15475f666c
2 changed files with 5 additions and 5 deletions
|
@ -137,11 +137,11 @@ sub get_set_perms
|
||||||
wrap_chdir("$repo_base_abs");
|
wrap_chdir("$repo_base_abs");
|
||||||
wrap_chdir("$repo.git");
|
wrap_chdir("$repo.git");
|
||||||
if ($verb eq 'getperms') {
|
if ($verb eq 'getperms') {
|
||||||
print STDERR `cat gl-perms 2>/dev/null`;
|
system("cat", "gl-perms") if -f "gl-perms";
|
||||||
} else {
|
} else {
|
||||||
system("cat > gl-perms");
|
system("cat > gl-perms");
|
||||||
print STDERR "New perms are:\n";
|
print "New perms are:\n";
|
||||||
print STDERR `cat gl-perms`;
|
system("cat", "gl-perms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,14 +105,14 @@ if ($cmd =~ $CUSTOM_COMMANDS) {
|
||||||
} else {
|
} else {
|
||||||
die "$cmd doesn't make sense to me\n";
|
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
|
# people allowed to get a shell can get basic access info by asking nicely
|
||||||
if ($cmd eq 'info') {
|
if ($cmd eq 'info') {
|
||||||
&report_basic($GL_ADMINDIR, $GL_CONF_COMPILED, $user);
|
&report_basic($GL_ADMINDIR, $GL_CONF_COMPILED, $user);
|
||||||
print "you also have shell access\n\r" if $shell_allowed;
|
print "you also have shell access\n\r" if $shell_allowed;
|
||||||
exit 1;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue