tests: fix root_test permission issues

The parent directories need execute all permissions.
This commit is contained in:
Jakob Unterwurzacher 2019-05-01 18:29:06 +02:00
parent a97d14c42d
commit e22c8ea0bd
2 changed files with 10 additions and 4 deletions

View File

@ -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)
}

View File

@ -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)
}