summaryrefslogtreecommitdiff
path: root/tests/cli
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-09-08 13:04:33 +0200
committerJakob Unterwurzacher2018-09-08 13:04:33 +0200
commitca24c206945266d6397aa0e7d136d5bdcbda777f (patch)
tree3b9cebc661bcb788d6af175d86d03dd9d8a22e18 /tests/cli
parent2bdf7d5172d3540606f098030e8ede7a3ad1dfdd (diff)
main: don't read the config file twice (fix pipe bug)
Instead, first Load() the file, then DecryptMasterKey(). Fixes https://github.com/rfjakob/gocryptfs/issues/258
Diffstat (limited to 'tests/cli')
-rw-r--r--tests/cli/cli_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index eaa92b6..bd22a43 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -495,3 +495,26 @@ func TestExcludeForward(t *testing.T) {
}
t.Log(err)
}
+
+// Check that the config file can be read from a named pipe.
+// Make sure bug https://github.com/rfjakob/gocryptfs/issues/258 does not come
+// back.
+func TestConfigPipe(t *testing.T) {
+ dir := test_helpers.InitFS(t)
+ mnt := dir + ".mnt"
+ err := os.Mkdir(mnt, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ bashLine := fmt.Sprintf("%s -q -extpass \"echo test\" -config <(cat %s/gocryptfs.conf) %s %s", test_helpers.GocryptfsBinary, dir, dir, mnt)
+ cmd := exec.Command("bash", "-c", bashLine)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stdout
+ err = cmd.Run()
+ exitCode := test_helpers.ExtractCmdExitCode(err)
+ if exitCode != 0 {
+ t.Errorf("bash command\n%q\nresulted in exit code %d", bashLine, exitCode)
+ return
+ }
+ test_helpers.UnmountPanic(mnt)
+}