diff options
author | Jakob Unterwurzacher | 2017-07-27 20:31:22 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-07-27 20:31:22 +0200 |
commit | d5133ca5ac4f241ff22ef145a3605a9fdb341bb6 (patch) | |
tree | 0ba68fc942de5459ff300f7d7e9f1229e8d5ed90 | |
parent | 496968e06c09f896ed04ad0939242e1ae75cde53 (diff) |
fusefrontend_reverse: return ENOENT for undecryptable names
This was working until DecryptName switched to returning
EBADMSG instead of EINVAL.
Add a test to catch the regression next time.
-rwxr-xr-x | benchmark.bash | 2 | ||||
-rw-r--r-- | internal/fusefrontend_reverse/rpath.go | 2 | ||||
-rw-r--r-- | tests/reverse/correctness_test.go | 10 |
3 files changed, 12 insertions, 2 deletions
diff --git a/benchmark.bash b/benchmark.bash index 8bc6abb..ec969df 100755 --- a/benchmark.bash +++ b/benchmark.bash @@ -67,7 +67,7 @@ if [[ $OPT_ENCFS -eq 1 ]]; then exit 1 fi echo "Testing EncFS at $CRYPT" - encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null + /home/jakob.donotbackup/encfs/build/encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null else echo "Testing gocryptfs at $CRYPT" gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT diff --git a/internal/fusefrontend_reverse/rpath.go b/internal/fusefrontend_reverse/rpath.go index 58e8c91..6f6895a 100644 --- a/internal/fusefrontend_reverse/rpath.go +++ b/internal/fusefrontend_reverse/rpath.go @@ -46,7 +46,7 @@ func (rfs *ReverseFS) rDecryptName(cName string, dirIV []byte, pDir string) (pNa // Stat attempts on the link target of encrypted symlinks. // These are always valid base64 but the length is not a // multiple of 16. - if err == syscall.EINVAL { + if err == syscall.EBADMSG { return "", syscall.ENOENT } return "", err diff --git a/tests/reverse/correctness_test.go b/tests/reverse/correctness_test.go index bfbab3d..a5719eb 100644 --- a/tests/reverse/correctness_test.go +++ b/tests/reverse/correctness_test.go @@ -130,3 +130,13 @@ func TestAccessVirtual(t *testing.T) { t.Errorf("should NOT be executable") } } + +// Opening a nonexistant file name should return ENOENT +// and not EBADMSG or EIO or anything else. +func TestEnoent(t *testing.T) { + fn := dirB + "/TestEnoent" + _, err := syscall.Open(fn, syscall.O_RDONLY, 0) + if err != syscall.ENOENT { + t.Errorf("want ENOENT, got: %v", err) + } +} |