aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2026-09-01 21:36:57 +0200
committerJakob Unterwurzacher2026-09-01 21:37:42 +0200
commit12fa2c54de65e57649e07042b6cf517896a430aa (patch)
tree744a0ec68efaddac8851ce689e354dfb2d043d8f
parent119471f951dff9132aee18c66abeec551e47f89d (diff)
plaintextnames: don't initialize nametransform
We should never call it in -plaintextnames mode.
-rw-r--r--internal/fusefrontend_reverse/root_node.go8
-rw-r--r--mount.go7
2 files changed, 10 insertions, 5 deletions
diff --git a/internal/fusefrontend_reverse/root_node.go b/internal/fusefrontend_reverse/root_node.go
index 7ac28af..461b25c 100644
--- a/internal/fusefrontend_reverse/root_node.go
+++ b/internal/fusefrontend_reverse/root_node.go
@@ -68,7 +68,7 @@ func NewRootNode(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransf
var rootDev uint64
var st syscall.Stat_t
var statErr error
- var shortNameMax int
+ var shortNameMax = syscall.NAME_MAX
if statErr = syscall.Stat(args.Cipherdir, &st); statErr != nil {
tlog.Warn.Printf("Could not stat backing directory %q: %v", args.Cipherdir, statErr)
if args.OneFileSystem {
@@ -79,8 +79,10 @@ func NewRootNode(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransf
rootDev = uint64(st.Dev)
}
- shortNameMax = n.GetLongNameMax() * 3 / 4
- shortNameMax = shortNameMax - shortNameMax%16 - 1
+ if !args.PlaintextNames {
+ shortNameMax = n.GetLongNameMax() * 3 / 4
+ shortNameMax = shortNameMax - shortNameMax%16 - 1
+ }
rn := &RootNode{
args: args,
diff --git a/mount.go b/mount.go
index 32a7dd7..489ae31 100644
--- a/mount.go
+++ b/mount.go
@@ -330,8 +330,11 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f
// Init crypto backend
cCore := cryptocore.New(masterkey, cryptoBackend, IVBits, args.hkdf)
cEnc := contentenc.New(cCore, contentenc.DefaultBS)
- nameTransform := nametransform.New(cCore.EMECipher, frontendArgs.LongNames, args.longnamemax,
- args.raw64, []string(args.badname), frontendArgs.DeterministicNames)
+ var nameTransform *nametransform.NameTransform
+ if !args.plaintextnames {
+ nameTransform = nametransform.New(cCore.EMECipher, frontendArgs.LongNames, args.longnamemax,
+ args.raw64, []string(args.badname), frontendArgs.DeterministicNames)
+ }
// After the crypto backend is initialized,
// we can purge the master key from memory.
for i := range masterkey {