aboutsummaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authororcas2019-09-15 00:32:54 +0800
committerJakob Unterwurzacher2020-02-28 22:17:59 +0100
commit9ec042f2f62bc95154d6c8b3215a2e7853f8f5c6 (patch)
tree3a2225151361c7f2f51f57b51d613e29d6ce809b /mount.go
parenteeefddad6a254607329c08a4ed6051c068283a06 (diff)
Show undecryptable filenames if they match supplied glob
Resolves https://github.com/rfjakob/gocryptfs/issues/393
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/mount.go b/mount.go
index 5107bee..6d9dd8f 100644
--- a/mount.go
+++ b/mount.go
@@ -286,6 +286,17 @@ func initFuseFrontend(args *argContainer) (pfs pathfs.FileSystem, wipeKeys func(
cCore := cryptocore.New(masterkey, cryptoBackend, contentenc.DefaultIVBits, args.hkdf, args.forcedecode)
cEnc := contentenc.New(cCore, contentenc.DefaultBS, args.forcedecode)
nameTransform := nametransform.New(cCore.EMECipher, frontendArgs.LongNames, args.raw64)
+ // Init badname patterns
+ nameTransform.BadnamePatterns = make([]string, 0)
+ for _, pattern := range args.badname {
+ _, err := filepath.Match(pattern, "") // Make sure pattern is valid
+ if err != nil {
+ tlog.Fatal.Printf("-badname: invalid pattern %q supplied", pattern)
+ os.Exit(exitcodes.Usage)
+ } else {
+ nameTransform.BadnamePatterns = append(nameTransform.BadnamePatterns, pattern)
+ }
+ }
// After the crypto backend is initialized,
// we can purge the master key from memory.
for i := range masterkey {