Skip to content

Commit

Permalink
daemon: do not forbid user relative paths unconditionally under --bas…
Browse files Browse the repository at this point in the history
…e-path

Using base-path to relocate the server public space does not
have anything to do with allowing or forbidding user relative
paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Feb 6, 2006
1 parent df9892f commit 363f24c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,17 @@ static char *path_ok(char *dir)

if (base_path) {
static char rpath[PATH_MAX];
if (*dir != '/') {
/* Forbid possible base-path evasion using ~paths. */
if (!strict_paths && *dir == '~')
; /* allow user relative paths */
else if (*dir != '/') {
/* otherwise allow only absolute */
logerror("'%s': Non-absolute path denied (base-path active)", dir);
return NULL;
}
snprintf(rpath, PATH_MAX, "%s%s", base_path, dir);
dir = rpath;
else {
snprintf(rpath, PATH_MAX, "%s%s", base_path, dir);
dir = rpath;
}
}

path = enter_repo(dir, strict_paths);
Expand Down

0 comments on commit 363f24c

Please sign in to comment.