bastion 0.55.3
ci / personal-data (push) Successful in 5s
ci / test (push) Successful in 3m51s
ci / fuzz (push) Successful in 2m55s

This commit is contained in:
Privatae
2026-10-25 23:16:45 +00:00
parent 77b7853ae1
commit 8822d5df85
136 changed files with 8638 additions and 1641 deletions
+6 -1
View File
@@ -18,6 +18,8 @@ import (
"sync"
"syscall"
"time"
"golang.org/x/sys/unix"
)
type shellProc struct {
@@ -32,7 +34,10 @@ func startRootExec(command string, stdout, stderr io.Writer, cgroupFD int) (root
if u, err := user.Lookup("root"); err == nil && u.HomeDir != "" {
home = u.HomeDir
}
if st, err := os.Stat(home); err != nil || !st.IsDir() {
// A home this process cannot enter is no working folder for the command.
// The daemon is root here, so that is only a home that is not there; the
// tests also run this as an ordinary user, for whom /root is shut.
if st, err := os.Stat(home); err != nil || !st.IsDir() || unix.Access(home, unix.X_OK) != nil {
home = "/"
}
cmd := exec.Command("/bin/sh", "-c", command)