summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-09-20 20:59:02 +0200
committerJakob Unterwurzacher2016-09-25 16:43:17 +0200
commitd1762c5b95c3279b0a2dfa3df5c99fe59922b666 (patch)
tree011ec2aab6a224bdf2ffeeff4c7a821370ce2a37 /internal
parent5fb6c5cf58bc9871c51ebae7fbb87dde96a5a360 (diff)
reverse: fix GetAttr for gocryptfs.conf
And also don't return the encrypted version of .gocryptfs.reverse.conf in readdir.
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend_reverse/rfs.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index 98f6279..e20c851 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -101,6 +101,9 @@ func isDirIV(relPath string) bool {
// GetAttr - FUSE call
func (rfs *reverseFS) GetAttr(relPath string, context *fuse.Context) (*fuse.Attr, fuse.Status) {
+ if relPath == configfile.ConfDefaultName {
+ return rfs.loopbackfs.GetAttr(configfile.ConfReverseName, context)
+ }
if isDirIV(relPath) {
return rfs.dirIVAttr(relPath, context)
}
@@ -174,18 +177,15 @@ func (rfs *reverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
// Encrypt names
dirIV := deriveDirIV(cipherPath)
for i := range entries {
- entries[i].Name = rfs.nameTransform.EncryptName(entries[i].Name, dirIV)
+ // ".gocryptfs.reverse.conf" in the root directory is mapped to "gocryptfs.conf"
+ if cipherPath == "" && entries[i].Name == configfile.ConfReverseName {
+ entries[i].Name = configfile.ConfDefaultName
+ } else {
+ entries[i].Name = rfs.nameTransform.EncryptName(entries[i].Name, dirIV)
+ }
}
// Add virtual gocryptfs.diriv
entries = append(entries, fuse.DirEntry{syscall.S_IFREG | 0400, nametransform.DirIVFilename})
- // Add gocryptfs.conf in the root directory,
- // maps to .gocryptfs.reverse.conf in the plaintext directory.
- if cipherPath == "" {
- _, err = os.Stat(filepath.Join(rfs.args.Cipherdir, configfile.ConfReverseName))
- if err == nil {
- entries = append(entries, fuse.DirEntry{syscall.S_IFREG | 0400, configfile.ConfDefaultName})
- }
- }
return entries, fuse.OK
}