diff options
author | Jakob Unterwurzacher | 2021-10-21 15:58:19 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-10-21 15:58:19 +0200 |
commit | d14c9340d6fb473e9837e91db8b6e869c37ad8e5 (patch) | |
tree | 253ba3c3db8a97ba7fdcd5d59b699db92da1cea2 /internal/configfile | |
parent | d583bdb79e6f05bce2451a7e220e553209da4c1d (diff) |
cli: add -longnamemax
Fixes https://github.com/rfjakob/gocryptfs/issues/499
Diffstat (limited to 'internal/configfile')
-rw-r--r-- | internal/configfile/validate.go | 15 |
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 } |