diff options
author | orcas | 2019-09-15 00:32:54 +0800 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-02-28 22:17:59 +0100 |
commit | 9ec042f2f62bc95154d6c8b3215a2e7853f8f5c6 (patch) | |
tree | 3a2225151361c7f2f51f57b51d613e29d6ce809b /mount.go | |
parent | eeefddad6a254607329c08a4ed6051c068283a06 (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.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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 { |