Skip to content

Commit

Permalink
reverse mode: -exclude: filter out excluded .name files
Browse files Browse the repository at this point in the history
Fixes #286 :

While the actual file is properly excluded, the * .name file is still leaked in the directory listing:

```
drwxr-xr-x 2 sebastian sebastian 4,0K Dez 17 14:58 .
drwxr-xr-x 7 sebastian sebastian 4,0K Dez 17 14:45 ..
-r-------- 1 sebastian sebastian  408 Dez 17 14:56 gocryptfs.conf
-r--r--r-- 1 sebastian sebastian   16 Dez 17 14:58 gocryptfs.diriv
-r--r--r-- 1 sebastian sebastian  320 Dez 17 14:58 gocryptfs.longname.3vZ_r3eDPb1_fL3j5VA4rd_bcKWLKT9eaxOVIGK5HFA.name
```
  • Loading branch information
rfjakob committed Jan 4, 2019
1 parent 58f62ad commit 6b94f5e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/fusefrontend_reverse/rfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ func NewFS(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransform.Na
os.Exit(exitcodes.ExcludeError)
}
fs.cExclude = append(fs.cExclude, cPath)
if !fs.args.PlaintextNames {
// If we exclude
// gocryptfs.longname.3vZ_r3eDPb1_fL3j5VA4rd_bcKWLKT9eaxOVIGK5HFA
// we should also exclude
// gocryptfs.longname.3vZ_r3eDPb1_fL3j5VA4rd_bcKWLKT9eaxOVIGK5HFA.name
if nametransform.IsLongContent(filepath.Base(cPath)) {
fs.cExclude = append(fs.cExclude, cPath+nametransform.LongNameSuffix)
}
}
}
tlog.Debug.Printf("-exclude: %v -> %v", fs.args.Exclude, fs.cExclude)
}
Expand Down Expand Up @@ -361,10 +370,10 @@ func (rfs *ReverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
}
entries[i].Name = cName
}
// Filter out excluded entries
entries = rfs.excludeDirEntries(cipherPath, entries)
// Add virtual files
entries = append(entries, virtualFiles[:nVirtual]...)
// Filter out excluded entries
entries = rfs.excludeDirEntries(cipherPath, entries)
return entries, fuse.OK
}

Expand Down

0 comments on commit 6b94f5e

Please sign in to comment.