summaryrefslogtreecommitdiff
path: root/internal/fusefrontend
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-11-11 18:32:48 +0100
committerJakob Unterwurzacher2019-01-01 16:24:25 +0100
commit1d5500c3db3b4b1f5a5fbc49c7934d3665739a0a (patch)
treef32fbbd2b29d8afc5af586a914d475410207aa37 /internal/fusefrontend
parentc3adf9729de82bba52405e9f20f235b6a009308f (diff)
fusefrontend: only compile getBackingPath() on Darwin
This function is NOT symlink-safe. Darwin needs it because it lacks fgetxattr(2) and friends.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r--internal/fusefrontend/names.go15
-rw-r--r--internal/fusefrontend/xattr_darwin.go19
2 files changed, 19 insertions, 15 deletions
diff --git a/internal/fusefrontend/names.go b/internal/fusefrontend/names.go
index 5d6951c..a6791cc 100644
--- a/internal/fusefrontend/names.go
+++ b/internal/fusefrontend/names.go
@@ -31,21 +31,6 @@ func (fs *FS) isFiltered(path string) bool {
return false
}
-// GetBackingPath - get the absolute encrypted path of the backing file
-// from the relative plaintext path "relPath"
-//
-// TODO: this function is NOT symlink-safe.
-// TODO: Move to xattr_darwin.go.
-func (fs *FS) getBackingPath(relPath string) (string, error) {
- cPath, err := fs.encryptPath(relPath)
- if err != nil {
- return "", err
- }
- cAbsPath := filepath.Join(fs.args.Cipherdir, cPath)
- tlog.Debug.Printf("getBackingPath: %s + %s -> %s", fs.args.Cipherdir, relPath, cAbsPath)
- return cAbsPath, nil
-}
-
// openBackingDir opens the parent ciphertext directory of plaintext path
// "relPath" and returns the dirfd and the encrypted basename.
//
diff --git a/internal/fusefrontend/xattr_darwin.go b/internal/fusefrontend/xattr_darwin.go
index ad81320..c756486 100644
--- a/internal/fusefrontend/xattr_darwin.go
+++ b/internal/fusefrontend/xattr_darwin.go
@@ -4,9 +4,13 @@
package fusefrontend
import (
+ "path/filepath"
+
"github.com/pkg/xattr"
"github.com/hanwen/go-fuse/fuse"
+
+ "github.com/rfjakob/gocryptfs/internal/tlog"
)
func disallowedXAttrName(attr string) bool {
@@ -67,3 +71,18 @@ func (fs *FS) listXAttr(relPath string, context *fuse.Context) ([]string, fuse.S
}
return cNames, fuse.OK
}
+
+// getBackingPath - get the absolute encrypted path of the backing file
+// from the relative plaintext path "relPath"
+//
+// This function is NOT symlink-safe. Darwin needs it because it lacks
+// fgetxattr(2) and friends.
+func (fs *FS) getBackingPath(relPath string) (string, error) {
+ cPath, err := fs.encryptPath(relPath)
+ if err != nil {
+ return "", err
+ }
+ cAbsPath := filepath.Join(fs.args.Cipherdir, cPath)
+ tlog.Debug.Printf("getBackingPath: %s + %s -> %s", fs.args.Cipherdir, relPath, cAbsPath)
+ return cAbsPath, nil
+}