diff options
author | Henry Stern <stern@fsi.io> | 2015-09-11 07:52:50 -0300 |
---|---|---|
committer | Henry Stern <stern@fsi.io> | 2015-09-11 12:52:33 -0300 |
commit | f7b7a42f8c9e148f53c09b4eabaa3797ecbb9915 (patch) | |
tree | 44f4761af3605a409436990f4b3167ed39cfd055 /src/usermap.c | |
parent | b4cdacc28e45f9c3b727db3a5e128e7ed5380e1a (diff) | |
download | bindfs-f7b7a42f8c9e148f53c09b4eabaa3797ecbb9915.tar.gz |
Add functionality to transparently resolve symbolic links.
There exist use cases where you would want bindfs to transparently
resolve symbolic links, such as when you are creating a chroot
environment with a bound fs. This change adds an option,
--resolve-symlinks, that modifies the behaviour of the process_path
and bindfs_symlink functions.
The process_path function is modified to return a mutable char* that
must be freed. When settings.resolve_symlinks is enabled the
process_path function calls realpath on the relative path to
transparently resolve the symbolic link.
A side effect of this change is that broken symbolic links will appear
in directory listings but any attempt to access the file of that name
will return the ENOENT error code. A subsequent commit offers an
alternative behaviour of not resolving broken symbolic links.
All callers of process_path are modified to check the return value of
process_path to make sure realpath and strdup were successful. They
also free the result after use to prevent memory leakage.
The bindfs_symlink function is modified to return EPERM when
resolve-symlinks is enabled. This must be done to prevent access to
arbitrary files on the filesystem.
Diffstat (limited to 'src/usermap.c')
0 files changed, 0 insertions, 0 deletions