diff options
| author | Jakob Unterwurzacher | 2015-09-13 22:09:48 +0200 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2015-09-13 22:09:48 +0200 | 
| commit | 71789ae14f6c0c7418e8cba122da384915732d4a (patch) | |
| tree | 68b0360f562f6b8dd17e6514336723c5c6528151 /pathfs_frontend | |
| parent | 6f9e90c414c165ff76cd7546b9898b51660a2440 (diff) | |
Don't warn about "gocryptfs.conf" in the ciphertext root dir
Diffstat (limited to 'pathfs_frontend')
| -rw-r--r-- | pathfs_frontend/fs.go | 17 | 
1 files 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])  		}  	} | 
