mirror of
https://tildegit.org/solderpunk/molly-brown.git
synced 2025-04-13 09:29:46 +00:00

The split reflects that between variables which can and cannot be overridden by .molly files, and this greatly simplifies the processing of said files, getting rid of the need for lots of ugly temporary variable thrashing.
23 lines
465 B
Go
23 lines
465 B
Go
// +build linux,!go1.16
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func enableSecurityRestrictions(config SysConfig, ui userInfo) error {
|
|
|
|
// Prior to Go 1.6, setuid did not work reliably on Linux
|
|
// So, absolutely refuse to run as root
|
|
uid := os.Getuid()
|
|
euid := os.Geteuid()
|
|
if uid == 0 || euid == 0 {
|
|
setuid_err := "Refusing to run with root privileges when setuid() will not work!"
|
|
log.Println(setuid_err)
|
|
return error.New(setuid_err)
|
|
}
|
|
|
|
return nil
|
|
}
|