diff options
author | Junio C Hamano <junkio@cox.net> | 2006-02-03 23:50:55 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-05 16:51:01 -0800 |
commit | 363f24c93695d26f5af584e99093689077b1c7dd (patch) | |
tree | 888ad8b5e4d3a74de7aba083b10f060a949b8eab | |
parent | df9892ffce46d1f1bd6fe64aa445be2ffe7346cf (diff) | |
download | git-363f24c93695d26f5af584e99093689077b1c7dd.tar.gz git-363f24c93695d26f5af584e99093689077b1c7dd.tar.xz |
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>
-rw-r--r-- | daemon.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); |