summaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/rpath_cache.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-01-17 20:52:52 +0100
committerJakob Unterwurzacher2018-01-17 20:54:05 +0100
commit959e1fc1e2f531480ad1353179fc94f56ff76dce (patch)
tree42f4646f9b3f1a30414451a8942aeda5547bd0f8 /internal/fusefrontend_reverse/rpath_cache.go
parent8951eb2472d6af50554806df2ffd655f53da8bfe (diff)
fusefrontend_reverse: use OpenNofollow in findLongnameParent
Protects findLongnameParent against symlink races. Also add comments to several functions along the way. Reported at https://github.com/rfjakob/gocryptfs/issues/165
Diffstat (limited to 'internal/fusefrontend_reverse/rpath_cache.go')
-rw-r--r--internal/fusefrontend_reverse/rpath_cache.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/fusefrontend_reverse/rpath_cache.go b/internal/fusefrontend_reverse/rpath_cache.go
index f90b357..221f578 100644
--- a/internal/fusefrontend_reverse/rpath_cache.go
+++ b/internal/fusefrontend_reverse/rpath_cache.go
@@ -17,6 +17,8 @@ type rPathCacheContainer struct {
dirIV []byte
}
+// lookup relative ciphertext path "cPath". Returns dirIV, relative
+// plaintext path.
func (c *rPathCacheContainer) lookup(cPath string) ([]byte, string) {
c.Lock()
defer c.Unlock()
@@ -28,7 +30,9 @@ func (c *rPathCacheContainer) lookup(cPath string) ([]byte, string) {
return nil, ""
}
-// store - write entry for "cPath" into the cache
+// store - write entry for the directory at relative ciphertext path "cPath"
+// into the cache.
+// "dirIV" = directory IV of the directory, "pPath" = relative plaintext path
func (c *rPathCacheContainer) store(cPath string, dirIV []byte, pPath string) {
c.Lock()
defer c.Unlock()
@@ -37,4 +41,5 @@ func (c *rPathCacheContainer) store(cPath string, dirIV []byte, pPath string) {
c.pPath = pPath
}
+// rPathCache: see rPathCacheContainer above for a detailed description
var rPathCache rPathCacheContainer