From 959e1fc1e2f531480ad1353179fc94f56ff76dce Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 17 Jan 2018 20:52:52 +0100 Subject: 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 --- internal/fusefrontend_reverse/rpath_cache.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/fusefrontend_reverse/rpath_cache.go') 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 -- cgit v1.2.3