From 991adfc934d714897e3c0ad39d37fca3edf59bcb Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 13 May 2019 23:01:44 +0200 Subject: -passwd now takes a passed -scryptn flag into account https://github.com/rfjakob/gocryptfs/issues/400 --- tests/cli/cli_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/cli') diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 7b6736a..da9d508 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "os" "os/exec" + "strconv" "syscall" "testing" "time" @@ -92,6 +93,9 @@ func TestInitReverse(t *testing.T) { } } +// testPasswd changes the password from "test" to "test" using +// the -extpass method, then from "test" to "newpasswd" using the +// stdin method. func testPasswd(t *testing.T, dir string, extraArgs ...string) { // Change password using "-extpass" args := []string{"-q", "-passwd", "-extpass", "echo test"} @@ -225,6 +229,23 @@ func TestPasswdReverse(t *testing.T) { testPasswd(t, dir, "-reverse") } +// Test -passwd with -scryptn +func TestPasswdScryptn(t *testing.T) { + dir := test_helpers.InitFS(t) + cf, err := configfile.Load(dir + "/gocryptfs.conf") + if err != nil { + t.Fatal(err) + } + testPasswd(t, dir, "-scryptn", strconv.Itoa(cf.ScryptObject.LogN()+1)) + cf2, err := configfile.Load(dir + "/gocryptfs.conf") + if err != nil { + t.Fatal(err) + } + if cf2.ScryptObject.LogN() != cf.ScryptObject.LogN()+1 { + t.Errorf("wrong logN value %d", cf2.ScryptObject.LogN()) + } +} + // Test -init & -config flag func TestInitConfig(t *testing.T) { config := test_helpers.TmpDir + "/TestInitConfig.conf" -- cgit v1.2.3