summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/root_node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-11 19:43:07 +0200
committerJakob Unterwurzacher2020-07-11 19:43:07 +0200
commit250dbc64362265beace368b62f5a6656908a2e84 (patch)
tree2eed3ec591ee4597f0173afd9d97e555c470b51f /internal/fusefrontend/root_node.go
parentc35b575d5f5aa29c4f39e9f0df15385d9f379caf (diff)
v2api: implement Symlink
Diffstat (limited to 'internal/fusefrontend/root_node.go')
-rw-r--r--internal/fusefrontend/root_node.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/fusefrontend/root_node.go b/internal/fusefrontend/root_node.go
index cf23169..7ceeb06 100644
--- a/internal/fusefrontend/root_node.go
+++ b/internal/fusefrontend/root_node.go
@@ -245,3 +245,17 @@ func (rn *RootNode) openBackingDir(relPath string) (dirfd int, cName string, err
}
return dirfd, cName, nil
}
+
+// encryptSymlinkTarget: "data" is encrypted like file contents (GCM)
+// and base64-encoded.
+// The empty string encrypts to the empty string.
+//
+// Symlink-safe because it does not do any I/O.
+func (rn *RootNode) encryptSymlinkTarget(data string) (cData64 string) {
+ if data == "" {
+ return ""
+ }
+ cData := rn.contentEnc.EncryptBlock([]byte(data), 0, nil)
+ cData64 = rn.nameTransform.B64EncodeToString(cData)
+ return cData64
+}