From 10e26bf488ff540af17d6f47ff6de9f2a86f10e8 Mon Sep 17 00:00:00 2001 From: Taylor Raack Date: Mon, 13 Feb 2017 21:15:09 -0800 Subject: [PATCH] Resolve xattrs for symlinks (resolves #247, resolves #283) --- .travis.yml | 1 + encfs/encfs.cpp | 4 ++-- tests/reverse.t.pl | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d6277d..b4c0bee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,7 @@ addons: sources: - ubuntu-toolchain-r-test packages: + - attr - clang - cmake - fuse diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index 7a0a127..d9d0f1a 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -712,9 +712,9 @@ int _do_listxattr(EncFS_Context *, const string &cyName, char *list, size_t size) { #ifdef XATTR_ADD_OPT int options = 0; - int res = ::listxattr(cyName.c_str(), list, size, options); + int res = ::llistxattr(cyName.c_str(), list, size, options); #else - int res = ::listxattr(cyName.c_str(), list, size); + int res = ::llistxattr(cyName.c_str(), list, size); #endif return (res == -1) ? -errno : res; } diff --git a/tests/reverse.t.pl b/tests/reverse.t.pl index 9e359bc..2e561fa 100755 --- a/tests/reverse.t.pl +++ b/tests/reverse.t.pl @@ -3,7 +3,7 @@ # Test EncFS --reverse mode use warnings; -use Test::More tests => 26; +use Test::More tests => 31; use File::Path; use File::Temp; use IO::Handle; @@ -84,6 +84,9 @@ sub symlink_test $dec = readlink("$decrypted/symlink"); ok( $dec eq $target, "symlink to '$target'") or 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"); }