aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-05-01 18:29:06 +0200
committerJakob Unterwurzacher2019-05-01 18:29:06 +0200
commite22c8ea0bd9b1670d4ab2bb4c810119f43f16f40 (patch)
treed72cfb805401d2513fa995c35e797cc363f7d83f /tests
parenta97d14c42d902e53efdb42e9b32c4a39559fc262 (diff)
tests: fix root_test permission issues
The parent directories need execute all permissions.
Diffstat (limited to 'tests')
-rw-r--r--tests/root_test/root_test.go6
-rw-r--r--tests/test_helpers/helpers.go8
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/root_test/root_test.go b/tests/root_test/root_test.go
index 3607f77..6526fd2 100644
--- a/tests/root_test/root_test.go
+++ b/tests/root_test/root_test.go
@@ -39,10 +39,14 @@ func TestSupplementaryGroups(t *testing.T) {
t.Skip("must run as root")
}
cDir := test_helpers.InitFS(t)
+ os.Chmod(cDir, 0755)
pDir := cDir + ".mnt"
test_helpers.MountOrFatal(t, cDir, pDir, "-allow_other", "-extpass=echo test")
defer test_helpers.UnmountPanic(pDir)
+ // We need an unrestricted umask
+ syscall.Umask(0000)
+
dir1 := pDir + "/dir1"
err := os.Mkdir(dir1, 0770)
if err != nil {
@@ -53,7 +57,7 @@ func TestSupplementaryGroups(t *testing.T) {
t.Fatal(err)
}
- err = asUser(1235, 1235, []int{1234}, func() error { return os.Mkdir(dir1+"/foo", 0700) })
+ err = asUser(1235, 1235, []int{1234}, func() error { return os.Mkdir(dir1+"/dir2", 0700) })
if err != nil {
t.Error(err)
}
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go
index 7275997..df71e52 100644
--- a/tests/test_helpers/helpers.go
+++ b/tests/test_helpers/helpers.go
@@ -61,12 +61,14 @@ func doInit() {
MountInfo = make(map[string]mountInfo)
// Something like /tmp/gocryptfs-test-parent-1234
testParentDir := fmt.Sprintf("%s/gocryptfs-test-parent-%d", os.TempDir(), os.Getuid())
- os.MkdirAll(testParentDir, 0700)
+ os.MkdirAll(testParentDir, 0755)
var err error
TmpDir, err = ioutil.TempDir(testParentDir, "")
if err != nil {
panic(err)
}
+ // Open permissions for the allow_other tests
+ os.Chmod(TmpDir, 0755)
DefaultPlainDir = TmpDir + "/default-plain"
DefaultCipherDir = TmpDir + "/default-cipher"
}
@@ -104,11 +106,11 @@ func ResetTmpDir(createDirIV bool) {
}
}
}
- err = os.Mkdir(DefaultPlainDir, 0700)
+ err = os.Mkdir(DefaultPlainDir, 0755)
if err != nil {
panic(err)
}
- err = os.Mkdir(DefaultCipherDir, 0700)
+ err = os.Mkdir(DefaultCipherDir, 0755)
if err != nil {
panic(err)
}