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.
This commit is contained in:
Jakob Unterwurzacher 2017-07-27 20:31:22 +02:00
parent 496968e06c
commit d5133ca5ac
3 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
}
}