* patch for git-daemon base-path trailing '/' problem
@ 2009-05-23 15:33 Aneesh Bhasin
0 siblings, 0 replies; only message in thread
From: Aneesh Bhasin @ 2009-05-23 15:33 UTC (permalink / raw)
To: git
Hi All,
I was trying to setup git-daemon on our server with the following args :
git-daemon --base-path=/git_repo/ --export-all --syslog --inetd
--verbose /git_repo/external_repos/
There are two git repos in /git_repo/external_repos/ :-
linux-test/.git and linux-release/.git
When I try to clone the linux-test/.git repo using :
git clone 192.168.1.100/external_repos/linux-test
I get an error at the server side from git-daemon saying that
"/git_repo//external/repos/linux-test/.git not in whitelist".
The problem is because fo the trailing '/' in base-path in git-daemon
args. I think it might be fairly common that a person might add a '/'
at the end of base-path. The following patch takes care of this
trailing patch :
diff --git a/daemon.c b/daemon.c
index daa4c8e..cd4dfed 100644
--- a/daemon.c
+++ b/daemon.c
@@ -209,11 +209,15 @@ static char *path_ok(char *directory)
dir = interp_path;
}
else if (base_path) {
+ int base_pathlen;
if (*dir != '/') {
/* Allow only absolute */
logerror("'%s': Non-absolute path denied (base-path acti
return NULL;
}
+ base_pathlen = strlen(base_path);
+ if(base_path[base_pathlen-1]=='/')
+ base_path[base_pathlen-1]='\0';
snprintf(rpath, PATH_MAX, "%s%s", base_path, dir);
dir = rpath;
}
@@ -229,7 +233,7 @@ static char *path_ok(char *directory)
}
---------------------------------------
Regards,
Aneesh Bhasin
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-05-23 15:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-23 15:33 patch for git-daemon base-path trailing '/' problem Aneesh Bhasin
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).