git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tarmigan Casebolt <tarmigan+git@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: spearce@spearce.org, git@vger.kernel.org, rctay89@gmail.com,
	drizzd@aon.at, warthog9@kernel.org,
	Tarmigan Casebolt <tarmigan+git@gmail.com>
Subject: [PATCH 2/2] Smart-http: check if repository is OK to export before serving it
Date: Sat, 26 Dec 2009 18:29:13 -0500	[thread overview]
Message-ID: <1261870153-57572-2-git-send-email-tarmigan+git@gmail.com> (raw)
In-Reply-To: <1261870153-57572-1-git-send-email-tarmigan+git@gmail.com>

Similar to how git-daemon checks whether a repository is OK to be
exported, smart-http should also check.  This check can be satisfied
in two different ways: the environmental variable GIT_HTTP_EXPORT_ALL
may be set to export all repositories, or the individual repository
may have the file git-daemon-export-ok.

Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---
 http-backend.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/http-backend.c b/http-backend.c
index f729488..345c12b 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -648,6 +648,9 @@ int main(int argc, char **argv)
 	setup_path();
 	if (!enter_repo(dir, 0))
 		not_found("Not a git repository: '%s'", dir);
+	if (!getenv("GIT_HTTP_EXPORT_ALL") &&
+	    access("git-daemon-export-ok", F_OK) )
+		not_found("Repository not exported: '%s'", dir);
 
 	git_config(http_config, NULL);
 	cmd->imp(cmd_arg);
-- 
1.6.6.2.g5daf2

  reply	other threads:[~2009-12-26 23:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-26 16:21 Does smart-http need git-daemon-export-ok? Tarmigan
2009-12-26 17:33 ` Junio C Hamano
2009-12-26 23:29   ` [PATCH 1/2] Smart-http: Add tests and documentation for export-ok Tarmigan Casebolt
2009-12-26 23:29     ` Tarmigan Casebolt [this message]
2009-12-27 21:10       ` [PATCH 2/2] Smart-http: check if repository is OK to export before serving it Shawn O. Pearce
2009-12-28  4:07         ` Tarmigan
2009-12-28  4:22           ` [PATCH] " Tarmigan Casebolt
2009-12-28 15:59           ` [PATCH 2/2] " Shawn O. Pearce
2009-12-28 16:57             ` Tarmigan
2009-12-28 17:08               ` Shawn O. Pearce
2009-12-28 21:49                 ` [PATCH] " Tarmigan Casebolt
2009-12-29  9:19                   ` Junio C Hamano
2009-12-29 15:00                     ` Shawn O. Pearce
2009-12-27 21:06   ` Does smart-http need git-daemon-export-ok? Shawn O. Pearce

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=1261870153-57572-2-git-send-email-tarmigan+git@gmail.com \
    --to=tarmigan+git@gmail.com \
    --cc=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rctay89@gmail.com \
    --cc=spearce@spearce.org \
    --cc=warthog9@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).