diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-23 12:36:12 +0200 |
|---|---|---|
| committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-23 12:36:12 +0200 |
| commit | 8f8eea8c3aba154ce1f9eaab4fa06c73b60550dc (patch) | |
| tree | 9eb673bb05503f8b8a2c2c868cc773b20407e8cf /t/lib-sudo.sh | |
| parent | dc8c8deaa6b5847733bd7df011a4c7b7d1a64e0a (diff) | |
| parent | 359da658ae32d9a7e5e93ac173fc221352b62917 (diff) | |
| download | git-8f8eea8c3aba154ce1f9eaab4fa06c73b60550dc.tar.xz | |
Sync with 2.35.4
* maint-2.35:
Git 2.35.4
Git 2.34.4
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 +} |
