From d583bdb79e6f05bce2451a7e220e553209da4c1d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 21 Oct 2021 09:58:37 +0200 Subject: configfile: add LongNameMax support Feature flag + numeric paramater https://github.com/rfjakob/gocryptfs/issues/499 --- internal/configfile/config_file.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal/configfile/config_file.go') diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go index 828f034..2d11346 100644 --- a/internal/configfile/config_file.go +++ b/internal/configfile/config_file.go @@ -55,6 +55,8 @@ type ConfFile struct { FeatureFlags []string // FIDO2 parameters FIDO2 *FIDO2Params `json:",omitempty"` + // LongNameMax corresponds to the -longnamemax flag + LongNameMax uint8 `json:",omitempty"` // Filename is the name of the config file. Not exported to JSON. filename string } @@ -71,6 +73,7 @@ type CreateArgs struct { Fido2HmacSalt []byte DeterministicNames bool XChaCha20Poly1305 bool + LongNameMax uint8 } // Create - create a new config with a random key encrypted with @@ -97,6 +100,12 @@ func Create(args *CreateArgs) error { if !args.DeterministicNames { cf.setFeatureFlag(FlagDirIV) } + // 0 means to *use* the default (which means we don't have to save it), and + // 255 *is* the default, which means we don't have to save it either. + if args.LongNameMax != 0 && args.LongNameMax != 255 { + cf.LongNameMax = args.LongNameMax + cf.setFeatureFlag(FlagLongNameMax) + } cf.setFeatureFlag(FlagEMENames) cf.setFeatureFlag(FlagLongNames) cf.setFeatureFlag(FlagRaw64) -- cgit v1.2.3