diff options
author | Jakob Unterwurzacher | 2020-05-17 19:31:04 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-05-17 19:31:04 +0200 |
commit | 416080203b4dd79de857eaf7c7cc97d050e00a9f (patch) | |
tree | ed729c4cd365acc803a3d1e339eae8f1e8112f4c /tests/cli | |
parent | ded4bbe6456dcfaa770f2c06df46d578fcbaa97e (diff) |
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
Diffstat (limited to 'tests/cli')
-rw-r--r-- | tests/cli/cli_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
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) +} |