Merge pull request #287 from dinoboy197/resolve_extattrs_for_symlinks

Resolve xattrs for symlinks (resolves #247, resolves #283)
This commit is contained in:
rfjakob 2017-02-20 21:35:18 +01:00 committed by GitHub
commit 62505fa240
3 changed files with 7 additions and 3 deletions

View File

@ -40,6 +40,7 @@ addons:
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
packages: packages:
- attr
- clang - clang
- cmake - cmake
- fuse - fuse

View File

@ -712,9 +712,9 @@ int _do_listxattr(EncFS_Context *, const string &cyName, char *list,
size_t size) { size_t size) {
#ifdef XATTR_ADD_OPT #ifdef XATTR_ADD_OPT
int options = 0; int options = 0;
int res = ::listxattr(cyName.c_str(), list, size, options); int res = ::llistxattr(cyName.c_str(), list, size, options);
#else #else
int res = ::listxattr(cyName.c_str(), list, size); int res = ::llistxattr(cyName.c_str(), list, size);
#endif #endif
return (res == -1) ? -errno : res; return (res == -1) ? -errno : res;
} }

View File

@ -3,7 +3,7 @@
# Test EncFS --reverse mode # Test EncFS --reverse mode
use warnings; use warnings;
use Test::More tests => 26; use Test::More tests => 31;
use File::Path; use File::Path;
use File::Temp; use File::Temp;
use IO::Handle; use IO::Handle;
@ -84,6 +84,9 @@ sub symlink_test
$dec = readlink("$decrypted/symlink"); $dec = readlink("$decrypted/symlink");
ok( $dec eq $target, "symlink to '$target'") or ok( $dec eq $target, "symlink to '$target'") or
print("# (original) $target' != '$dec' (decrypted)\n"); print("# (original) $target' != '$dec' (decrypted)\n");
system("attr", "-l", "$decrypted/symlink");
my $return_code = $?;
is($return_code, 0, "symlink to '$target' extended attributes can be read (return code was $return_code)");
unlink("$plain/symlink"); unlink("$plain/symlink");
} }