summaryrefslogtreecommitdiff
path: root/tests/reverse/ctlsock_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reverse/ctlsock_test.go')
-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)
+}