aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/root_node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-04 20:32:02 +0200
committerJakob Unterwurzacher2020-07-04 20:32:02 +0200
commit23180794fed85d4b50036f297f3f756e6d667c94 (patch)
tree7c77cc4f7780c024c16e62fe67ca5f1cca052c3f /internal/fusefrontend/root_node.go
parent1618fbbac56c97e2ffbcabeee2dcc3d4ae62683e (diff)
v2api: implement Readlink
Diffstat (limited to 'internal/fusefrontend/root_node.go')
-rw-r--r--internal/fusefrontend/root_node.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/fusefrontend/root_node.go b/internal/fusefrontend/root_node.go
index be82851..7565018 100644
--- a/internal/fusefrontend/root_node.go
+++ b/internal/fusefrontend/root_node.go
@@ -117,3 +117,23 @@ func (rn *RootNode) isFiltered(path string) bool {
// are exclusive
return false
}
+
+// decryptSymlinkTarget: "cData64" is base64-decoded and decrypted
+// like file contents (GCM).
+// The empty string decrypts to the empty string.
+//
+// This function does not do any I/O and is hence symlink-safe.
+func (rn *RootNode) decryptSymlinkTarget(cData64 string) (string, error) {
+ if cData64 == "" {
+ return "", nil
+ }
+ cData, err := rn.nameTransform.B64DecodeString(cData64)
+ if err != nil {
+ return "", err
+ }
+ data, err := rn.contentEnc.DecryptBlock([]byte(cData), 0, nil)
+ if err != nil {
+ return "", err
+ }
+ return string(data), nil
+}