summaryrefslogtreecommitdiff
path: root/internal/configfile/config_file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-10-21 09:58:37 +0200
committerJakob Unterwurzacher2021-10-21 14:55:30 +0200
commitd583bdb79e6f05bce2451a7e220e553209da4c1d (patch)
tree9d2fa4671278b1bc9d0202a267598f669628d70c /internal/configfile/config_file.go
parentdc32710045f6f46913ae336b6fb77bf90b6bdb85 (diff)
configfile: add LongNameMax support
Feature flag + numeric paramater https://github.com/rfjakob/gocryptfs/issues/499
Diffstat (limited to 'internal/configfile/config_file.go')
-rw-r--r--internal/configfile/config_file.go9
1 files changed, 9 insertions, 0 deletions
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)