From d3764b775395faa31afb1db34c5c2814a0e9af09 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 10 Nov 2016 23:25:37 +0100 Subject: reverse: fix longname decoding bug This could have caused spurious ENOENT errors. That it did not cause these errors all the time is interesting and probably because an earlier readdir would place the entry in the cache. This masks the bug. --- internal/fusefrontend_reverse/rpath.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/fusefrontend_reverse/rpath.go') diff --git a/internal/fusefrontend_reverse/rpath.go b/internal/fusefrontend_reverse/rpath.go index 2740104..0da40bb 100644 --- a/internal/fusefrontend_reverse/rpath.go +++ b/internal/fusefrontend_reverse/rpath.go @@ -52,9 +52,9 @@ func (rfs *ReverseFS) decryptPath(relPath string) (string, error) { parts := strings.Split(relPath, "/") for i, part := range parts { // Start at the top and recurse - currentDir := filepath.Join(parts[:i]...) + currentCipherDir := filepath.Join(parts[:i]...) nameType := nametransform.NameType(part) - dirIV := derivePathIV(currentDir, ivPurposeDirIV) + dirIV := derivePathIV(currentCipherDir, ivPurposeDirIV) var transformedPart string if nameType == nametransform.LongNameNone { transformedPart, err = rfs.nameTransform.DecryptName(part, dirIV) @@ -74,7 +74,8 @@ func (rfs *ReverseFS) decryptPath(relPath string) (string, error) { return "", err } } else if nameType == nametransform.LongNameContent { - transformedPart, err = rfs.findLongnameParent(currentDir, dirIV, part) + currentPlainDir := filepath.Join(transformedParts[:i]...) + transformedPart, err = rfs.findLongnameParent(currentPlainDir, dirIV, part) if err != nil { return "", err } -- cgit v1.2.3