summaryrefslogtreecommitdiff
path: root/pathfs_frontend
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-28 00:07:03 +0100
committerJakob Unterwurzacher2015-11-28 18:39:45 +0100
commit3b2143bafc8daeb3a5e77b611b5b5d2060bbdfbe (patch)
tree9f9cac9aa3058e445c568b37330b82add34f1594 /pathfs_frontend
parentfe7355f9ee4ae8e52a9b76202e90032d78824f21 (diff)
diriv: fix readdir
It decrypted all file names using the root directory iv
Diffstat (limited to 'pathfs_frontend')
-rw-r--r--pathfs_frontend/fs.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go
index c2b80a3..d999632 100644
--- a/pathfs_frontend/fs.go
+++ b/pathfs_frontend/fs.go
@@ -89,7 +89,15 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f
// silently ignore "gocryptfs.diriv" everywhere if dirIV is enabled
continue
}
- name, err := fs.decryptPath(cName)
+ var name string
+ if !fs.dirIV {
+ name, err = fs.decryptPath(cName)
+ } else {
+ // When dirIV is enabled we need the full path to be able to decrypt it
+ cPath := filepath.Join(cDirName, cName)
+ name, err = fs.decryptPath(cPath)
+ name = filepath.Base(name)
+ }
if err != nil {
cryptfs.Warn.Printf("Invalid name \"%s\" in dir \"%s\": %s\n", cName, dirName, err)
continue