aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-05-13 23:01:44 +0200
committerJakob Unterwurzacher2019-05-13 23:01:44 +0200
commit991adfc934d714897e3c0ad39d37fca3edf59bcb (patch)
tree6c63f27a46ea35d6244d3b5cd125e883bff05d5a /tests
parent2cb0e8a1aeb42920f965956995d99cd2c8dbaa67 (diff)
-passwd now takes a passed -scryptn flag into account
https://github.com/rfjakob/gocryptfs/issues/400
Diffstat (limited to 'tests')
-rw-r--r--tests/cli/cli_test.go21
1 files changed, 21 insertions, 0 deletions
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"