aboutsummaryrefslogtreecommitdiff
path: root/tests/cli
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-03-30 20:06:40 +0100
committerJakob Unterwurzacher2019-03-30 20:06:40 +0100
commitec17445b996e7a2dc3b753963ea329881430e27b (patch)
tree964ace7e3b1646506905d978da5407f108ecf5f2 /tests/cli
parenta4f461a305381ec04062b814dc2f73cadaac2f50 (diff)
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
Diffstat (limited to 'tests/cli')
-rw-r--r--tests/cli/cli_test.go20
1 files changed, 20 insertions, 0 deletions
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")