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>
if (base_path) {
static char rpath[PATH_MAX];
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;
}
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);
}
path = enter_repo(dir, strict_paths);