diff --git a/agent/agent_darwin.go b/agent/agent_darwin.go new file mode 100644 index 0000000..c7741c4 --- /dev/null +++ b/agent/agent_darwin.go @@ -0,0 +1,16 @@ +/* +Copyright 2022 AmidaWare LLC. + +Licensed under the Tactical RMM License Version 1.0 (the “License”). +You may only use the Licensed Software in accordance with the License. +A copy of the License is available at: + +https://license.tacticalrmm.com + +*/ + +package agent + +func tmpNoExec() bool { + return false +} diff --git a/agent/agent_linux.go b/agent/agent_linux.go new file mode 100644 index 0000000..c7d16e1 --- /dev/null +++ b/agent/agent_linux.go @@ -0,0 +1,30 @@ +/* +Copyright 2022 AmidaWare LLC. + +Licensed under the Tactical RMM License Version 1.0 (the “License”). +You may only use the Licensed Software in accordance with the License. +A copy of the License is available at: + +https://license.tacticalrmm.com + +*/ + +package agent + +import ( + "os" + "syscall" +) + +func tmpNoExec() bool { + var stat syscall.Statfs_t + var noexec bool + + tmpdir := os.TempDir() + if err := syscall.Statfs(tmpdir, &stat); err == nil { + if stat.Flags&syscall.MS_NOEXEC != 0 { + noexec = true + } + } + return noexec +} diff --git a/agent/agent_unix.go b/agent/agent_unix.go index 27e18c3..fc65765 100644 --- a/agent/agent_unix.go +++ b/agent/agent_unix.go @@ -492,19 +492,6 @@ func (a *Agent) GetWMIInfo() map[string]interface{} { return wmiInfo } -func tmpNoExec() bool { - var stat syscall.Statfs_t - var noexec bool - - tmpdir := os.TempDir() - if err := syscall.Statfs(tmpdir, &stat); err == nil { - if stat.Flags&syscall.MS_NOEXEC != 0 { - noexec = true - } - } - return noexec -} - func createNixTmpFile() (*os.File, error) { var f *os.File noexec := tmpNoExec()