All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Greg Brockman <gdb@MIT.EDU>
Cc: Git List <git@vger.kernel.org>, Petr Baudis <pasky@suse.cz>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v3] shell: Rewrite documentation and improve error message
Date: Tue, 24 Aug 2010 11:06:51 +0530	[thread overview]
Message-ID: <20100824053647.GA2037@kytes> (raw)
In-Reply-To: <AANLkTintw7=25nsr-7NjE_-xJqMab_HggjPOtSHBf109@mail.gmail.com>

Update the documentation of 'git shell' to mention the interactive
mode and COMMAND_DIR. Also provide a hint when interactive mode is not
available in the shell.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Greg Brockman <gdb@MIT.EDU>
---
 Interdiff:
 diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt
 index 1e38c70..6403126 100644
 --- a/Documentation/git-shell.txt
 +++ b/Documentation/git-shell.txt
 @@ -26,7 +26,7 @@ invoked.
  COMMAND_DIR is the path "$HOME/git-shell-commands". The user must have
  read and execute permissions to the directory in order to execute the
  programs in it. The programs are executed with a cwd of $HOME, and
 -<argument> is passed to them as a command-line argument.
 +<argument> is parsed as a command-line string.
  
  Author
  ------
 	Modified shell.c
 diff --git a/shell.c b/shell.c
 index 0903ac8..6aade3d 100644
 --- a/shell.c
 +++ b/shell.c
 @@ -154,7 +154,7 @@ int main(int argc, char **argv)
  		cd_to_homedir();
  		if (access(COMMAND_DIR, R_OK | X_OK) == -1) {
  			die("Interactive git shell is not enabled.\n"
 -			    "hint: ~/$COMMAND_DIR should exist "
 +			    "hint: ~/" $COMMAND_DIR " should exist "
  			    "and have read and execute access.");
  		}
  		run_shell();

 Documentation/git-shell.txt |   28 +++++++++++++++++-----------
 shell.c                     |    7 +++++--
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt
index 0f3ad81..6403126 100644
--- a/Documentation/git-shell.txt
+++ b/Documentation/git-shell.txt
@@ -3,24 +3,30 @@ git-shell(1)
 
 NAME
 ----
-git-shell - Restricted login shell for GIT-only SSH access
+git-shell - Restricted login shell for Git-only SSH access
 
 
 SYNOPSIS
 --------
-'$(git --exec-path)/git-shell' -c <command> <argument>
+'git shell' [-c <command> <argument>]
 
 DESCRIPTION
 -----------
-This is meant to be used as a login shell for SSH accounts you want
-to restrict to GIT pull/push access only. It permits execution only
-of server-side GIT commands implementing the pull/push functionality.
-The commands can be executed only by the '-c' option; the shell is not
-interactive.
-
-Currently, only four commands are permitted to be called, 'git-receive-pack'
-'git-upload-pack' and 'git-upload-archive' with a single required argument, or
-'cvs server' (to invoke 'git-cvsserver').
+
+A login shell for SSH accounts to provide restricted Git access. When
+'-c' is given, the program executes <command> non-interactively;
+<command> can be one of 'git receive-pack', 'git upload-pack', 'git
+upload-archive', 'cvs server', or a command in COMMAND_DIR. The shell
+is started in interactive mode when no arguments are given; in this
+case, COMMAND_DIR must exist, and any of the executables in it can be
+invoked.
+
+'cvs server' is a special command which executes git-cvsserver.
+
+COMMAND_DIR is the path "$HOME/git-shell-commands". The user must have
+read and execute permissions to the directory in order to execute the
+programs in it. The programs are executed with a cwd of $HOME, and
+<argument> is parsed as a command-line string.
 
 Author
 ------
diff --git a/shell.c b/shell.c
index ffed615..6aade3d 100644
--- a/shell.c
+++ b/shell.c
@@ -152,8 +152,11 @@ int main(int argc, char **argv)
 	} else if (argc == 1) {
 		/* Allow the user to run an interactive shell */
 		cd_to_homedir();
-		if (access(COMMAND_DIR, R_OK | X_OK) == -1)
-			die("Sorry, the interactive git-shell is not enabled");
+		if (access(COMMAND_DIR, R_OK | X_OK) == -1) {
+			die("Interactive git shell is not enabled.\n"
+			    "hint: ~/" $COMMAND_DIR " should exist "
+			    "and have read and execute access.");
+		}
 		run_shell();
 		exit(0);
 	} else if (argc != 3 || strcmp(argv[1], "-c")) {
-- 
1.7.2.2.409.gdbb11.dirty

  reply	other threads:[~2010-08-24  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 19:44 [PATCH] shell: Rewrite documentation and improve error message Ramkumar Ramachandra
2010-08-20 19:51 ` Ramkumar Ramachandra
2010-08-22  6:00 ` Greg Brockman
2010-08-22  8:04   ` [PATCH v2] " Ramkumar Ramachandra
2010-08-23 17:42     ` Greg Brockman
2010-08-24  5:36       ` Ramkumar Ramachandra [this message]
2010-08-24  5:43         ` [PATCH v3] " Greg Brockman
2010-08-24 12:35           ` Ramkumar Ramachandra
2010-08-24 15:22             ` Greg Brockman
2010-08-24 19:01               ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100824053647.GA2037@kytes \
    --to=artagnon@gmail.com \
    --cc=gdb@MIT.EDU \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pasky@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.