diff options
author | Josh Rickmar <jrick@zettaport.com> | 2023-06-12 16:10:55 +0000 |
---|---|---|
committer | David Chase <drchase@google.com> | 2023-06-13 18:10:14 +0000 |
commit | 8b5ed3cdaeba621687c71c19174bb4db0f5713f0 (patch) | |
tree | 0ac594b630317e1814525b05e23ab9e2a260b989 | |
parent | 8faa79e91f52727fdf6c3fa2e96d1068a8b2f3df (diff) | |
download | go-8b5ed3cdaeba621687c71c19174bb4db0f5713f0.tar.gz go-8b5ed3cdaeba621687c71c19174bb4db0f5713f0.zip |
runtime: Use doas -n in TestSUID on OpenBSD
This prevents a hang at a su password prompt when running this test on
OpenBSD.
Fixes #60690.
Change-Id: I62d27aa63f225f8247c324b87b5e688319061f4f
GitHub-Last-Rev: 217813a4d57a97954449d13c24a465aa0af41da3
GitHub-Pull-Request: golang/go#60742
Reviewed-on: https://go-review.googlesource.com/c/go/+/502575
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
-rw-r--r-- | src/runtime/security_test.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/security_test.go b/src/runtime/security_test.go index 1d304113d6..5cd90f9d1f 100644 --- a/src/runtime/security_test.go +++ b/src/runtime/security_test.go @@ -27,6 +27,8 @@ func privesc(command string, args ...string) error { var cmd *exec.Cmd if runtime.GOOS == "darwin" { cmd = exec.CommandContext(ctx, "sudo", append([]string{"-n", command}, args...)...) + } else if runtime.GOOS == "openbsd" { + cmd = exec.CommandContext(ctx, "doas", append([]string{"-n", command}, args...)...) } else { cmd = exec.CommandContext(ctx, "su", highPrivUser, "-c", fmt.Sprintf("%s %s", command, strings.Join(args, " "))) } |