aboutsummaryrefslogtreecommitdiff
path: root/internal/configfile/validate.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-10-21 15:58:19 +0200
committerJakob Unterwurzacher2021-10-21 15:58:19 +0200
commitd14c9340d6fb473e9837e91db8b6e869c37ad8e5 (patch)
tree253ba3c3db8a97ba7fdcd5d59b699db92da1cea2 /internal/configfile/validate.go
parentd583bdb79e6f05bce2451a7e220e553209da4c1d (diff)
cli: add -longnamemax
Fixes https://github.com/rfjakob/gocryptfs/issues/499
Diffstat (limited to 'internal/configfile/validate.go')
-rw-r--r--internal/configfile/validate.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/internal/configfile/validate.go b/internal/configfile/validate.go
index 1611ab0..ab8917d 100644
--- a/internal/configfile/validate.go
+++ b/internal/configfile/validate.go
@@ -47,10 +47,10 @@ func (cf *ConfFile) Validate() error {
}
// Filename encryption
{
- if cf.IsFeatureFlagSet(FlagPlaintextNames) && cf.IsFeatureFlagSet(FlagEMENames) {
- return fmt.Errorf("Can't have both PlaintextNames and EMENames feature flags")
- }
if cf.IsFeatureFlagSet(FlagPlaintextNames) {
+ if cf.IsFeatureFlagSet(FlagEMENames) {
+ return fmt.Errorf("PlaintextNames conflicts with EMENames feature flag")
+ }
if cf.IsFeatureFlagSet(FlagDirIV) {
return fmt.Errorf("PlaintextNames conflicts with DirIV feature flag")
}
@@ -60,10 +60,19 @@ func (cf *ConfFile) Validate() error {
if cf.IsFeatureFlagSet(FlagRaw64) {
return fmt.Errorf("PlaintextNames conflicts with Raw64 feature flag")
}
+ if cf.IsFeatureFlagSet(FlagLongNameMax) {
+ return fmt.Errorf("PlaintextNames conflicts with LongNameMax feature flag")
+ }
}
if cf.IsFeatureFlagSet(FlagEMENames) {
// All combinations of DirIV, LongNames, Raw64 allowed
}
+ if cf.LongNameMax != 0 && !cf.IsFeatureFlagSet(FlagLongNameMax) {
+ return fmt.Errorf("LongNameMax=%d but the LongNameMax feature flag is NOT set", cf.LongNameMax)
+ }
+ if cf.LongNameMax == 0 && cf.IsFeatureFlagSet(FlagLongNameMax) {
+ return fmt.Errorf("LongNameMax=0 but the LongNameMax feature flag IS set")
+ }
}
return nil
}