diff options
author | Jakob Unterwurzacher | 2017-05-07 20:58:27 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-05-07 20:58:27 +0200 |
commit | 26881538e1753e613b4143b28fa339812a9a6d16 (patch) | |
tree | 6fbf74a26518b337380789c6bdc90380ed99d569 /internal/fusefrontend | |
parent | 68387b470c0d6d2896cc6b927a6e3097389d66ab (diff) |
nametranform, fusefrontend: better errors on invalid names
nametransform.DecryptName() now always returns syscall.EBADMSG if
the name was invalid.
fusefrontend.OpenDir error messages have been normalized.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/fs_dir.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index 05cea75..7d1e3ef 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -291,8 +291,8 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f if isLong == nametransform.LongNameContent { cNameLong, err := nametransform.ReadLongName(filepath.Join(cDirAbsPath, cName)) if err != nil { - tlog.Warn.Printf("Skipping entry %q in dir %q: Could not read .name: %v", - cName, cDirName, err) + tlog.Warn.Printf("OpenDir %q: invalid entry %q: Could not read .name: %v", + cDirName, cName, err) errorCount++ continue } @@ -304,12 +304,13 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f name, err := fs.nameTransform.DecryptName(cName, cachedIV) if err != nil { - tlog.Warn.Printf("Skipping entry %q in dir %q: %s", - cName, cDirName, err) + tlog.Warn.Printf("OpenDir %q: invalid entry %q: %v", + cDirName, cName, err) errorCount++ continue } - + // Override the ciphertext name with the plaintext name but reuse the rest + // of the structure cipherEntries[i].Name = name plain = append(plain, cipherEntries[i]) } @@ -317,8 +318,8 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f if errorCount > 0 && len(plain) == 0 { // Don't let the user stare on an empty directory. Report that things went // wrong. - tlog.Warn.Printf("All %d entries in directory %q were invalid, returning EIO", - errorCount, cDirName) + tlog.Warn.Printf("OpenDir %q: all %d entries were invalid, returning EIO", + cDirName, errorCount) status = fuse.EIO } |