Re: [PATCH 2/2] shell: pay attention to exit status from 'help' command
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 11, 2013, 07:15 UTC
- Message-ID
- <7vd2w7pbh5.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130211055847.GG15329@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 22 quoted lines
> diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt > index 4fe93203..60051e63 100644 > --- a/Documentation/git-shell.txt > +++ b/Documentation/git-shell.txt > @@ -59,6 +59,26 @@ users to list repositories they have access to, create, delete, or > rename repositories, or change repository descriptions and > permissions. > > +If the `help` command exists and exits with nonzero status, the > +interactive shell is aborted. > + > +EXAMPLE > +------- > + > +To disable interactive logins, displaying a greeting instead: > ++ > +---------------- > +$ chsh -s /usr/bin/git-shell > +$ mkdir $HOME/git-shell-commands > +$ cat >$HOME/git-shell-commands/help <<\EOF > +#!/bin/sh > +printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
Where in the sshd to git-shell exec chain is $USER variable set for the user? Just being curious if this is the simplest but one of the more robust ways to get the user's name.
I still think forcing the site administrator create a directory for each and every user only to house a single script that denies the access is a wrong design, but the code seems to correctly implement that design.