summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-11-10 23:51:47 +0100
committerJakob Unterwurzacher2016-11-10 23:51:47 +0100
commitd8fb28a1c38cda0b013c617404ad4a768effb704 (patch)
tree898a42172caa21cc34516f203b0cf2729872f67c /tests
parentc2629bd9b5b814cb7abaf6ddc42bd9f1f306b30b (diff)
ctlsock: prevent panic on invalid decrypt request
Diffstat (limited to 'tests')
-rw-r--r--tests/reverse/ctlsock_test.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/reverse/ctlsock_test.go b/tests/reverse/ctlsock_test.go
index 0e4a29b..8a7d462 100644
--- a/tests/reverse/ctlsock_test.go
+++ b/tests/reverse/ctlsock_test.go
@@ -22,7 +22,8 @@ var ctlSockTestCases = [][]string{
{"gocryptfs.longname.cvRximo1ATRJVEzw_V9MZieHFlod9y2iv2Sug1kbiTE=/rBPJYAzcHWLdPj1T8kgh8A==", "longdir." + x240 + "/file"},
}
-func TestCtlSockDecryptPath(t *testing.T) {
+// Test DecryptPath and EncryptPath
+func TestCtlSockPathOps(t *testing.T) {
mnt, err := ioutil.TempDir(test_helpers.TmpDir, "reverse_mnt_")
if err != nil {
t.Fatal(err)
@@ -50,3 +51,18 @@ func TestCtlSockDecryptPath(t *testing.T) {
}
}
}
+
+// We should not panic when somebody feeds requests that make no sense
+func TestCtlSockCrash(t *testing.T) {
+ mnt, err := ioutil.TempDir(test_helpers.TmpDir, "reverse_mnt_")
+ if err != nil {
+ t.Fatal(err)
+ }
+ sock := mnt + ".sock"
+ test_helpers.MountOrFatal(t, "ctlsock_reverse_test_fs", mnt, "-reverse", "-extpass", "echo test", "-ctlsock="+sock,
+ "-wpanic=0", "-nosyslog=0")
+ defer test_helpers.UnmountPanic(mnt)
+ // Try to crash it
+ req := ctlsock.RequestStruct{DecryptPath: "gocryptfs.longname.XXX_TestCtlSockCrash_XXX.name"}
+ test_helpers.QueryCtlSock(t, sock, req)
+}