Skip to content

Commit

Permalink
Merge pull request #1399 from proftpd/xfer-retr-fallback-for-vroot-is…
Browse files Browse the repository at this point in the history
…sue1336

Issue #1336: Backport the use of the `dir_best_path` fallback in the …
  • Loading branch information
Castaglia committed Feb 20, 2022
2 parents 4815183 + 486e7af commit 56d500e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/mod_xfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,16 @@ MODRET xfer_pre_retr(cmd_rec *cmd) {

pr_fs_clear_cache2(decoded_path);
dir = dir_realpath(cmd->tmp_pool, decoded_path);
if (dir == NULL) {
/* Try using dir_best_path(), as xfer_pre_stor() does.
*
* Without this fallback, certain use cases (such as SFTP downloads using
* mod_sftp + mod_vroot) fail unexpectedly, with misleading
* "denied by <Limit> configuration" errors.
*/
dir = dir_best_path(cmd->tmp_pool, decoded_path);
}

if (dir == NULL ||
!dir_check(cmd->tmp_pool, cmd, cmd->group, dir, NULL)) {
int xerrno = errno;
Expand Down

0 comments on commit 56d500e

Please sign in to comment.