aboutsummaryrefslogtreecommitdiff
path: root/tests/cli/cli_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-05-17 19:31:04 +0200
committerJakob Unterwurzacher2020-05-17 19:31:04 +0200
commit416080203b4dd79de857eaf7c7cc97d050e00a9f (patch)
treeed729c4cd365acc803a3d1e339eae8f1e8112f4c /tests/cli/cli_test.go
parentded4bbe6456dcfaa770f2c06df46d578fcbaa97e (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/cli_test.go')
-rw-r--r--tests/cli/cli_test.go22
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)
+}