Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2008-10-24 09:48:50 +0400
committerJunio C Hamano <gitster@pobox.com>2008-10-25 03:34:01 +0400
commit53ffb878a94c3eae7c7f57e05568aedcfb77e57f (patch)
treebb5eca12073ff0b85feaa22f122144a079bc0a84 /daemon.c
parent759ad19e772a79a2a5ae6b7377d57eb21d29e6a0 (diff)
git-daemon: set REMOTE_ADDR to client address
This allows hooks like pre-receive to look at the client's IP address. Of course the IP address can't be used to get strong security; git-daemon isn't the right thing to use if you need that. However, basic IP address checking can be good enough in some situations. REMOTE_ADDR is the same environment variable used to communicate the client's address to CGI scripts. Signed-off-by: Joey Hess <joey@kitenet.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/daemon.c b/daemon.c
index 3e5582d289..b9ba44c582 100644
--- a/daemon.c
+++ b/daemon.c
@@ -537,6 +537,10 @@ static int execute(struct sockaddr *addr)
#endif
}
loginfo("Connection from %s:%d", addrbuf, port);
+ setenv("REMOTE_ADDR", addrbuf, 1);
+ }
+ else {
+ unsetenv("REMOTE_ADDR");
}
alarm(init_timeout ? init_timeout : timeout);