aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-17 22:14:40 +0200
committerJakob Unterwurzacher2020-07-17 22:14:40 +0200
commit7eae35e2d317f737cd69afdf88539c5d29b91296 (patch)
treee8a138f87d44994168022f8daac2be9b9d40da18 /internal
parent57d572dbc10cfb1d14642598b0827d4119b26b64 (diff)
v2api: implement ctlsocksrv.Interface
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend/ctlsock_interface.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/fusefrontend/ctlsock_interface.go b/internal/fusefrontend/ctlsock_interface.go
index 2131463..f34739a 100644
--- a/internal/fusefrontend/ctlsock_interface.go
+++ b/internal/fusefrontend/ctlsock_interface.go
@@ -13,17 +13,17 @@ import (
"github.com/rfjakob/gocryptfs/internal/tlog"
)
-var _ ctlsocksrv.Interface = &FS{} // Verify that interface is implemented.
+var _ ctlsocksrv.Interface = &RootNode{} // Verify that interface is implemented.
// EncryptPath implements ctlsock.Backend
//
// Symlink-safe through openBackingDir().
-func (fs *FS) EncryptPath(plainPath string) (string, error) {
+func (rn *RootNode) EncryptPath(plainPath string) (string, error) {
if plainPath == "" {
// Empty string gets encrypted as empty string
return plainPath, nil
}
- if fs.args.PlaintextNames {
+ if rn.args.PlaintextNames {
return plainPath, nil
}
// Encrypt path level by level using openBackingDir. Pretty inefficient,
@@ -33,7 +33,7 @@ func (fs *FS) EncryptPath(plainPath string) (string, error) {
cPath := ""
for _, part := range parts {
wd = filepath.Join(wd, part)
- dirfd, cName, err := fs.openBackingDir(wd)
+ dirfd, cName, err := rn.openBackingDir(wd)
if err != nil {
return "", err
}
@@ -48,20 +48,20 @@ func (fs *FS) EncryptPath(plainPath string) (string, error) {
//
// DecryptPath is symlink-safe because openBackingDir() and decryptPathAt()
// are symlink-safe.
-func (fs *FS) DecryptPath(cipherPath string) (plainPath string, err error) {
- dirfd, _, err := fs.openBackingDir("")
+func (rn *RootNode) DecryptPath(cipherPath string) (plainPath string, err error) {
+ dirfd, _, err := rn.openBackingDir("")
if err != nil {
return "", err
}
defer syscall.Close(dirfd)
- return fs.decryptPathAt(dirfd, cipherPath)
+ return rn.decryptPathAt(dirfd, cipherPath)
}
// decryptPathAt decrypts a ciphertext path relative to dirfd.
//
// Symlink-safe through ReadDirIVAt() and ReadLongNameAt().
-func (fs *FS) decryptPathAt(dirfd int, cipherPath string) (plainPath string, err error) {
- if fs.args.PlaintextNames || cipherPath == "" {
+func (rn *RootNode) decryptPathAt(dirfd int, cipherPath string) (plainPath string, err error) {
+ if rn.args.PlaintextNames || cipherPath == "" {
return cipherPath, nil
}
parts := strings.Split(cipherPath, "/")
@@ -80,7 +80,7 @@ func (fs *FS) decryptPathAt(dirfd int, cipherPath string) (plainPath string, err
return "", err
}
}
- name, err := fs.nameTransform.DecryptName(longPart, dirIV)
+ name, err := rn.nameTransform.DecryptName(longPart, dirIV)
if err != nil {
fmt.Printf("DecryptName: %v\n", err)
return "", err