fix darwin

This commit is contained in:
wh1te909 2023-02-27 22:04:56 +00:00
parent 2316271bf9
commit a0828c98ab
3 changed files with 46 additions and 13 deletions

16
agent/agent_darwin.go Normal file
View File

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

30
agent/agent_linux.go Normal file
View File

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

View File

@ -492,19 +492,6 @@ func (a *Agent) GetWMIInfo() map[string]interface{} {
return wmiInfo 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) { func createNixTmpFile() (*os.File, error) {
var f *os.File var f *os.File
noexec := tmpNoExec() noexec := tmpNoExec()