summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli_args.go20
-rw-r--r--tests/normal/cli_test.go1
2 files changed, 15 insertions, 6 deletions
diff --git a/cli_args.go b/cli_args.go
index ef1ca09..036de9b 100644
--- a/cli_args.go
+++ b/cli_args.go
@@ -61,6 +61,10 @@ func prefixOArgs(osArgs []string) []string {
if o == "" {
continue
}
+ if o == "o" || o == "-o" {
+ tlog.Fatal.Printf("You can't pass \"-o\" to \"-o\"")
+ os.Exit(ErrExitUsage)
+ }
newArgs = append(newArgs, "-"+o)
}
// Add other arguments
@@ -111,19 +115,23 @@ func parseCliOpts() (args argContainer) {
flagSet.IntVar(&args.scryptn, "scryptn", configfile.ScryptDefaultLogN, "scrypt cost parameter logN. "+
"Setting this to a lower value speeds up mounting but makes the password susceptible to brute-force attacks")
// Ignored otions
- var ignoredBool bool
+ var dummyBool bool
ignoreText := "(ignored for compatability)"
- flagSet.BoolVar(&ignoredBool, "rw", false, ignoreText)
- flagSet.BoolVar(&ignoredBool, "nosuid", false, ignoreText)
- flagSet.BoolVar(&ignoredBool, "nodev", false, ignoreText)
+ flagSet.BoolVar(&dummyBool, "rw", false, ignoreText)
+ flagSet.BoolVar(&dummyBool, "nosuid", false, ignoreText)
+ flagSet.BoolVar(&dummyBool, "nodev", false, ignoreText)
+ var dummyString string
+ flagSet.StringVar(&dummyString, "o", "", "For compatability, all options can be also passed as a comma-separated list to -o.")
// Actual parsing
err = flagSet.Parse(os.Args[1:])
+ if err == flag.ErrHelp {
+ os.Exit(0)
+ }
if err != nil {
tlog.Warn.Printf("You passed: %s", prettyArgs())
tlog.Fatal.Printf("%v", err)
- os.Exit(2)
+ os.Exit(ErrExitUsage)
}
-
// "-openssl" needs some post-processing
if opensslAuto == "auto" {
args.openssl = prefer_openssl.PreferOpenSSL()
diff --git a/tests/normal/cli_test.go b/tests/normal/cli_test.go
index bbb45ae..18c0bd9 100644
--- a/tests/normal/cli_test.go
+++ b/tests/normal/cli_test.go
@@ -178,6 +178,7 @@ func TestShadows(t *testing.T) {
t.Fatal(err)
}
// This should work
+ // (note that MountOrFatal creates "mnt" again)
test_helpers.MountOrFatal(t, cipher, mnt, "-extpass=echo test")
test_helpers.UnmountPanic(mnt)
cipher2 := mnt + "/cipher"