From 416080203b4dd79de857eaf7c7cc97d050e00a9f Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 17 May 2020 19:31:04 +0200 Subject: main: accept multiple -passfile options Each file will be read and then concatenated for the effictive password. This can be used as a kind of multi-factor authenticiton. Fixes https://github.com/rfjakob/gocryptfs/issues/288 --- tests/cli/cli_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/cli/cli_test.go') diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index c6e86da..2484cf3 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -741,3 +741,25 @@ func TestBadname(t *testing.T) { t.Errorf("did not find invalid name %s in %v", invalid_file_name, names) } } + +// TestPassfile tests the `-passfile` option +func TestPassfile(t *testing.T) { + dir := test_helpers.InitFS(t) + mnt := dir + ".mnt" + passfile1 := mnt + ".1.txt" + ioutil.WriteFile(passfile1, []byte("test"), 0600) + test_helpers.MountOrFatal(t, dir, mnt, "-passfile="+passfile1) + defer test_helpers.UnmountPanic(mnt) +} + +// TestPassfileX2 tests that the `-passfile` option can be passed twice +func TestPassfileX2(t *testing.T) { + dir := test_helpers.InitFS(t) + mnt := dir + ".mnt" + passfile1 := mnt + ".1.txt" + passfile2 := mnt + ".2.txt" + ioutil.WriteFile(passfile1, []byte("te"), 0600) + ioutil.WriteFile(passfile2, []byte("st"), 0600) + test_helpers.MountOrFatal(t, dir, mnt, "-passfile="+passfile1, "-passfile="+passfile2) + defer test_helpers.UnmountPanic(mnt) +} -- cgit v1.2.3