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 /cli_args.go | |
parent | d583bdb79e6f05bce2451a7e220e553209da4c1d (diff) |
cli: add -longnamemax
Fixes https://github.com/rfjakob/gocryptfs/issues/499
Diffstat (limited to 'cli_args.go')
-rw-r--r-- | cli_args.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli_args.go b/cli_args.go index b415b21..e925345 100644 --- a/cli_args.go +++ b/cli_args.go @@ -45,6 +45,8 @@ type argContainer struct { notifypid, scryptn int // Idle time before autounmount idle time.Duration + // -longnamemax (hash encrypted names that are longer than this) + longnamemax uint8 // Helper variables that are NOT cli options all start with an underscore // _configCustom is true when the user sets a custom config file name. _configCustom bool @@ -215,6 +217,8 @@ func parseCliOpts(osArgs []string) (args argContainer) { flagSet.StringSliceVar(&args.badname, "badname", nil, "Glob pattern invalid file names that should be shown") flagSet.StringSliceVar(&args.passfile, "passfile", nil, "Read password from file") + flagSet.Uint8Var(&args.longnamemax, "longnamemax", 255, "Hash encrypted names that are longer than this") + flagSet.IntVar(&args.notifypid, "notifypid", 0, "Send USR1 to the specified process after "+ "successful mount - used internally for daemonization") const scryptn = "scryptn" @@ -292,6 +296,10 @@ func parseCliOpts(osArgs []string) (args argContainer) { os.Exit(exitcodes.Usage) } } + if args.longnamemax > 0 && args.longnamemax < 62 { + tlog.Fatal.Printf("-longnamemax: value %d is outside allowed range 62 ... 255", args.longnamemax) + os.Exit(exitcodes.Usage) + } return args } |