From 71789ae14f6c0c7418e8cba122da384915732d4a Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 13 Sep 2015 22:09:48 +0200 Subject: [PATCH] Don't warn about "gocryptfs.conf" in the ciphertext root dir --- pathfs_frontend/fs.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go index 5a52cfc..85fbbaf 100644 --- a/pathfs_frontend/fs.go +++ b/pathfs_frontend/fs.go @@ -43,19 +43,22 @@ func (fs *FS) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Stat return a, status } -func (fs *FS) OpenDir(name string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status) { - cipherEntries, status := fs.FileSystem.OpenDir(fs.EncryptPath(name), context); +func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status) { + cipherEntries, status := fs.FileSystem.OpenDir(fs.EncryptPath(dirName), context); var plain []fuse.DirEntry - var skipped int if cipherEntries != nil { for i := range cipherEntries { - n, err := fs.DecryptPath(cipherEntries[i].Name) + cName := cipherEntries[i].Name + name, err := fs.DecryptPath(cName) if err != nil { - fmt.Printf("Skipping invalid filename \"%s\": %s\n", cipherEntries[i].Name, err) - skipped++ + if dirName == "" && cName == cryptfs.ConfDefaultName { + // Silently ignore "gocryptfs.conf" in the top level dir + continue + } + fmt.Printf("Invalid name \"%s\" in dir \"%s\": %s\n", cName, name, err) continue } - cipherEntries[i].Name = n + cipherEntries[i].Name = name plain = append(plain, cipherEntries[i]) } }