From ec17445b996e7a2dc3b753963ea329881430e27b Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 30 Mar 2019 20:06:40 +0100 Subject: forward mode: create gocryptfs.diriv files with 0440 permissions Makes it easier to share an encrypted folder via a network drive. https://github.com/rfjakob/gocryptfs/issues/387 --- tests/cli/cli_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/cli') diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 48ce303..438ba16 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -43,6 +43,26 @@ func TestInit(t *testing.T) { } } +// Test that gocryptfs.conf and gocryptfs.diriv are there with the expected +// permissions after -init +func TestInitFilePerms(t *testing.T) { + dir := test_helpers.InitFS(t) + var st syscall.Stat_t + syscall.Stat(dir+"/gocryptfs.conf", &st) + perms := st.Mode & 0777 + if perms != 0400 { + t.Errorf("Wrong permissions for gocryptfs.conf: %#o", perms) + } + st = syscall.Stat_t{} + syscall.Stat(dir+"/gocryptfs.diriv", &st) + perms = st.Mode & 0777 + // From v1.7.1, these are created with 0440 permissions, see + // https://github.com/rfjakob/gocryptfs/issues/387 + if perms != 0440 { + t.Errorf("Wrong permissions for gocryptfs.diriv: %#o", perms) + } +} + // Test -init with -devrandom flag func TestInitDevRandom(t *testing.T) { test_helpers.InitFS(t, "-devrandom") -- cgit v1.2.3