diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-23 12:35:47 +0200 |
|---|---|---|
| committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-23 12:35:47 +0200 |
| commit | 378eaded1aec073a815b8687e67a2e2eadd3228c (patch) | |
| tree | 7a7e3ea0911600c9b5154a2273f9af76c1de8766 /t/lib-sudo.sh | |
| parent | 2f0dde7852b7866bb044926f73334ff3fc30654b (diff) | |
| parent | 80c525c4acaf6072697d4bd2a3a5137f91665b55 (diff) | |
| download | git-378eaded1aec073a815b8687e67a2e2eadd3228c.tar.gz | |
Sync with 2.33.4
* maint-2.33:
Git 2.33.4
Git 2.32.3
Git 2.31.4
Git 2.30.5
setup: tighten ownership checks post CVE-2022-24765
git-compat-util: allow root to access both SUDO_UID and root owned
t0034: add negative tests and allow git init to mostly work under sudo
git-compat-util: avoid failing dir ownership checks if running privileged
t: regression git needs safe.directory when using sudo
Diffstat (limited to 't/lib-sudo.sh')
| -rw-r--r-- | t/lib-sudo.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/lib-sudo.sh b/t/lib-sudo.sh new file mode 100644 index 0000000000..b4d7788f4e --- /dev/null +++ b/t/lib-sudo.sh @@ -0,0 +1,15 @@ +# Helpers for running git commands under sudo. + +# Runs a scriplet passed through stdin under sudo. +run_with_sudo () { + local ret + local RUN="$TEST_DIRECTORY/$$.sh" + write_script "$RUN" "$TEST_SHELL_PATH" + # avoid calling "$RUN" directly so sudo doesn't get a chance to + # override the shell, add aditional restrictions or even reject + # running the script because its security policy deem it unsafe + sudo "$TEST_SHELL_PATH" -c "\"$RUN\"" + ret=$? + rm -f "$RUN" + return $ret +} |
