From 53d6a9999dd0e4c31636d16179f284fff35a35d9 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 7 Jun 2018 22:50:30 +0200 Subject: main: accept -dev, -nodev, -suid, -nosuid, -exec, -noexec When mounted via /etc/fstab like this, /a /b fuse.gocryptfs default 0 0 we always get extra options passed. As reported by @mahkoh at https://github.com/rfjakob/gocryptfs/pull/233 : mount passes `-o noexec` if `-o user` is set and `-o exec` is not set. If both `-o user` and `-o exec` are set, it passes `-o exec`. Make these options work, and in addtion, also make -suid and -rw work the same way. Reported-by: @mahkoh --- tests/cli/cli_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/cli') diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 8808742..5508360 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -449,6 +449,30 @@ func TestMultipleOperationFlags(t *testing.T) { } } +func TestNoexec(t *testing.T) { + dir := test_helpers.InitFS(t) + mnt := dir + ".mnt" + err := os.Mkdir(mnt, 0700) + if err != nil { + t.Fatal(err) + } + test_helpers.MountOrFatal(t, dir, mnt, "-extpass=echo test", "-noexec") + defer test_helpers.UnmountPanic(mnt) + sh := mnt + "/x.sh" + content := `#!/bin/bash +echo hello +` + err = ioutil.WriteFile(sh, []byte(content), 0755) + if err != nil { + t.Fatal(err) + } + err = exec.Command(sh).Run() + exitCode := test_helpers.ExtractCmdExitCode(err) + if exitCode != int(syscall.EACCES) { + t.Errorf("got exitcode %d instead of EPERM (%d)", exitCode, syscall.EPERM) + } +} + // Test that a missing argument to "-o" triggers exit code 1. // See also cli_args_test.go for comprehensive tests of "-o" parsing. func TestMissingOArg(t *testing.T) { -- cgit v1.2.3