aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-04-08 20:18:45 +0200
committerJakob Unterwurzacher2019-04-08 20:18:45 +0200
commitfe06e9f45646893dc88ebe9e657e2e991f6f5fbb (patch)
treead5d8e2910ed71a5c579e40f897093bec2e19011 /tests
parent8459bb15c1a32561c250a8b688ab4a7ecda0a4aa (diff)
readpassword: delete CheckTrailingGarbage
CheckTrailingGarbage was called even when "-passfile" was used, which is stupid, and causes false positives: https://github.com/rfjakob/gocryptfs/issues/391 (false error "Received trailing garbage after the password" when using -passfile in .bash_profile) Instead of trying to improve the logic to handle that case and make everything even more complicated, delete the function. It is unclear if actually helps in some cases, and it definitely harms as shown by the above bug report.
Diffstat (limited to 'tests')
-rw-r--r--tests/cli/cli_test.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index 58ffe44..7b6736a 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -317,50 +317,6 @@ func TestShadows(t *testing.T) {
}
}
-// TestInitTrailingGarbage verfies that gocryptfs exits with an error if we
-// pass additional data after the password.
-func TestInitTrailingGarbage(t *testing.T) {
- table := []struct {
- pw string
- closeStdin bool
- expectSuccess bool
- }{
- {"foo\n", false, true},
- {"foo", true, true},
- {"foo\n", true, true},
- {"foo\n\n", false, false},
- {"foo\nbar", false, false},
- {"foo\n\n", true, false},
- {"foo\nbar", true, false},
- }
- for _, row := range table {
- dir, err := ioutil.TempDir(test_helpers.TmpDir, "")
- if err != nil {
- t.Fatal(err)
- }
- cmd := exec.Command(test_helpers.GocryptfsBinary, "-q", "-init", "-scryptn=10", dir)
- childStdin, err := cmd.StdinPipe()
- if err != nil {
- t.Fatal(err)
- }
- err = cmd.Start()
- if err != nil {
- t.Fatal(err)
- }
- childStdin.Write([]byte(row.pw))
- if row.closeStdin {
- childStdin.Close()
- }
- err = cmd.Wait()
- success := (err == nil)
- if success == true && row.expectSuccess == false {
- t.Errorf("pw=%q should have failed, but succeeded", row.pw)
- } else if success == false && row.expectSuccess == true {
- t.Errorf("pw=%q should have succeeded, but failed", row.pw)
- }
- }
-}
-
// TestMountPasswordIncorrect makes sure the correct exit code is used when the password
// was incorrect while mounting
func TestMountPasswordIncorrect(t *testing.T) {