aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.h
diff options
context:
space:
mode:
authorHenry Stern <stern@fsi.io>2015-09-11 07:52:50 -0300
committerHenry Stern <stern@fsi.io>2015-09-11 12:52:33 -0300
commitf7b7a42f8c9e148f53c09b4eabaa3797ecbb9915 (patch)
tree44f4761af3605a409436990f4b3167ed39cfd055 /src/debug.h
parentb4cdacc28e45f9c3b727db3a5e128e7ed5380e1a (diff)
downloadbindfs-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/debug.h')
0 files changed, 0 insertions, 0 deletions