daemon: do not forbid user relative paths unconditionally under --base-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>maint
parent
df9892ffce
commit
363f24c936
8
daemon.c
8
daemon.c
|
@ -145,14 +145,18 @@ static char *path_ok(char *dir)
|
||||||
|
|
||||||
if (base_path) {
|
if (base_path) {
|
||||||
static char rpath[PATH_MAX];
|
static char rpath[PATH_MAX];
|
||||||
if (*dir != '/') {
|
if (!strict_paths && *dir == '~')
|
||||||
/* Forbid possible base-path evasion using ~paths. */
|
; /* allow user relative paths */
|
||||||
|
else if (*dir != '/') {
|
||||||
|
/* otherwise allow only absolute */
|
||||||
logerror("'%s': Non-absolute path denied (base-path active)", dir);
|
logerror("'%s': Non-absolute path denied (base-path active)", dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
snprintf(rpath, PATH_MAX, "%s%s", base_path, dir);
|
snprintf(rpath, PATH_MAX, "%s%s", base_path, dir);
|
||||||
dir = rpath;
|
dir = rpath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
path = enter_repo(dir, strict_paths);
|
path = enter_repo(dir, strict_paths);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue